First part of better pciide resume. Wake the channel by performing two
authormlarkin <mlarkin@openbsd.org>
Thu, 22 Jul 2010 18:10:37 +0000 (18:10 +0000)
committermlarkin <mlarkin@openbsd.org>
Thu, 22 Jul 2010 18:10:37 +0000 (18:10 +0000)
resets separated by a small delay (a delay intended to offend jsg who will
definitely want to fix it by checking for RDY instead)

Tested on a variety of amd and i386 hardware by myself and deraadt@

ok deraadt

sys/dev/ata/wd.c

index d357e8f..e8be252 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: wd.c,v 1.85 2010/06/28 08:35:46 jsing Exp $ */
+/*     $OpenBSD: wd.c,v 1.86 2010/07/22 18:10:37 mlarkin Exp $ */
 /*     $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */
 
 /*
@@ -400,6 +400,18 @@ wdactivate(struct device *self, int act)
                wd_flushcache(wd, AT_POLL);
                wd_standby(wd, AT_POLL);
                break;
+       case DVACT_RESUME:
+               /*
+                * Do two resets separated by a small delay. The
+                * first wakes the controller, the second resets
+                * the channel
+                */
+               wdc_disable_intr(wd->drvp->chnl_softc);
+               wdc_reset_channel(wd->drvp);
+               delay(10000);
+               wdc_reset_channel(wd->drvp);
+               wdc_enable_intr(wd->drvp->chnl_softc);
+               break;
        }
        return (rv);
 }