Re: ATAPI_RESET hang fix

From: Søren Schmidt <sos_at_DeepCore.dk>
Date: Tue, 24 Aug 2004 09:58:19 +0200
Brian Rogers wrote:
> 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.

Hmm, you could be on to something, but instead of using a fixed delay 
I'd rather (re)introduce the wait for ready before selecting the device 
in ata_command. Could you please try the following patch and let me know 
if that fixes the problem as well ?

-Søren

Index: ata-lowlevel.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-lowlevel.c,v
retrieving revision 1.44
diff -u -r1.44 ata-lowlevel.c
--- ata-lowlevel.c      16 Aug 2004 09:32:35 -0000      1.44
+++ ata-lowlevel.c      24 Aug 2004 07:21:12 -0000
_at__at_ -721,6 +721,12 _at__at_
                    rman_get_start(atadev->channel->r_io[ATA_DATA].res),
                    command, (intmax_t)lba, count, feature);

+    /* ready to select device ? */
+    if (ata_wait(atadev, 0) < 0) {
+       ata_prtdev(atadev, "timeout waiting for ready command=%02x\n", 
command);
+       return -1;
+    }
+
      /* select device */
      ATA_IDX_OUTB(atadev->channel, ATA_DRIVE, ATA_D_IBM | atadev->unit);
Received on Tue Aug 24 2004 - 05:58:46 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:08 UTC