summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/atapi-cd.c
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2000-02-21 18:41:05 +0000
committersos <sos@FreeBSD.org>2000-02-21 18:41:05 +0000
commit4b02675abede8359d7c5f4c9b738ced02a7e7492 (patch)
treeb9a08fa48ad12966cf57a87cf9608d50b75b85c5 /sys/dev/ata/atapi-cd.c
parent92446000b5bac2ba7980291070f3cc67ce6c1299 (diff)
downloadFreeBSD-src-4b02675abede8359d7c5f4c9b738ced02a7e7492.zip
FreeBSD-src-4b02675abede8359d7c5f4c9b738ced02a7e7492.tar.gz
Fix the changer code, dont wait for device ready on unload, it
wont become ready as there is no media - doh. Update the command name reporting.
Diffstat (limited to 'sys/dev/ata/atapi-cd.c')
-rw-r--r--sys/dev/ata/atapi-cd.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c
index f35f964..f67af2f 100644
--- a/sys/dev/ata/atapi-cd.c
+++ b/sys/dev/ata/atapi-cd.c
@@ -422,17 +422,23 @@ acd_describe(struct acd_softc *cdp)
}
else {
char changer[32];
+ char devnum[8];
bzero(changer, sizeof(changer));
- if (cdp->changer_info)
+ if (cdp->changer_info) {
+ sprintf(devnum, "%d-%d",
+ cdp->lun, cdp->lun + cdp->changer_info->slots - 1);
sprintf(changer, " with %d CD changer", cdp->changer_info->slots);
-
- printf("acd%d: %s%s <%.40s> at ata%d-%s using %s\n",
- cdp->lun, (cdp->cap.write_dvdr) ? "DVD-R" :
- (cdp->cap.write_dvdram) ? "DVD-RAM" :
- (cdp->cap.write_cdrw) ? "CD-RW" :
- (cdp->cap.write_cdr) ? "CD-R" :
- (cdp->cap.read_dvdrom) ? "DVD-ROM" : "CDROM",
+ }
+ else
+ sprintf(devnum, "%d", cdp->lun);
+
+ printf("acd%s: %s%s <%.40s> at ata%d-%s using %s\n",
+ devnum, (cdp->cap.write_dvdr) ? "DVD-R" :
+ (cdp->cap.write_dvdram) ? "DVD-RAM" :
+ (cdp->cap.write_cdrw) ? "CD-RW" :
+ (cdp->cap.write_cdr) ? "CD-R" :
+ (cdp->cap.read_dvdrom) ? "DVD-ROM" : "CDROM",
changer, ATA_PARAM(cdp->atp->controller, cdp->atp->unit)->model,
device_get_unit(cdp->atp->controller->dev),
(cdp->atp->unit == ATA_MASTER) ? "master" : "slave",
@@ -1134,7 +1140,7 @@ acd_done(struct atapi_request *request)
}
else {
bp->b_resid = request->bytecount;
- if ((bp->b_flags & B_READ) == B_WRITE)
+ if (!(bp->b_flags & B_READ))
cdp->flags |= F_WRITTEN;
}
devstat_end_transaction_buf(cdp->stats, bp);
@@ -1244,16 +1250,16 @@ acd_select_slot(struct acd_softc *cdp)
/* unlock (might not be needed but its cheaper than asking) */
acd_prevent_allow(cdp, 0);
- bzero(ccb, sizeof(ccb));
+
/* unload the current media from player */
+ bzero(ccb, sizeof(ccb));
ccb[0] = ATAPI_LOAD_UNLOAD;
- ccb[1] = 0x01;
ccb[4] = 2;
ccb[8] = cdp->changer_info->current_slot;
- atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 10, NULL, NULL, NULL);
- atapi_wait_ready(cdp->atp, 30);
+ atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 30, NULL, NULL, NULL);
/* load the wanted slot */
+ bzero(ccb, sizeof(ccb));
ccb[0] = ATAPI_LOAD_UNLOAD;
ccb[1] = 0x01;
ccb[4] = 3;
OpenPOWER on IntegriCloud