summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2011-04-15 20:53:28 +0000
committermiod <miod@openbsd.org>2011-04-15 20:53:28 +0000
commitba8cbb4a615731df82a088c6322903ba45e6992c (patch)
tree384e1fe4654474473e06a5ae91779340ff2078fb /sys/dev/ata
parentMore than a decade ago, interrupt handlers on sparc started returning 0 (diff)
downloadwireguard-openbsd-ba8cbb4a615731df82a088c6322903ba45e6992c.tar.xz
wireguard-openbsd-ba8cbb4a615731df82a088c6322903ba45e6992c.zip
Change wdc_reset_channel() to take a `no wait' argument. Pass in turn this
argument to wdcreset(), to have it skip waiting until active channels see their BUSY bit clear in the status register. Use this feature in the resume path, during the first reset operation. The first reset is supposed to only wake up the controller, and the disks don't come back until the second reset is issued, therefore waiting for them to report themselves as ready after the first reset, but before the second, is moot - and as a matter of fact some controllers, such as the AMD 754 and clones/offspring (e.g. Geode) keep the BUSY bit asserted after the first reset. Last, but not least, make sure wd@ata invokes wd_get_params() again before returning from the resume code, as we will still be using polled transfers for a short while. This causes the Lemote Yeelong to resume within less than one second, instead of the lousy 30 seconds wait between the two resets; and the wd_get_params() voodoo prevents it from getting spurious ide interrupts afterwards. wd_get_params() magic from dlg; rest of the work by yours truly after enough prodding by dlg@ and pirofti@, among others. ok deraadt@ dlg@
Diffstat (limited to 'sys/dev/ata')
-rw-r--r--sys/dev/ata/atavar.h4
-rw-r--r--sys/dev/ata/wd.c11
2 files changed, 8 insertions, 7 deletions
diff --git a/sys/dev/ata/atavar.h b/sys/dev/ata/atavar.h
index 8214bc07358..9a57392b8ac 100644
--- a/sys/dev/ata/atavar.h
+++ b/sys/dev/ata/atavar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: atavar.h,v 1.19 2010/07/23 07:47:13 jsg Exp $ */
+/* $OpenBSD: atavar.h,v 1.20 2011/04/15 20:53:28 miod Exp $ */
/* $NetBSD: atavar.h,v 1.13 1999/03/10 13:11:43 bouyer Exp $ */
/*
@@ -164,7 +164,7 @@ void wdc_probe_caps(struct ata_drive_datas*, struct ataparams *);
void wdc_print_caps(struct ata_drive_datas*);
int wdc_downgrade_mode(struct ata_drive_datas*);
-void wdc_reset_channel(struct ata_drive_datas *);
+void wdc_reset_channel(struct ata_drive_datas *, int);
int wdc_ata_addref(struct ata_drive_datas *);
void wdc_ata_delref(struct ata_drive_datas *);
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c
index 23ba6e1ae2b..eedfac0c256 100644
--- a/sys/dev/ata/wd.c
+++ b/sys/dev/ata/wd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wd.c,v 1.98 2011/04/05 19:57:40 deraadt Exp $ */
+/* $OpenBSD: wd.c,v 1.99 2011/04/15 20:53:28 miod Exp $ */
/* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */
/*
@@ -355,13 +355,14 @@ wdactivate(struct device *self, int act)
/*
* Do two resets separated by a small delay. The
* first wakes the controller, the second resets
- * the channel
+ * the channel.
*/
wdc_disable_intr(wd->drvp->chnl_softc);
- wdc_reset_channel(wd->drvp);
+ wdc_reset_channel(wd->drvp, 1);
delay(10000);
- wdc_reset_channel(wd->drvp);
+ wdc_reset_channel(wd->drvp, 0);
wdc_enable_intr(wd->drvp->chnl_softc);
+ wd_get_params(wd, at_poll, &wd->sc_params);
break;
}
return (rv);
@@ -582,7 +583,7 @@ wddone(void *v)
sizeof buf);
retry:
/* Just reset and retry. Can we do more ? */
- wdc_reset_channel(wd->drvp);
+ wdc_reset_channel(wd->drvp, 0);
diskerr(bp, "wd", errbuf, LOG_PRINTF,
wd->sc_wdc_bio.blkdone, wd->sc_dk.dk_label);
if (wd->retries++ < WDIORETRIES) {