Subject: kern/17208: Insufficient delay in wdc_attach()
To: None <>
From: None <>
List: netbsd-bugs
Date: 06/10/2002 15:39:10
>Number:         17208
>Category:       kern
>Synopsis:       Insufficient delay in wdc_attach()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 10 15:40:01 PDT 2002
>Originator:     Paul Goyette
>Release:        NetBSD 1.6A
|   Paul Goyette   | PGP DSS Key fingerprint: |  E-mail addresses:   |
| Network Engineer | 9DC5 05CF 1AE7 DC42 CCC6 |   |
|  & World Cruiser | 6858 051E 7AD2 A6B2 4954 | |
System: NetBSD 1.6A NetBSD 1.6A (PC1) #14: Sun Jun 9 13:08:20 PDT 2002 i386
Architecture: i386
Machine: i386
In src/sys/dev/ic/wdc.c, function wdc_attach(), there is a delay(100)
between the device reset and the attempt to get device parameters.  This
delay is insufficient for some devices.  In particular, a Seagate TR-5
tape drive which probes as

st0 at atapibus0 drive 0: <Seagate STT20000A, , 8A51> type 1 sequential removabl

locks up if you do not have at 2000 microseconds (2ms) of delay.

For some reason, there is a similar delay in src/sys/dev/ata/atapi_wdc.c
in routine wdc_atapi_get_params(), but here the delay amount is 5ms.

It seems to make sense to me that both of these delay()s should be the same,
as the comments immediately preceeding them indicate that the reason for
the delay() is the same, mainly that some devices don't behave well if they
are accessed too soon after being reset.
Index: wdc.c
RCS file: /cvsroot/syssrc/sys/dev/ic/wdc.c,v
retrieving revision 1.114
diff -c -u -r1.114 wdc.c
cvs server: conflicting specifications of output style
--- wdc.c       2002/04/09 21:17:54     1.114
+++ wdc.c       2002/06/10 22:37:44
@@ -358,6 +358,7 @@
                 * Then issue a IDENTIFY command, to try to detect slave ghost
-               delay(100);
+               delay(5000); /* PRG */
                error = ata_get_params(&chp->ch_drive[i], AT_POLL, &params);
                if (error != CMD_OK) {