diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-04-11 16:58:07 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-04-11 16:58:07 +0000 |
commit | 5f481821f98626e834fb6d0ec1974a225a87767e (patch) | |
tree | 5fa693a234521b8c973ac4c067b49df392f30add /sys/dev/ata | |
parent | ccf04ea2b34dd74589c83b99def187a1a5dcbe11 (diff) |
Send "STANDBY IMMEDIATE" command to ATA disks upon suspend. For this to work,
pciide(4) needs to formward DVACT_SUSPEND and DVACT_RESUME events to its
children, so do that.
Gets rid of the nasty "click" sound from the disk on many laptops.
ok marco@, jsg@
Diffstat (limited to 'sys/dev/ata')
-rw-r--r-- | sys/dev/ata/wd.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index 35ead361038..5a6182a946a 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd.c,v 1.77 2009/10/13 19:33:16 pirofti Exp $ */ +/* $OpenBSD: wd.c,v 1.78 2010/04/11 16:58:06 kettenis Exp $ */ /* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ /* @@ -377,6 +377,8 @@ wdattach(struct device *parent, struct device *self, void *aux) int wdactivate(struct device *self, int act) { + struct wd_softc *wd = (void *)self; + struct wdc_command wdc_c; int rv = 0; switch (act) { @@ -388,6 +390,17 @@ wdactivate(struct device *self, int act) * Nothing to do; we key off the device's DVF_ACTIVATE. */ break; + case DVACT_SUSPEND: + bzero(&wdc_c, sizeof(struct wdc_command)); + + wdc_c.r_command = WDCC_STANDBY_IMMED; + wdc_c.timeout = 1000; + wdc_c.flags = at_poll; + if (wdc_exec_command(wd->drvp, &wdc_c) != WDC_COMPLETE) { + printf("%s: enter standby command didn't complete\n", + wd->sc_dev.dv_xname); + } + break; } return (rv); } |