Subject: Re: kern/23392: Wedges with cmdide on Silicon Image 3112 on IQ80321
To: None <briggs@ninthwonder.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-bugs
Date: 11/09/2003 12:36:44
--T4sUOijqQbZv57TR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sat, Nov 08, 2003 at 10:37:56PM +0100, Manuel Bouyer wrote:
> I guess a timing problem. 
> 
> Can you try to see if it hangs in the
> 	if (__predict_false(drvp->state < READY)) {
> block, or later ?
> Maybe set a breakpoint on cmdintr() too, in case it would be an
> interrupt loop.

Also, please try the attached patch

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 23 ans d'experience feront toujours la difference
--

--T4sUOijqQbZv57TR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: ata_wdc.c
===================================================================
RCS file: /home/bouyer/anoncvs/cvs/src/sys/dev/ata/ata_wdc.c,v
retrieving revision 1.42
diff -u -r1.42 ata_wdc.c
--- ata_wdc.c	29 Oct 2003 22:05:15 -0000	1.42
+++ ata_wdc.c	9 Nov 2003 11:33:14 -0000
@@ -239,6 +239,7 @@
 		bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_sdh,
 		    WDSD_IBM | (xfer->drive << 4));
 		errstring = "wait";
+		DELAY(1);
 		if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags))
 			goto ctrltimeout;
 		wdccommandshort(chp, xfer->drive, WDCC_RECAL);
@@ -257,6 +258,7 @@
 			goto geometry;
 		wdccommand(chp, drvp->drive, SET_FEATURES, 0, 0, 0,
 		    0x08 | drvp->PIO_mode, WDSF_SET_MODE);
+		DELAY(1);
 		errstring = "piomode";
 		if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags))
 			goto ctrltimeout;
@@ -271,6 +273,7 @@
 		} else {
 			goto geometry;
 		}	
+		DELAY(1);
 		errstring = "dmamode";
 		if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags))
 			goto ctrltimeout;
@@ -284,6 +287,7 @@
 		    ata_bio->lp->d_ntracks - 1, 0, ata_bio->lp->d_nsectors,
 		    (ata_bio->lp->d_type == DTYPE_ST506) ?
 			ata_bio->lp->d_precompcyl / 4 : 0);
+		DELAY(1);
 		errstring = "geometry";
 		if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags))
 			goto ctrltimeout;
@@ -295,6 +299,7 @@
 		wdccommand(chp, xfer->drive, WDCC_SETMULTI, 0, 0, 0,
 		    ata_bio->multi, 0);
 		errstring = "setmulti";
+		DELAY(1);
 		if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags))
 			goto ctrltimeout;
 		if (chp->ch_status & (WDCS_ERR | WDCS_DWF))

--T4sUOijqQbZv57TR--