diff options
author | sos <sos@FreeBSD.org> | 2004-03-15 12:03:48 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2004-03-15 12:03:48 +0000 |
commit | dc99d6d221faeb25117b57ba2bcdb8aca0e539a0 (patch) | |
tree | 31a9d6667678aa55b9fa75ad9df738b13820030f /sys/dev/ata/ata-queue.c | |
parent | a745e2bbf146ec1885fcb077a44b9983794dac64 (diff) | |
download | FreeBSD-src-dc99d6d221faeb25117b57ba2bcdb8aca0e539a0.zip FreeBSD-src-dc99d6d221faeb25117b57ba2bcdb8aca0e539a0.tar.gz |
Add support for detaching PCI controllers.
This adds support for cardbus ATA/SATA controllers. I get roughly the
same transfer speeds as on true PCI controllers. Nice to be able to add
a couble of "real" disks to a laptop :)
Diffstat (limited to 'sys/dev/ata/ata-queue.c')
-rw-r--r-- | sys/dev/ata/ata-queue.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/dev/ata/ata-queue.c b/sys/dev/ata/ata-queue.c index 667bd99..ef6d20f 100644 --- a/sys/dev/ata/ata-queue.c +++ b/sys/dev/ata/ata-queue.c @@ -459,6 +459,39 @@ ata_timeout(struct ata_request *request) return; } +void +ata_fail_requests(struct ata_channel *ch, struct ata_device *device) +{ + struct ata_request *request; + + /* fail all requests queued on this channel */ + mtx_lock(&ch->queue_mtx); + while ((request = TAILQ_FIRST(&ch->ata_queue))) { + if (!device || request->device == device) { + TAILQ_REMOVE(&ch->ata_queue, request, chain); + request->result = ENXIO; + if (request->callback) + (request->callback)(request); + else + sema_post(&request->done); + } + } + mtx_unlock(&ch->queue_mtx); + + /* if we have a request "in flight" fail it as well */ + if ((!device || request->device == device) && (request = ch->running)) { + untimeout((timeout_t *)ata_timeout, request, request->timeout_handle); + ATA_UNLOCK_CH(request->device->channel); + request->device->channel->locking(request->device->channel, + ATA_LF_UNLOCK); + request->result = ENXIO; + if (request->callback) + (request->callback)(request); + else + sema_post(&request->done); + } +} + char * ata_cmd2str(struct ata_request *request) { |