XHCI: Use a more approriate error code.

Stalls cause "HALTED" conditions on endpoints, so use B_DEV_STALLED.
Also clarify the comment referencing the specification, and add a
missing linebreak to the error message.
This commit is contained in:
Augustin Cavalier
2021-09-03 11:15:48 -04:00
parent 7b2bc8351a
commit 625b5fc8fa
+4 -6
View File
@@ -971,10 +971,9 @@ XHCI::CancelQueuedTransfers(Pipe *pipe, bool force)
// order to avoid a deadlock, we must unlock the endpoint. // order to avoid a deadlock, we must unlock the endpoint.
endpointLocker.Unlock(); endpointLocker.Unlock();
status_t status = StopEndpoint(false, endpoint); status_t status = StopEndpoint(false, endpoint);
if (status == B_NOT_ALLOWED) { if (status == B_DEV_STALLED) {
// XHCI 1.2, 4.8.3 Endpoint State Diagram // Only exit from a Halted state is a reset. (XHCI 1.2 § 4.8.3 p163.)
// Only exit from a HALTED state is a reset TRACE_ERROR("cancel queued transfers: halted endpoint, reset!\n");
TRACE_ERROR("cancel queued transfers: halted endpoint. reset!");
status = ResetEndpoint(false, endpoint); status = ResetEndpoint(false, endpoint);
} }
endpointLocker.Lock(); endpointLocker.Lock();
@@ -1679,7 +1678,6 @@ XHCI::_GetEndpointState(xhci_endpoint* endpoint)
struct xhci_device_ctx* device_ctx = endpoint->device->device_ctx; struct xhci_device_ctx* device_ctx = endpoint->device->device_ctx;
return ENDPOINT_0_STATE_GET( return ENDPOINT_0_STATE_GET(
_ReadContext(&device_ctx->endpoints[endpoint->id].dwendpoint0)); _ReadContext(&device_ctx->endpoints[endpoint->id].dwendpoint0));
} }
@@ -2737,7 +2735,7 @@ XHCI::StopEndpoint(bool suspend, xhci_endpoint* endpoint)
switch (_GetEndpointState(endpoint)) { switch (_GetEndpointState(endpoint)) {
case ENDPOINT_STATE_HALTED: case ENDPOINT_STATE_HALTED:
TRACE("Stop Endpoint: error, halted"); TRACE("Stop Endpoint: error, halted");
return B_NOT_ALLOWED; return B_DEV_STALLED;
case ENDPOINT_STATE_STOPPED: case ENDPOINT_STATE_STOPPED:
TRACE("Stop Endpoint: already stopped"); TRACE("Stop Endpoint: already stopped");
return B_OK; return B_OK;