ATAPI_RESET hang fix

Brian Rogers burpmaster at truffula.net
Mon Aug 23 22:25:30 PDT 2004


I was getting the hang on start after the "ATAPI_RESET time = x" 
message.  I stuck in a diagnostic printf before the ATAPI_RESET, and 
that actually fixed the hang.  So I replaced it with a DELAY(50), and 
that also avoids the hang.

I guess some ATAPI devices don't like being reset right after being 
queried.  (Or there is a bug with handling that in FreeBSD)  Patch is 
attached.

-------------- next part --------------
--- ata-all.c.orig	Tue Aug 24 04:39:52 2004
+++ ata-all.c	Tue Aug 24 04:40:05 2004
@@ -624,6 +624,7 @@
 	if (ata_getparam(&ch->device[SLAVE], ATA_ATAPI_IDENTIFY))
 	    ch->devices &= ~ATA_ATAPI_SLAVE;
 	else {
+	    DELAY(50);
 	    ata_controlcmd(&ch->device[SLAVE], ATA_ATAPI_RESET, 0, 0, 0);
 	    switch (ch->device[SLAVE].param->config & ATA_ATAPI_TYPE_MASK) {
 #ifdef DEV_ATAPICD
@@ -656,6 +657,7 @@
 	if (ata_getparam(&ch->device[MASTER], ATA_ATAPI_IDENTIFY))
 	    ch->devices &= ~ATA_ATAPI_MASTER;
 	else {
+	    DELAY(50);
 	    ata_controlcmd(&ch->device[MASTER], ATA_ATAPI_RESET, 0, 0, 0);
 	    switch (ch->device[MASTER].param->config & ATA_ATAPI_TYPE_MASK) {
 #ifdef DEV_ATAPICD


More information about the freebsd-current mailing list