Date: Wed, 7 May 2025 21:37:04 GMT From: Warner Losh <imp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 668cef02ce8c - main - umass: Move illegal opcode return to a function Message-ID: <202505072137.547Lb41W091916@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=668cef02ce8c9a9bb9862e98c55a2fe15030e042 commit 668cef02ce8c9a9bb9862e98c55a2fe15030e042 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2025-05-07 16:06:59 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2025-05-07 21:36:54 +0000 umass: Move illegal opcode return to a function Move illegal opcode completion of ccb to its own function. da can cope with a number of different failures now (it didn't used to), so we should return the unnsupported commands as illegal rather than faking completion. This will allow da to, in the future, do more intelligent things in response to these quirks. Other SIMs will need to do this too. Differential Revision: https://reviews.freebsd.org/D49465 Sponsored by: Netflix --- sys/dev/usb/storage/umass.c | 39 +++++++++++++++++++++++++-------------- 1 file 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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505072137.547Lb41W091916>