Improve timeout handling and reporting.

This commit is contained in:
Søren Schmidt 2003-10-07 13:47:40 +00:00
parent f313fea97d
commit b0f747d57e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=120882

View File

@ -316,7 +316,7 @@ ata_timeout(struct ata_request *request)
{ {
/* clear timeout etc */ /* clear timeout etc */
request->timeout_handle.callout = NULL; request->timeout_handle.callout = NULL;
#if 0
/* call interrupt to try finish up the command */ /* call interrupt to try finish up the command */
request->device->channel->hw.interrupt(request->device->channel); request->device->channel->hw.interrupt(request->device->channel);
@ -327,6 +327,7 @@ ata_timeout(struct ata_request *request)
ata_cmd2str(request)); ata_cmd2str(request));
return; return;
} }
#endif
/* if this was a DMA request stop the engine to be on the safe side */ /* if this was a DMA request stop the engine to be on the safe side */
if (request->flags & ATA_R_DMA) { if (request->flags & ATA_R_DMA) {
@ -334,22 +335,37 @@ ata_timeout(struct ata_request *request)
request->device->channel->dma->stop(request->device->channel); request->device->channel->dma->stop(request->device->channel);
} }
/* report that we timed out */
if (request->retries > 0 && !(request->flags & ATA_R_QUIET))
ata_prtdev(request->device,
"TIMEOUT - %s retrying (%d retr%s left)\n",
ata_cmd2str(request), request->retries,
request->retries == 1 ? "y" : "ies");
/* try to adjust HW's attitude towards work */ /* try to adjust HW's attitude towards work */
ata_reinit(request->device->channel); ata_reinit(request->device->channel);
/* if retries still permit, reinject this request */ /* if device disappeared nothing more to do here */
if (request->retries-- > 0) { if (!request->device->softc) {
if (!(request->flags & ATA_R_QUIET)) if (!(request->flags & ATA_R_QUIET))
ata_prtdev(request->device, ata_prtdev(request->device,
"TIMEOUT - %s retrying (%d retr%s left)\n", "FAILURE - %s device lockup/removed\n",
ata_cmd2str(request), request->retries, ata_cmd2str(request));
request->retries == 1 ? "y" : "ies"); return;
}
/* if retries still permit, reinject this request */
if (request->retries-- > 0) {
request->flags |= (ATA_R_AT_HEAD | ATA_R_REQUEUE); request->flags |= (ATA_R_AT_HEAD | ATA_R_REQUEUE);
request->flags &= ~ATA_R_SKIPSTART; request->flags &= ~ATA_R_SKIPSTART;
ata_queue_request(request); ata_queue_request(request);
} }
/* otherwise just schedule finish with error */ /* otherwise just schedule finish with error */
else { else {
if (!(request->flags & ATA_R_QUIET))
ata_prtdev(request->device,
"FAILURE - %s timed out\n",
ata_cmd2str(request));
request->status = ATA_S_ERROR; request->status = ATA_S_ERROR;
TASK_INIT(&request->task, 0, ata_completed, request); TASK_INIT(&request->task, 0, ata_completed, request);
taskqueue_enqueue(taskqueue_swi, &request->task); taskqueue_enqueue(taskqueue_swi, &request->task);