diff options
author | njl <njl@FreeBSD.org> | 2003-07-28 06:15:59 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2003-07-28 06:15:59 +0000 |
commit | 1cd634adc1d1ccd8b2986519f72fcbe975a07416 (patch) | |
tree | aef0e23332a02e65463a1a419cc6fd6e2df931de | |
parent | 79bbf9b70237e33220855aa14dc66e06eb75ee37 (diff) | |
download | FreeBSD-src-1cd634adc1d1ccd8b2986519f72fcbe975a07416.zip FreeBSD-src-1cd634adc1d1ccd8b2986519f72fcbe975a07416.tar.gz |
Add a PATH_INQ flag, PIM_NO_6_BYTE, which indicates the SIM never wishes to
receive 6 byte commands. Add a check for this flag to da(4) and cd(4) so
that they honor it. This is a quick workaround for many devices (especially
USB) that require da(4) quirks to operate. The more complete approach is
to finish the new transport code which will be aware of the SCSI version a
transport implements.
MFC after: 1 day
-rw-r--r-- | sys/cam/cam_ccb.h | 3 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_cd.c | 8 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_da.c | 8 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cam.c | 2 | ||||
-rw-r--r-- | sys/dev/firewire/sbp.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/umass.c | 2 |
6 files changed, 21 insertions, 4 deletions
diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h index 62adfe6..025493f 100644 --- a/sys/cam/cam_ccb.h +++ b/sys/cam/cam_ccb.h @@ -513,7 +513,8 @@ typedef enum { PIM_SCANHILO = 0x80, /* Bus scans from high ID to low ID */ PIM_NOREMOVE = 0x40, /* Removeable devices not included in scan */ PIM_NOINITIATOR = 0x20, /* Initiator role not supported. */ - PIM_NOBUSRESET = 0x10 /* User has disabled initial BUS RESET */ + PIM_NOBUSRESET = 0x10, /* User has disabled initial BUS RESET */ + PIM_NO_6_BYTE = 0x08 /* Do not send 6-byte commands */ } pi_miscflag; #ifdef CAM_NEW_TRAN_CODE diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index a5dad98..a887243 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -640,6 +640,7 @@ cdregister(struct cam_periph *periph, void *arg) { struct cd_softc *softc; struct ccb_setasync csa; + struct ccb_pathinq cpi; struct ccb_getdev *cgd; char tmpstr[80], tmpstr2[80]; caddr_t match; @@ -688,6 +689,13 @@ cdregister(struct cam_periph *periph, void *arg) else softc->quirks = CD_Q_NONE; + /* Check if the SIM does not want 6 byte commands */ + xpt_setup_ccb(&cpi.ccb_h, periph->path, /*priority*/1); + cpi.ccb_h.func_code = XPT_PATH_INQ; + xpt_action((union ccb *)&cpi); + if (cpi.ccb_h.status == CAM_REQ_CMP && (cpi.hba_misc & PIM_NO_6_BYTE)) + softc->quirks |= CD_Q_10_BYTE_ONLY; + snprintf(tmpstr, sizeof(tmpstr), "CAM CD unit %d", periph->unit_number); snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number); sysctl_ctx_init(&softc->sysctl_ctx); diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 2d7fb83..07651ea 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -1087,6 +1087,7 @@ daregister(struct cam_periph *periph, void *arg) int s; struct da_softc *softc; struct ccb_setasync csa; + struct ccb_pathinq cpi; struct ccb_getdev *cgd; char tmpstr[80], tmpstr2[80]; caddr_t match; @@ -1134,6 +1135,13 @@ daregister(struct cam_periph *periph, void *arg) else softc->quirks = DA_Q_NONE; + /* Check if the SIM does not want 6 byte commands */ + xpt_setup_ccb(&cpi.ccb_h, periph->path, /*priority*/1); + cpi.ccb_h.func_code = XPT_PATH_INQ; + xpt_action((union ccb *)&cpi); + if (cpi.ccb_h.status == CAM_REQ_CMP && (cpi.hba_misc & PIM_NO_6_BYTE)) + softc->quirks |= DA_Q_NO_6_BYTE; + snprintf(tmpstr, sizeof(tmpstr), "CAM DA unit %d", periph->unit_number); snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number); sysctl_ctx_init(&softc->sysctl_ctx); diff --git a/sys/dev/ata/atapi-cam.c b/sys/dev/ata/atapi-cam.c index cbac5ee..b694ac6 100644 --- a/sys/dev/ata/atapi-cam.c +++ b/sys/dev/ata/atapi-cam.c @@ -238,7 +238,7 @@ atapi_action(struct cam_sim *sim, union ccb *ccb) cpi->version_num = 1; cpi->hba_inquiry = 0; cpi->target_sprt = 0; - cpi->hba_misc = 0; + cpi->hba_misc = PIM_NO_6_BYTE; cpi->hba_eng_cnt = 0; bzero(cpi->vuhba_flags, sizeof(cpi->vuhba_flags)); cpi->max_target = 1; diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 6cf09cb..15121aa 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -2369,7 +2369,7 @@ END_DEBUG cpi->version_num = 1; /* XXX??? */ cpi->hba_inquiry = PI_TAG_ABLE; cpi->target_sprt = 0; - cpi->hba_misc = PIM_NOBUSRESET; + cpi->hba_misc = PIM_NOBUSRESET | PIM_NO_6_BYTE; cpi->hba_eng_cnt = 0; cpi->max_target = SBP_NUM_TARGETS - 1; cpi->max_lun = SBP_NUM_LUNS - 1; diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index 2948734..bc4de77 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -2393,7 +2393,7 @@ umass_cam_action(struct cam_sim *sim, union ccb *ccb) cpi->version_num = 1; cpi->hba_inquiry = 0; cpi->target_sprt = 0; - cpi->hba_misc = 0; + cpi->hba_misc = PIM_NO_6_BYTE; cpi->hba_eng_cnt = 0; cpi->max_target = UMASS_SCSIID_MAX; /* one target */ cpi->initiator_id = UMASS_SCSIID_HOST; |