summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1993-11-19 06:30:00 +0000
committerdg <dg@FreeBSD.org>1993-11-19 06:30:00 +0000
commit94bb597cccd46fc99bfe21ff07458a5b8f518495 (patch)
tree2ec49a3c041d2b06dd4b0b2e2e7b114381d8dee4 /sys
parent93375236f05146b0d0126694b378ff0ee611e449 (diff)
downloadFreeBSD-src-94bb597cccd46fc99bfe21ff07458a5b8f518495.zip
FreeBSD-src-94bb597cccd46fc99bfe21ff07458a5b8f518495.tar.gz
added 5us delay before checking BUSY flag to conform to ATA spec -
as suggested by John Dyson (dyson@implode.rain.com)
Diffstat (limited to 'sys')
-rw-r--r--sys/i386/isa/wd.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c
index 95c3db6..1787d32 100644
--- a/sys/i386/isa/wd.c
+++ b/sys/i386/isa/wd.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
- * $Id: wd.c,v 1.12 1993/11/17 23:25:20 wollman Exp $
+ * $Id: wd.c,v 1.13 1993/11/18 05:02:22 rgrimes Exp $
*/
/* TODO:peel out buffer at low ipl, speed improvement */
@@ -446,6 +446,8 @@ RETRY:
/* controller idle? */
timeout = 0;
+ /* must delay 5us to conform to ATA spec */
+ DELAY(5);
while (inb(wdc+wd_status) & WDCS_BUSY)
{
if (++timeout > WDCTIMEOUT)
@@ -573,7 +575,8 @@ wdintr(struct intrframe wdif)
#ifdef WDDEBUG
printf("I ");
#endif
-
+ /* must delay 5us to conform to ATA spec */
+ DELAY(5);
while ((status = inb(wdc+wd_status)) & WDCS_BUSY) ;
/* is it not a transfer, but a control operation? */
@@ -834,6 +837,8 @@ wdcontrol(register struct buf *bp)
outb(wdc+wd_sdh, WDSD_IBM | (unit << 4));
wdtab.b_active = 1;
+ /* must delay 5us to conform to ATA spec */
+ DELAY(5);
/* wait for drive and controller to become ready */
for (i = WDCTIMEOUT; (inb(wdc+wd_status) & (WDCS_READY|WDCS_BUSY))
!= WDCS_READY && i-- != 0; )
@@ -891,6 +896,8 @@ wdcommand(struct disk *du, int cmd) {
/* controller ready for command? */
wdc = du->dk_port;
+ /* must delay 5us to conform to ATA spec */
+ DELAY(5);
while (((stat = inb(wdc + wd_status)) & WDCS_BUSY) && timeout > 0)
timeout--;
if (timeout <= 0)
@@ -898,6 +905,8 @@ wdcommand(struct disk *du, int cmd) {
/* send command, await results */
outb(wdc+wd_command, cmd);
+ /* must delay 5us to conform to ATA spec */
+ DELAY(5);
while (((stat = inb(wdc+wd_status)) & WDCS_BUSY) && timeout > 0)
timeout--;
if (timeout <= 0)
@@ -1238,9 +1247,13 @@ wddump(dev_t dev) /* dump core after a system crash */
/*wdtab.b_active = 1;*/ /* mark controller active for if we
panic during the dump */
wddoingadump = 1 ; i = 100000 ;
+ /* must delay 5us to conform to ATA spec */
+ DELAY(5);
while ((inb(wdc+wd_status) & WDCS_BUSY) && (i-- > 0)) ;
outb(wdc+wd_sdh, WDSD_IBM | (unit << 4));
outb(wdc+wd_command, WDCC_RESTORE | WD_STEP);
+ /* must delay 5us to conform to ATA spec */
+ DELAY(5);
while (inb(wdc+wd_status) & WDCS_BUSY) ;
/* some compaq controllers require this ... */
@@ -1320,6 +1333,8 @@ wddump(dev_t dev) /* dump core after a system crash */
if (inb(wdc+wd_status) & WDCS_DRQ) return(EIO) ;
/* wait for completion */
+ /* must delay 5us to conform to ATA spec */
+ DELAY(5);
for ( i = WDCTIMEOUT ; inb(wdc+wd_status) & WDCS_BUSY ; i--) {
if (i < 0) return (EIO) ;
}
OpenPOWER on IntegriCloud