From dff40dca7f0d8de1527bbdff9ef0d1f91d5894c6 Mon Sep 17 00:00:00 2001 From: mlarkin Date: Thu, 22 Jul 2010 18:10:37 +0000 Subject: [PATCH] First part of better pciide resume. Wake the channel by performing two 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 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index d357e8fae2a..e8be252b23a 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -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); } -- 2.20.1