summaryrefslogtreecommitdiff
path: root/sys/dev/pci/pciide.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2010-04-11 16:58:07 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2010-04-11 16:58:07 +0000
commit5f481821f98626e834fb6d0ec1974a225a87767e (patch)
tree5fa693a234521b8c973ac4c067b49df392f30add /sys/dev/pci/pciide.c
parentccf04ea2b34dd74589c83b99def187a1a5dcbe11 (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/pci/pciide.c')
-rw-r--r--sys/dev/pci/pciide.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c
index 2248ff71a4c..0002f515519 100644
--- a/sys/dev/pci/pciide.c
+++ b/sys/dev/pci/pciide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pciide.c,v 1.306 2009/11/21 14:34:20 jsg Exp $ */
+/* $OpenBSD: pciide.c,v 1.307 2010/04/11 16:58:06 kettenis Exp $ */
/* $NetBSD: pciide.c,v 1.127 2001/08/03 01:31:08 tsutsui Exp $ */
/*
@@ -1265,13 +1265,16 @@ const struct pciide_vendor_desc pciide_vendors[] = {
int pciide_match(struct device *, void *, void *);
void pciide_attach(struct device *, struct device *, void *);
int pciide_detach(struct device *, int);
+int pciide_activate(struct device *, int);
struct cfattach pciide_pci_ca = {
- sizeof(struct pciide_softc), pciide_match, pciide_attach, pciide_detach,
+ sizeof(struct pciide_softc), pciide_match, pciide_attach,
+ pciide_detach, pciide_activate
};
struct cfattach pciide_jmb_ca = {
- sizeof(struct pciide_softc), pciide_match, pciide_attach, pciide_detach,
+ sizeof(struct pciide_softc), pciide_match, pciide_attach,
+ pciide_detach, pciide_activate
};
struct cfdriver pciide_cd = {
@@ -1403,6 +1406,21 @@ pciide_detach(struct device *self, int flags)
}
int
+pciide_activate(struct device *self, int act)
+{
+ int rv = 0;
+
+ switch (act) {
+ case DVACT_SUSPEND:
+ case DVACT_RESUME:
+ rv = config_activate_children(self, act);
+ break;
+ }
+
+ return (rv);
+}
+
+int
pciide_mapregs_compat(struct pci_attach_args *pa, struct pciide_channel *cp,
int compatchan, bus_size_t *cmdsizep, bus_size_t *ctlsizep)
{