summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2014-04-11 06:13:56 +0000
committerhselasky <hselasky@FreeBSD.org>2014-04-11 06:13:56 +0000
commitfde2f5ed5896ea2a315b7483f0f7183e52cccfe8 (patch)
treebd16a55770419690b56a3aeed09e9846b9db169f
parentd336d68dfbd1946afa69b9fde4d41552a2c8e714 (diff)
downloadFreeBSD-src-fde2f5ed5896ea2a315b7483f0f7183e52cccfe8.zip
FreeBSD-src-fde2f5ed5896ea2a315b7483f0f7183e52cccfe8.tar.gz
MFC r264294:
Fix for infinite XHCI reset loops when the set address USB request fails.
-rw-r--r--sys/dev/usb/controller/xhci.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c
index f8eb6cf..86f4f9b 100644
--- a/sys/dev/usb/controller/xhci.c
+++ b/sys/dev/usb/controller/xhci.c
@@ -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);
OpenPOWER on IntegriCloud