NetBSD Problem Report #17208
Received: (qmail 21711 invoked by uid 605); 10 Jun 2002 22:39:12 -0000
Message-Id: <20020610223910.AA21A9745@pc1.whooppee.com>
Date: Mon, 10 Jun 2002 15:39:10 -0700 (PDT)
From: paul@whooppee.com
Sender: gnats-bugs-owner@netbsd.org
Reply-To: paul@whooppee.com
To: gnats-bugs@gnats.netbsd.org
Subject: Insufficient delay in wdc_attach()
X-Send-Pr-Version: 3.95
>Number: 17208
>Category: kern
>Synopsis: Insufficient delay in wdc_attach()
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 10 22:40:01 +0000 2002
>Closed-Date: Thu Jun 13 09:10:29 +0000 2002
>Last-Modified: Thu Jun 13 09:10:29 +0000 2002
>Originator: Paul Goyette
>Release: NetBSD 1.6A
>Organization:
----------------------------------------------------------------------
| Paul Goyette | PGP DSS Key fingerprint: | E-mail addresses: |
| Network Engineer | 9DC5 05CF 1AE7 DC42 CCC6 | paul@whooppee.com |
| & World Cruiser | 6858 051E 7AD2 A6B2 4954 | pgoyette@juniper.net |
----------------------------------------------------------------------
>Environment:
System: NetBSD pc1.whooppee.com 1.6A NetBSD 1.6A (PC1) #14: Sun Jun 9 13:08:20 PDT 2002 paul@pc1.whooppee.com:/usr/obj/.i386/sys/arch/i386/compile/PC1 i386
Architecture: i386
Machine: i386
>Description:
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
e
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.
>How-To-Repeat:
>Fix:
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, ¶ms);
if (error != CMD_OK) {
delay(1000000);
>Release-Note:
>Audit-Trail:
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: paul@whooppee.com
Cc: gnats-bugs@gnats.netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/17208: Insufficient delay in wdc_attach()
Date: Wed, 12 Jun 2002 11:55:11 +0200
On Mon, Jun 10, 2002 at 03:39:10PM -0700, paul@whooppee.com wrote:
> [...]
> 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
> e
>
> 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.
wdc_atapi_get_params() is for ATAPI devices only, and ATAPI devices are not
supposed to react to a WDC_RESET, only the SOFT_RESET command. This is why
I didn't bump the delay here.
However there's no harm in making it 5ms, so I commited your patch.
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--
State-Changed-From-To: open->closed
State-Changed-By: bouyer
State-Changed-When: Thu Jun 13 02:10:00 PDT 2002
State-Changed-Why:
Patch commited and pulled up to 1.6 branch. Thanks !
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.