Refine the wait for ATAPI_RESET.

Properly wait for not busy and introduce a timeout for devices not
setting busy (as they should).
Leave a printf in there that states how long the wait was, as I'd like
to get an idea of the variations here. The time needed seems also to be
affected by whether a medium is present or not.
This commit is contained in:
sos 2004-07-24 19:03:28 +00:00
parent c0497f6c58
commit a33b996095

View File

@ -110,8 +110,16 @@ ata_generic_transaction(struct ata_request *request)
/* device reset doesn't interrupt */
if (request->u.ata.command == ATA_ATAPI_RESET) {
DELAY(10);
request->status = ATA_IDX_INB(ch, ATA_STATUS);
int timeout = 1000000;
do {
DELAY(10);
request->status = ATA_IDX_INB(ch, ATA_STATUS);
} while (request->status & ATA_S_BUSY && timeout--);
if (timeout)
printf("ATAPI_RESET time = %dus\n", (1000000-timeout)*10);
else
printf("ATAPI_RESET timeout\n");
if (request->status & ATA_S_ERROR) {
request->error = ATA_IDX_INB(ch, ATA_ERROR);
//request->result = EIO;