Date: Sat, 3 Nov 2012 14:42:33 -0700 From: Marcel Moolenaar <marcel@xcllnt.net> To: Hans Petter Selasky <hselasky@c2i.net> Cc: usb@freebsd.org Subject: RFC: new USB quirk Message-ID: <5D9BFA84-4B90-4769-BE02-F771C3AE5441@xcllnt.net>
next in thread | raw e-mail | index | archive | help
--Apple-Mail=_B5CB6594-D133-408F-BCB1-EEA46C992522 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Hans, Juniper has a few products that use STmicro USB-NAND controllers (the ST72682 in particular) and they really don't like the SCSI command for prevent/allow medium removal. The attached patch adds a quirk for this to avoid spamming the console with errors or warnings. Does it look good to you? Ok to commit? Thanks, -- Marcel Moolenaar marcel@xcllnt.net --Apple-Mail=_B5CB6594-D133-408F-BCB1-EEA46C992522 Content-Disposition: attachment; filename=usb.diff Content-Type: application/octet-stream; name="usb.diff" Content-Transfer-Encoding: 7bit Index: quirk/usb_quirk.c =================================================================== --- quirk/usb_quirk.c (revision 242525) +++ quirk/usb_quirk.c (working copy) @@ -390,6 +390,7 @@ UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), USB_QUIRK(SONY, PORTABLE_HDD_V2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), + USB_QUIRK(STMICRO, ST72682, 0x0000, 0xffff, UQ_MSC_NO_PREVENT_ALLOW), USB_QUIRK(SUPERTOP, IDE, 0x0000, 0xffff, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(SUPERTOP, FLASHDRIVE, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, Index: quirk/usb_quirk.h =================================================================== --- quirk/usb_quirk.h (revision 242525) +++ quirk/usb_quirk.h (working copy) @@ -75,6 +75,7 @@ UQ_MSC_NO_GETMAXLUN, /* does not support get max LUN */ UQ_MSC_NO_INQUIRY, /* fake generic inq response */ UQ_MSC_NO_INQUIRY_EVPD, /* does not support inq EVPD */ + UQ_MSC_NO_PREVENT_ALLOW, /* does not support medium removal */ UQ_MSC_NO_SYNC_CACHE, /* does not support sync cache */ UQ_MSC_SHUTTLE_INIT, /* requires Shuttle init sequence */ UQ_MSC_ALT_IFACE_1, /* switch to alternate interface 1 */ Index: storage/umass.c =================================================================== --- storage/umass.c (revision 242525) +++ storage/umass.c (working copy) @@ -361,6 +361,8 @@ * result. */ #define NO_SYNCHRONIZE_CACHE 0x4000 + /* Device does not support 'PREVENT/ALLOW MEDIUM REMOVAL'. */ +#define NO_PREVENT_ALLOW 0x8000 struct umass_softc { @@ -831,6 +833,8 @@ quirks |= NO_INQUIRY; if (usb_test_quirk(uaa, UQ_MSC_NO_INQUIRY_EVPD)) quirks |= NO_INQUIRY_EVPD; + if (usb_test_quirk(uaa, UQ_MSC_NO_PREVENT_ALLOW)) + quirks |= NO_PREVENT_ALLOW; if (usb_test_quirk(uaa, UQ_MSC_NO_SYNC_CACHE)) quirks |= NO_SYNCHRONIZE_CACHE; if (usb_test_quirk(uaa, UQ_MSC_SHUTTLE_INIT)) @@ -2245,6 +2249,13 @@ if (sc->sc_quirks & FORCE_SHORT_INQUIRY) { ccb->csio.dxfer_len = SHORT_INQUIRY_LENGTH; } + } else if (sc->sc_transfer.cmd_data[0] == PREVENT_ALLOW) { + if (sc->sc_quirks & NO_PREVENT_ALLOW) { + ccb->csio.scsi_status = SCSI_STATUS_OK; + ccb->ccb_h.status = CAM_REQ_CMP; + xpt_done(ccb); + goto done; + } } else if (sc->sc_transfer.cmd_data[0] == SYNCHRONIZE_CACHE) { if (sc->sc_quirks & NO_SYNCHRONIZE_CACHE) { ccb->csio.scsi_status = SCSI_STATUS_OK; Index: usbdevs =================================================================== --- usbdevs (revision 242525) +++ usbdevs (working copy) @@ -3949,6 +3949,7 @@ /* STMicroelectronics products */ product STMICRO BIOCPU 0x2016 Biometric Coprocessor product STMICRO COMMUNICATOR 0x7554 USB Communicator +product STMICRO ST72682 0xfada USB 2.0 Flash drive controller /* STSN products */ product STSN STSN0001 0x0001 Internet Access Device --Apple-Mail=_B5CB6594-D133-408F-BCB1-EEA46C992522--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5D9BFA84-4B90-4769-BE02-F771C3AE5441>