diff options
| author | Warner Losh <imp@FreeBSD.org> | 2025-05-07 16:06:59 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2025-05-07 21:36:54 +0000 |
| commit | 668cef02ce8c9a9bb9862e98c55a2fe15030e042 (patch) | |
| tree | 98d8567bde3501f6126fb14ea83cb40f2fabb468 /sys/dev | |
| parent | 231d36dccb820aa874800bdcd7e3e250bbd6df79 (diff) | |
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/storage/umass.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c index 3e5cc9a7e084..145c2ba81b3c 100644 --- a/sys/dev/usb/storage/umass.c +++ b/sys/dev/usb/storage/umass.c @@ -489,6 +489,7 @@ static void umass_cam_sense_cb(struct umass_softc *, union ccb *, uint32_t, uint8_t); static void umass_cam_quirk_cb(struct umass_softc *, union ccb *, uint32_t, uint8_t); +static void umass_cam_illegal_request(union ccb *ccb); static uint8_t umass_scsi_transform(struct umass_softc *, uint8_t *, uint8_t); static uint8_t umass_rbc_transform(struct umass_softc *, uint8_t *, uint8_t); static uint8_t umass_ufi_transform(struct umass_softc *, uint8_t *, uint8_t); @@ -2262,20 +2263,7 @@ umass_cam_action(struct cam_sim *sim, union ccb *ccb) */ if ((sc->sc_quirks & (NO_INQUIRY_EVPD | NO_INQUIRY)) && (sc->sc_transfer.cmd_data[1] & SI_EVPD)) { - scsi_set_sense_data(&ccb->csio.sense_data, - /*sense_format*/ SSD_TYPE_NONE, - /*current_error*/ 1, - /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, - /*asc*/ 0x24, /* 24h/00h INVALID FIELD IN CDB */ - /*ascq*/ 0x00, - /*extra args*/ SSD_ELEM_NONE); - ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; - ccb->ccb_h.status = - CAM_SCSI_STATUS_ERROR | - CAM_AUTOSNS_VALID | - CAM_DEV_QFRZN; - xpt_freeze_devq(ccb->ccb_h.path, 1); - xpt_done(ccb); + umass_cam_illegal_request(ccb); goto done; } /* @@ -2463,6 +2451,29 @@ umass_cam_poll(struct cam_sim *sim) usbd_transfer_poll(sc->sc_xfer, UMASS_T_MAX); } +/* umass_cam_illegal_request + * Complete the command as an illegal command with invalid field + */ + +static void +umass_cam_illegal_request(union ccb *ccb) +{ + scsi_set_sense_data(&ccb->csio.sense_data, + /*sense_format*/ SSD_TYPE_NONE, + /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x24, /* 24h/00h INVALID FIELD IN CDB */ + /*ascq*/ 0x00, + /*extra args*/ SSD_ELEM_NONE); + ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; + ccb->ccb_h.status = + CAM_SCSI_STATUS_ERROR | + CAM_AUTOSNS_VALID | + CAM_DEV_QFRZN; + xpt_freeze_devq(ccb->ccb_h.path, 1); + xpt_done(ccb); +} + /* umass_cam_cb * finalise a completed CAM command */ |
