From 74674b8ed80cc707021fa63e36e7a54c59038e15 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 6 Oct 2003 10:39:13 +0000 Subject: [PATCH] Add disk_destroy() call to detach processing. Add short tempered TUR to cdsize() as a workaround. --- sys/cam/scsi/scsi_cd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index bd673e084c78..db382ed537dd 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -496,6 +496,7 @@ cdcleanup(struct cam_periph *periph) free(softc->changer, M_DEVBUF); num_changers--; } + disk_destroy(&softc->disk); free(softc, M_DEVBUF); splx(s); } @@ -2852,6 +2853,20 @@ cdsize(struct cam_periph *periph, u_int32_t *size) ccb = cdgetccb(periph, /* priority */ 1); + scsi_test_unit_ready(&ccb->csio, 0, cddone, + MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, 1000); + ccb->ccb_h.ccb_bp = NULL; + + error = cam_periph_runccb(ccb, NULL, + /*cam_flags*/0, + /*sense_flags*/SF_RETRY_UA, + softc->disk.d_devstat); + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + xpt_release_ccb(ccb); + return (ENXIO); + } + rcap_buf = malloc(sizeof(struct scsi_read_capacity_data), M_TEMP, M_WAITOK);