diff options
author | mav <mav@FreeBSD.org> | 2009-11-08 14:33:19 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2009-11-08 14:33:19 +0000 |
commit | f4274f9678e4ce496e30c73d5889107ff757b668 (patch) | |
tree | bf0681a1405da1f51d118ec021474ba048a45f56 /sys/dev/ata | |
parent | 7280a5804337eb23b6b23e35071316756d35365d (diff) | |
download | FreeBSD-src-f4274f9678e4ce496e30c73d5889107ff757b668.zip FreeBSD-src-f4274f9678e4ce496e30c73d5889107ff757b668.tar.gz |
Introduce define and kernel option ATA_REQUEST_TIMEOUT to control ATA(4)
command timeout.
Submitted by: keramida
Diffstat (limited to 'sys/dev/ata')
-rw-r--r-- | sys/dev/ata/ata-all.h | 4 | ||||
-rw-r--r-- | sys/dev/ata/ata-disk.c | 10 | ||||
-rw-r--r-- | sys/dev/ata/ata-queue.c | 6 | ||||
-rw-r--r-- | sys/dev/ata/ata-raid.c | 6 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 2 |
5 files changed, 16 insertions, 12 deletions
diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h index 2bc8936..f832505 100644 --- a/sys/dev/ata/ata-all.h +++ b/sys/dev/ata/ata-all.h @@ -345,6 +345,10 @@ struct ata_ahci_cmd_list { #define ATA_OP_FINISHED 1 #define ATA_MAX_28BIT_LBA 268435455UL +#ifndef ATA_REQUEST_TIMEOUT +#define ATA_REQUEST_TIMEOUT 10 +#endif + /* structure used for composite atomic operations */ #define MAX_COMPOSITES 32 /* u_int32_t bits */ struct ata_composite { diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 58f2245..22be354 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -230,7 +230,7 @@ ad_spindown(void *priv) } request->dev = dev; request->flags = ATA_R_CONTROL; - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; request->retries = 1; request->callback = ad_power_callback; request->u.ata.command = ATA_STANDBY_IMMEDIATE; @@ -262,10 +262,10 @@ ad_strategy(struct bio *bp) if (atadev->spindown_state) { device_printf(dev, "request while spun down, starting.\n"); atadev->spindown_state = 0; - request->timeout = 31; + request->timeout = MAX(ATA_REQUEST_TIMEOUT, 31); } else { - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; } request->retries = 2; request->data = bp->bio_data; @@ -468,7 +468,7 @@ ad_set_geometry(device_t dev) request->u.ata.count = 0; request->u.ata.feature = 0; request->flags = ATA_R_CONTROL | ATA_R_QUIET; - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; request->retries = 0; ata_queue_request(request); if (request->status & ATA_S_ERROR) @@ -487,7 +487,7 @@ ad_set_geometry(device_t dev) request->u.ata.count = 1; request->u.ata.feature = 0; request->flags = ATA_R_CONTROL; - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; request->retries = 0; ata_queue_request(request); if (request->status & ATA_S_ERROR) diff --git a/sys/dev/ata/ata-queue.c b/sys/dev/ata/ata-queue.c index eeb7a1a..c048778 100644 --- a/sys/dev/ata/ata-queue.c +++ b/sys/dev/ata/ata-queue.c @@ -141,9 +141,9 @@ ata_controlcmd(device_t dev, u_int8_t command, u_int16_t feature, if (atadev->spindown_state) { device_printf(dev, "request while spun down, starting.\n"); atadev->spindown_state = 0; - request->timeout = 31; + request->timeout = MAX(ATA_REQUEST_TIMEOUT, 31); } else { - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; } request->retries = 0; ata_queue_request(request); @@ -397,7 +397,7 @@ ata_completed(void *context, int dummy) request->bytecount = sizeof(struct atapi_sense); request->donecount = 0; request->transfersize = sizeof(struct atapi_sense); - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; request->flags &= (ATA_R_ATAPI | ATA_R_QUIET | ATA_R_DEBUG); request->flags |= (ATA_R_READ | ATA_R_AT_HEAD | ATA_R_REQUEUE); ATA_DEBUG_RQ(request, "autoissue request sense"); diff --git a/sys/dev/ata/ata-raid.c b/sys/dev/ata/ata-raid.c index a88284b..7bc88b5 100644 --- a/sys/dev/ata/ata-raid.c +++ b/sys/dev/ata/ata-raid.c @@ -273,7 +273,7 @@ ata_raid_flush(struct bio *bp) request->u.ata.lba = 0; request->u.ata.count = 0; request->u.ata.feature = 0; - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; request->retries = 0; request->flags |= ATA_R_ORDERED | ATA_R_DIRECT; ata_queue_request(request); @@ -4371,7 +4371,7 @@ ata_raid_init_request(device_t dev, struct ar_softc *rdp, struct bio *bio) return NULL; } request->dev = dev; - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; request->retries = 2; request->callback = ata_raid_done; request->driver = rdp; @@ -4445,7 +4445,7 @@ ata_raid_rw(device_t dev, u_int64_t lba, void *data, u_int bcount, int flags) /* setup request */ request->dev = dev; - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; request->retries = 0; request->data = data; request->bytecount = bcount; diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 7e23db6..a021e00 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -700,7 +700,7 @@ acd_geom_access(struct g_provider *pp, int dr, int dw, int de) request->dev = dev; bcopy(ccb, request->u.atapi.ccb, 16); request->flags = ATA_R_ATAPI; - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; ata_queue_request(request); if (!request->error && (request->u.atapi.sense.key == 2 || |