XHCI: Set the DIR_IN bit on Status Stages even if there is no data.

The referenced section of the specification gives no indication that
the bit should not be set if there was no data; indeed it indicates
it should always be set.

This brings our behavior here in line with other OSes seem to do.

Change-Id: I86b2eb2a6a5fa3af84fd0941e0a3ec601c7037bf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5421
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2022-07-04 17:14:45 +00:00
committed by waddlesplash
parent 2e0a9b9554
commit 6fd4a3eea9
+7 -5
View File
@@ -766,12 +766,14 @@ XHCI::SubmitControlRequest(Transfer *transfer)
descriptor->trbs[index].address = 0;
descriptor->trbs[index].status = TRB_2_IRQ(0);
descriptor->trbs[index].flags = TRB_3_TYPE(TRB_TYPE_STATUS_STAGE)
| ((directionIn && requestData->Length > 0) ? 0 : TRB_3_DIR_IN)
| TRB_3_CHAIN_BIT | TRB_3_ENT_BIT | TRB_3_CYCLE_BIT;
// Status Stage is an OUT transfer when the device is sending data
// (XHCI 1.2 § 4.11.2.2 Table 4-7 p213), and the CHAIN bit must be
// set when using an Event Data TRB (as _LinkDescriptorForPipe does)
// (XHCI 1.2 § 6.4.1.2.3 Table 6-31 p472)
// The CHAIN bit must be set when using an Event Data TRB
// (XHCI 1.2 § 6.4.1.2.3 Table 6-31 p472).
// Status Stage is an OUT transfer when the device is sending data
// (XHCI 1.2 § 4.11.2.2 Table 4-7 p213), otherwise set the IN bit.
if (requestData->Length == 0 || !directionIn)
descriptor->trbs[index].flags |= TRB_3_DIR_IN;
descriptor->trb_used = index + 1;