1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

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:
Søren Schmidt 2004-07-24 19:03:28 +00:00
parent 6b3322721c
commit a4c3e742b7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132606

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;