Subject: Re: port-i386/30236: HighPoint 1540 doesn't find connected drives and freezes the system
To: None <gnats-bugs@NetBSD.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-bugs
Date: 05/16/2005 13:29:24
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Can you try the first attached patch ? If this doesn't help, please try
diff2, but note that this one will break any drive configured as
slave.

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

--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: src/sys/dev/ic/wdc.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/wdc.c,v
retrieving revision 1.221
diff -u -r1.221 wdc.c
--- src/sys/dev/ic/wdc.c	28 Mar 2005 22:08:51 -0000	1.221
+++ src/sys/dev/ic/wdc.c	16 May 2005 11:24:09 -0000
@@ -1161,12 +1161,12 @@
 				 * or some userland thread context
 				 */
 				for (i = 0; i < timeout_hz; i++) {
+					tsleep(&chp, PRIBIO, "atapoll", 1);
 					if (__wdcwait(chp, mask, bits,
 					    WDCDELAY_POLL) == 0) {
 						error = 0;
 						break;
 					}
-					tsleep(&chp, PRIBIO, "atapoll", 1);
 				}
 			} else {
 				/*

--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff2

Index: src/sys/dev/ic/wdc.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/wdc.c,v
retrieving revision 1.221
diff -u -r1.221 wdc.c
--- src/sys/dev/ic/wdc.c	28 Mar 2005 22:08:51 -0000	1.221
+++ src/sys/dev/ic/wdc.c	16 May 2005 11:27:02 -0000
@@ -1161,12 +1161,13 @@
 				 * or some userland thread context
 				 */
 				for (i = 0; i < timeout_hz; i++) {
+					tsleep(&chp, PRIBIO, "atapoll", 1);
+					bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0, WDSD_IBM | 0 /* (xfer->c_drive << 4) */);
 					if (__wdcwait(chp, mask, bits,
 					    WDCDELAY_POLL) == 0) {
 						error = 0;
 						break;
 					}
-					tsleep(&chp, PRIBIO, "atapoll", 1);
 				}
 			} else {
 				/*

--82I3+IH0IqGh5yIs--