From b0f747d57ebede89d0e29c21a920e8b6eed0d7f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Tue, 7 Oct 2003 13:47:40 +0000 Subject: [PATCH] Improve timeout handling and reporting. --- sys/dev/ata/ata-queue.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/sys/dev/ata/ata-queue.c b/sys/dev/ata/ata-queue.c index dac66cb8733e..734fae962f68 100644 --- a/sys/dev/ata/ata-queue.c +++ b/sys/dev/ata/ata-queue.c @@ -316,7 +316,7 @@ ata_timeout(struct ata_request *request) { /* clear timeout etc */ request->timeout_handle.callout = NULL; - +#if 0 /* call interrupt to try finish up the command */ request->device->channel->hw.interrupt(request->device->channel); @@ -327,6 +327,7 @@ ata_timeout(struct ata_request *request) ata_cmd2str(request)); return; } +#endif /* if this was a DMA request stop the engine to be on the safe side */ if (request->flags & ATA_R_DMA) { @@ -334,22 +335,37 @@ ata_timeout(struct ata_request *request) 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 */ ata_reinit(request->device->channel); - /* if retries still permit, reinject this request */ - if (request->retries-- > 0) { + /* if device disappeared nothing more to do here */ + if (!request->device->softc) { if (!(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"); + "FAILURE - %s device lockup/removed\n", + ata_cmd2str(request)); + 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_SKIPSTART; ata_queue_request(request); } /* otherwise just schedule finish with error */ else { + if (!(request->flags & ATA_R_QUIET)) + ata_prtdev(request->device, + "FAILURE - %s timed out\n", + ata_cmd2str(request)); request->status = ATA_S_ERROR; TASK_INIT(&request->task, 0, ata_completed, request); taskqueue_enqueue(taskqueue_swi, &request->task);