summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2003-10-07 13:44:15 +0000
committersos <sos@FreeBSD.org>2003-10-07 13:44:15 +0000
commitb36254292b289f28aadf3fe555628f2ed3e55bf6 (patch)
tree9846d1926e3eb93de3913b7c4785304f567a6c75 /sys
parent09b4b7750404323b13113b857f0f51c176163759 (diff)
downloadFreeBSD-src-b36254292b289f28aadf3fe555628f2ed3e55bf6.zip
FreeBSD-src-b36254292b289f28aadf3fe555628f2ed3e55bf6.tar.gz
In case we loose a device during reset in reinit() finish off
the request with error instead of loosing it.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ata/ata-all.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 580f1ea..825027e 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -221,8 +221,9 @@ ata_detach(device_t dev)
int
ata_reinit(struct ata_channel *ch)
{
+ struct ata_request *request = ch->running;
int devices, misdev, newdev;
-
+
if (!ch->r_irq)
return ENXIO;
@@ -237,11 +238,29 @@ ata_reinit(struct ata_channel *ch)
/* detach what left the channel during reset */
if ((misdev = devices & ~ch->devices)) {
if ((misdev & (ATA_ATA_MASTER | ATA_ATAPI_MASTER)) &&
- ch->device[MASTER].detach)
+ ch->device[MASTER].detach) {
+ if (request && (request->device == &ch->device[MASTER])) {
+ request->result = ENXIO;
+ request->flags |= ATA_R_DONE;
+ if (request->callback)
+ (request->callback)(request);
+ else
+ wakeup(request);
+ }
ch->device[MASTER].detach(&ch->device[MASTER]);
+ }
if ((misdev & (ATA_ATA_SLAVE | ATA_ATAPI_SLAVE)) &&
- ch->device[SLAVE].detach)
+ ch->device[SLAVE].detach) {
+ if (request && (request->device == &ch->device[SLAVE])) {
+ request->result = ENXIO;
+ request->flags |= ATA_R_DONE;
+ if (request->callback)
+ (request->callback)(request);
+ else
+ wakeup(request);
+ }
ch->device[SLAVE].detach(&ch->device[SLAVE]);
+ }
}
/* identify whats present on this channel now */
OpenPOWER on IntegriCloud