Author: hselasky
Date: Wed Apr  9 06:27:04 2014
New Revision: 264294
URL: http://svnweb.freebsd.org/changeset/base/264294

Log:
  Fix for infinite XHCI reset loops when the set address USB request fails.
  
  MFC after:    2 days

Modified:
  head/sys/dev/usb/controller/xhci.c

Modified: head/sys/dev/usb/controller/xhci.c
==============================================================================
--- head/sys/dev/usb/controller/xhci.c  Wed Apr  9 05:15:40 2014        
(r264293)
+++ head/sys/dev/usb/controller/xhci.c  Wed Apr  9 06:27:04 2014        
(r264294)
@@ -1218,8 +1218,20 @@ retry:
                 */
                if (timeout == 0 &&
                    xhci_reset_command_queue_locked(sc) == 0) {
-                       timeout = 1;
-                       goto retry;
+                       temp = le32toh(trb->dwTrb3);
+
+                       /*
+                        * Avoid infinite XHCI reset loops if the set
+                        * address command fails to respond due to a
+                        * non-enumerating device:
+                        */
+                       if (XHCI_TRB_3_TYPE_GET(temp) == 
XHCI_TRB_TYPE_ADDRESS_DEVICE &&
+                           (temp & XHCI_TRB_3_BSR_BIT) == 0) {
+                               DPRINTF("Set address timeout\n");
+                       } else {
+                               timeout = 1;
+                               goto retry;
+                       }
                } else {
                        DPRINTF("Controller reset!\n");
                        usb_bus_reset_async_locked(&sc->sc_bus);
_______________________________________________
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