Author: hselasky
Date: Mon Jan 12 06:34:23 2015
New Revision: 277044
URL: https://svnweb.freebsd.org/changeset/base/277044

Log:
  Increase the maximum number of dynamic USB quirks. USB memory stick
  devices which don't support the synchronize cache SCSI command are
  likely to also not support the prevent-allow medium removal SCSI
  command.
  
  PR:           185747
  MFC after:    1 week

Modified:
  head/sys/dev/usb/usb_freebsd.h
  head/sys/dev/usb/usb_freebsd_loader.h
  head/sys/dev/usb/usb_msctest.c

Modified: head/sys/dev/usb/usb_freebsd.h
==============================================================================
--- head/sys/dev/usb/usb_freebsd.h      Mon Jan 12 03:39:56 2015        
(r277043)
+++ head/sys/dev/usb/usb_freebsd.h      Mon Jan 12 06:34:23 2015        
(r277044)
@@ -88,7 +88,7 @@
 #define        USB_EP0_BUFSIZE         1024    /* bytes */
 #define        USB_CS_RESET_LIMIT      20      /* failures = 20 * 50 ms = 1sec 
*/
 
-#define        USB_MAX_AUTO_QUIRK      4       /* maximum number of dynamic 
quirks */
+#define        USB_MAX_AUTO_QUIRK      8       /* maximum number of dynamic 
quirks */
 
 typedef uint32_t usb_timeout_t;                /* milliseconds */
 typedef uint32_t usb_frlength_t;       /* bytes */

Modified: head/sys/dev/usb/usb_freebsd_loader.h
==============================================================================
--- head/sys/dev/usb/usb_freebsd_loader.h       Mon Jan 12 03:39:56 2015        
(r277043)
+++ head/sys/dev/usb/usb_freebsd_loader.h       Mon Jan 12 06:34:23 2015        
(r277044)
@@ -83,7 +83,7 @@
 #define        USB_EP0_BUFSIZE         1024    /* bytes */
 #define        USB_CS_RESET_LIMIT      20      /* failures = 20 * 50 ms = 1sec 
*/
 
-#define        USB_MAX_AUTO_QUIRK      4       /* maximum number of dynamic 
quirks */
+#define        USB_MAX_AUTO_QUIRK      8       /* maximum number of dynamic 
quirks */
 
 typedef uint32_t usb_timeout_t;                /* milliseconds */
 typedef uint32_t usb_frlength_t;       /* bytes */

Modified: head/sys/dev/usb/usb_msctest.c
==============================================================================
--- head/sys/dev/usb/usb_msctest.c      Mon Jan 12 03:39:56 2015        
(r277043)
+++ head/sys/dev/usb/usb_msctest.c      Mon Jan 12 06:34:23 2015        
(r277044)
@@ -718,10 +718,11 @@ retry_sync_cache:
                if (err != ERR_CSW_FAILED)
                        goto error;
 
-               DPRINTF("Device doesn't handle synchronize cache\n");
+               DPRINTF("Device doesn't handle synchronize cache "
+                   "and prevent allow medium removal\n");
 
                usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE);
-
+               usbd_add_dynamic_quirk(udev, UQ_MSC_NO_PREVENT_ALLOW);
        } else {
 
                /*
@@ -748,10 +749,13 @@ retry_sync_cache:
                                        goto retry_sync_cache;
 
                                DPRINTF("Device most likely doesn't "
-                                   "handle synchronize cache\n");
+                                   "handle synchronize cache nor"
+                                   "prevent allow medium removal\n");
 
                                usbd_add_dynamic_quirk(udev,
                                    UQ_MSC_NO_SYNC_CACHE);
+                               usbd_add_dynamic_quirk(udev,
+                                   UQ_MSC_NO_PREVENT_ALLOW);
                        } else {
                                if (err != ERR_CSW_FAILED)
                                        goto error;
@@ -795,6 +799,7 @@ error:
        DPRINTF("Device did not respond, enabling all quirks\n");
 
        usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE);
+       usbd_add_dynamic_quirk(udev, UQ_MSC_NO_PREVENT_ALLOW);
        usbd_add_dynamic_quirk(udev, UQ_MSC_NO_TEST_UNIT_READY);
 
        /* Need to re-enumerate the device */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to