Fix for infinite XHCI reset loops when the set address USB request fails.

MFC after:	2 days
This commit is contained in:
Hans Petter Selasky 2014-04-09 06:27:04 +00:00
parent a173db2d8c
commit a955cde712
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=264294

View File

@ -1218,8 +1218,20 @@ xhci_do_command(struct xhci_softc *sc, struct xhci_trb *trb,
*/
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);