summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2010-07-03 01:40:13 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2010-07-03 01:40:13 +0000
commit475e5e3ee04d2dc8337e25d53823f6d7e4779e3d (patch)
treec917190803e3eebc7d50ba14a6df8ac0615d9932 /sys/scsi
parent068b9a96a35ba933a788d371e9a3c8e282c10f5a (diff)
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
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/sd.c15
1 files changed, 10 insertions, 5 deletions
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)
{