[haiku-commits] Change in haiku[master]: XHCI: Set the DIR_IN bit on Status Stages even if there is no data.

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 29 Jun 2022 15:56:32 +0000

From waddlesplash <waddlesplash@xxxxxxxxx>:

waddlesplash has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/5421 ;)


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

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. FreeBSD appears to do this.

Tested in QEMU (me) and on real hardware with a bunch of devices
(nephele, thanks) where things seem to still work fine. May potentially
help with some control transfers timing out, if anything.
---
M src/add-ons/kernel/busses/usb/xhci.cpp
1 file changed, 3 insertions(+), 4 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/21/5421/1

diff --git a/src/add-ons/kernel/busses/usb/xhci.cpp 
b/src/add-ons/kernel/busses/usb/xhci.cpp
index 53df98a..e639966 100644
--- a/src/add-ons/kernel/busses/usb/xhci.cpp
+++ b/src/add-ons/kernel/busses/usb/xhci.cpp
@@ -766,12 +766,11 @@
        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)
+                       | (directionIn ? 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)
+               // (XHCI 1.2 § 4.11.2.2 Table 4-7 p213), and the CHAIN bit must 
be set
+               // when using an Event Data TRB (XHCI 1.2 § 6.4.1.2.3 Table 
6-31 p472).

        descriptor->trb_used = index + 1;


--
To view, visit https://review.haiku-os.org/c/haiku/+/5421
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I86b2eb2a6a5fa3af84fd0941e0a3ec601c7037bf
Gerrit-Change-Number: 5421
Gerrit-PatchSet: 1
Gerrit-Owner: waddlesplash <waddlesplash@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: XHCI: Set the DIR_IN bit on Status Stages even if there is no data. - Gerrit