From 9cd2907d6802007f24b051960d2b5257ec30e9e8 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sun, 14 Jul 2019 14:31:07 -0400 Subject: [PATCH] XHCI: Trace an error when we receive command events for unknown commands. This revealed that StopEndpoint commands on QEMU were returning ... after the semaphore timeout was already hit. Now to figure out why that is the case... --- src/add-ons/kernel/busses/usb/xhci.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/busses/usb/xhci.cpp b/src/add-ons/kernel/busses/usb/xhci.cpp index 834c9b5a7f..a14899a9e8 100644 --- a/src/add-ons/kernel/busses/usb/xhci.cpp +++ b/src/add-ons/kernel/busses/usb/xhci.cpp @@ -2332,7 +2332,8 @@ XHCI::HandleCmdComplete(xhci_trb* trb) fCmdResult[0] = trb->status; fCmdResult[1] = B_LENDIAN_TO_HOST_INT32(trb->flags); release_sem_etc(fCmdCompSem, 1, B_DO_NOT_RESCHEDULE); - } + } else + TRACE_ERROR("received command event for unknown command!\n") } @@ -2459,6 +2460,7 @@ XHCI::DoCommand(xhci_trb* trb) if (acquire_sem_etc(fCmdCompSem, 1, B_RELATIVE_TIMEOUT, 1 * 1000 * 1000) < B_OK) { TRACE("Unable to obtain fCmdCompSem!\n"); + fCmdAddr = 0; Unlock(); return B_TIMED_OUT; } @@ -2483,6 +2485,7 @@ XHCI::DoCommand(xhci_trb* trb) TRACE("Storing trb 0x%08" B_PRIx32 " 0x%08" B_PRIx32 "\n", trb->status, trb->flags); + fCmdAddr = 0; Unlock(); return status; }