ATAPI_RESET hang fix
Søren Schmidt
sos at DeepCore.dk
Tue Aug 24 00:58:46 PDT 2004
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
@@ -721,6 +721,12 @@
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);
More information about the freebsd-current
mailing list