aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ata/atapi-all.c
diff options
context:
space:
mode:
authorSøren Schmidt <sos@FreeBSD.org>2001-03-14 12:05:44 +0000
committerSøren Schmidt <sos@FreeBSD.org>2001-03-14 12:05:44 +0000
commit8ea3ce2aac9386a3130dce606f251d1f8efccbb6 (patch)
treede6db8fe78eb07c4f61eb41356b3fc89f04e3d12 /sys/dev/ata/atapi-all.c
parent5e30415625af35f7951dbf8d46352dc9f779bd19 (diff)
Notes
Diffstat (limited to 'sys/dev/ata/atapi-all.c')
-rw-r--r--sys/dev/ata/atapi-all.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sys/dev/ata/atapi-all.c b/sys/dev/ata/atapi-all.c
index 560756924f234..4eec739e275b7 100644
--- a/sys/dev/ata/atapi-all.c
+++ b/sys/dev/ata/atapi-all.c
@@ -35,6 +35,7 @@
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/malloc.h>
+#include <sys/bio.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <dev/ata/ata-all.h>
@@ -114,13 +115,18 @@ notfound:
free(atp, M_ATAPI);
atp = NULL;
}
- /* store our softc */
+
+ /* store our softc signalling we are ready to go */
scp->dev_softc[ATA_DEV(device)] = atp;
}
void
atapi_detach(struct atapi_softc *atp)
{
+ struct atapi_request *request;
+
+ atp->flags |= ATAPI_F_DETACHING;
+
switch (ATP_PARAM->device_type) {
#ifdef DEV_ATAPICD
case ATAPI_TYPE_CDROM:
@@ -140,6 +146,21 @@ atapi_detach(struct atapi_softc *atp)
default:
return;
}
+ TAILQ_FOREACH(request, &atp->controller->atapi_queue, chain) {
+ if (request->device != atp)
+ continue;
+ TAILQ_REMOVE(&atp->controller->atapi_queue, request, chain);
+ if (request->driver) {
+ struct bio *bp = (struct bio *) request->driver;
+ bp->bio_error = ENXIO;
+ bp->bio_flags |= BIO_ERROR;
+ biodone(bp);
+ }
+ if (request->dmatab)
+ free(request->dmatab, M_DEVBUF);
+ free(request, M_ATAPI);
+ }
+ atp->controller->dev_softc[ATA_DEV(atp->unit)] = NULL;
free(atp, M_ATAPI);
}