From 475e5e3ee04d2dc8337e25d53823f6d7e4779e3d Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 3 Jul 2010 01:40:13 +0000 Subject: Stop disk on suspend and start it again upon resume. Gets rid of the loud click upon suspend that my laptop with ahci(4) has. ok dlg@, ok marco@ on an earlier iteration of this diff --- sys/scsi/sd.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'sys/scsi') diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index d085f1b5418..aeb46e264d3 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.201 2010/07/01 05:11:18 krw Exp $ */ +/* $OpenBSD: sd.c,v 1.202 2010/07/03 01:40:12 kettenis Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -281,23 +281,28 @@ sdactivate(struct device *self, int act) sc->flags |= SDF_DYING; bufq_drain(sc->sc_bufq); break; + case DVACT_SUSPEND: /* - * If the disk cache needs to be flushed, and the disk - * supports it, flush it. We're cold at this point, - * so we poll for completion. + * Stop the disk. Stopping the disk should flush the + * cache, but we are paranoid so we flush the cache + * first. */ if ((sc->flags & SDF_DIRTY) != 0) sd_flush(sc, SCSI_AUTOCONF); + scsi_start(sc->sc_link, SSS_STOP, + SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_AUTOCONF); break; + case DVACT_RESUME: + scsi_start(sc->sc_link, SSS_START, + SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_AUTOCONF); break; } return (rv); } - int sddetach(struct device *self, int flags) { -- cgit v1.2.3