Author: bz
Date: Tue Dec  1 18:24:06 2020
New Revision: 368246
URL: https://svnweb.freebsd.org/changeset/base/368246

Log:
  USB umass: add quirk to not probe
  
  Some USB WLAN devices have "on-board" storage showing up as umass
  and making the root mount wait for a very long time.
  The WLAN drivers know how to deal with that an issue an eject
  command later when attaching themselves.
  Introduce a quirk to not probe these devices as umass and avoid
  hangs and confusion altogether.
  
  Reviewed by:  hselasky, imp
  MFC after:    1 week
  Differential Revision:        https://reviews.freebsd.org/D27434

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/quirk/usb_quirk.h
  head/sys/dev/usb/storage/umass.c

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==============================================================================
--- head/sys/dev/usb/quirk/usb_quirk.c  Tue Dec  1 18:22:34 2020        
(r368245)
+++ head/sys/dev/usb/quirk/usb_quirk.c  Tue Dec  1 18:24:06 2020        
(r368246)
@@ -539,6 +539,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
        USB_QUIRK(QUALCOMMINC, ZTE_MF730M, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN,
            UQ_MSC_NO_INQUIRY, UQ_CFG_INDEX_0),
        USB_QUIRK(SMART2, G2MEMKEY, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY),
+       USB_QUIRK(RALINK, RT_STOR, 0x0001, 0x0001, UQ_MSC_IGNORE),
        /* Non-standard USB MIDI devices */
        USB_QUIRK(ROLAND, UM1, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
        USB_QUIRK(ROLAND, SC8850, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
@@ -642,6 +643,7 @@ static const char *usb_quirk_str[USB_QUIRK_MAX] = {
        [UQ_MSC_FORCE_PROTO_ATAPI]      = "UQ_MSC_FORCE_PROTO_ATAPI",
        [UQ_MSC_FORCE_PROTO_UFI]        = "UQ_MSC_FORCE_PROTO_UFI",
        [UQ_MSC_FORCE_PROTO_RBC]        = "UQ_MSC_FORCE_PROTO_RBC",
+       [UQ_MSC_IGNORE]                 = "UQ_MSC_IGNORE",
        [UQ_MSC_EJECT_HUAWEI]           = "UQ_MSC_EJECT_HUAWEI",
        [UQ_MSC_EJECT_SIERRA]           = "UQ_MSC_EJECT_SIERRA",
        [UQ_MSC_EJECT_SCSIEJECT]        = "UQ_MSC_EJECT_SCSIEJECT",

Modified: head/sys/dev/usb/quirk/usb_quirk.h
==============================================================================
--- head/sys/dev/usb/quirk/usb_quirk.h  Tue Dec  1 18:22:34 2020        
(r368245)
+++ head/sys/dev/usb/quirk/usb_quirk.h  Tue Dec  1 18:24:06 2020        
(r368246)
@@ -93,6 +93,7 @@ enum {
        UQ_MSC_FORCE_PROTO_ATAPI,       /* force ATAPI command protocol */
        UQ_MSC_FORCE_PROTO_UFI,         /* force UFI command protocol */
        UQ_MSC_FORCE_PROTO_RBC,         /* force RBC command protocol */
+       UQ_MSC_IGNORE,                  /* device should be ignored by umass */
 
        /* Ejection of mass storage (driver disk) */
        UQ_MSC_EJECT_HUAWEI,            /* ejects after Huawei USB command */

Modified: head/sys/dev/usb/storage/umass.c
==============================================================================
--- head/sys/dev/usb/storage/umass.c    Tue Dec  1 18:22:34 2020        
(r368245)
+++ head/sys/dev/usb/storage/umass.c    Tue Dec  1 18:24:06 2020        
(r368246)
@@ -784,6 +784,12 @@ umass_probe_proto(device_t dev, struct usb_attach_arg 
        memset(&ret, 0, sizeof(ret));
        ret.error = BUS_PROBE_GENERIC;
 
+       /* Check if we should deny probing. */
+       if (usb_test_quirk(uaa, UQ_MSC_IGNORE)) {
+               ret.error = ENXIO;
+               goto done;
+       }
+
        /* Search for protocol enforcement */
 
        if (usb_test_quirk(uaa, UQ_MSC_FORCE_WIRE_BBB)) {
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to