From a21f7b525b2c030a07592354bc51eb186206392b Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 19 Feb 2019 21:33:54 -0500 Subject: [PATCH] XHCI: Move and reorder Stop/SetTRD/Reset during endpoint creation. Fixes a lot of "command failed: invalid context" errors on a variety of devices following previous commits. Does not seem to affect much, though. --- src/add-ons/kernel/busses/usb/xhci.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/add-ons/kernel/busses/usb/xhci.cpp b/src/add-ons/kernel/busses/usb/xhci.cpp index 07382ccc5f..6ed2727799 100644 --- a/src/add-ons/kernel/busses/usb/xhci.cpp +++ b/src/add-ons/kernel/busses/usb/xhci.cpp @@ -1496,11 +1496,6 @@ XHCI::_InsertEndpointForPipe(Pipe *pipe) return status; } - StopEndpoint(false, endpoint, device->slot); - ResetEndpoint(false, endpoint, device->slot); - SetTRDequeue(device->endpoints[id].trb_addr, 0, endpoint, - device->slot); - _WriteContext(&device->input_ctx->input.dropFlags, 0); _WriteContext(&device->input_ctx->input.addFlags, (1 << endpoint) | (1 << 0)); @@ -1510,6 +1505,11 @@ XHCI::_InsertEndpointForPipe(Pipe *pipe) else EvaluateContext(device->input_ctx_addr, device->slot); + StopEndpoint(false, endpoint, device->slot); + SetTRDequeue(device->endpoints[id].trb_addr, 0, endpoint, + device->slot); + ResetEndpoint(false, endpoint, device->slot); + TRACE("device: address 0x%x state 0x%08" B_PRIx32 "\n", device->address, SLOT_3_SLOT_STATE_GET(_ReadContext( &device->device_ctx->slot.dwslot3)));