Having problem when xHCI create Setup Stage TRB


wenyi,xie
 

Hello, everyone,

we meet a problem and are not sure if it's an issue, here's the description.
According usb-xhci specification, at USB packet level, a Control Transfer consists of multiple transactions partitioned into stages: a setup stage, an optional data stage, and a terminating status stage.
If Data Stage does not exist, the Transfer Type flag(TRT) should be No Data Stage.

But in function XhcCreateUrb() in file XhciSched.c, the Direction is set to EfiUsbDataIn or EfiUsbDataOut.
Ep->Direction = ((EpAddr & 0x80) != 0) ? EfiUsbDataIn : EfiUsbDataOut;

and then in function XhcCreateTransferTrb(), TRT is set to 3 or 2, it will never be 0.
if (Urb->Ep.Direction == EfiUsbDataIn) {
TrbStart->TrbCtrSetup.TRT = 3;
} else if (Urb->Ep.Direction == EfiUsbDataOut) {
TrbStart->TrbCtrSetup.TRT = 2;
} else {
TrbStart->TrbCtrSetup.TRT = 0;
}

TRT Value Definition
0 No Data Stage
1 Reserved
2 OUT Data Stage
3 IN Data Stage

Join discuss@edk2.groups.io to automatically receive all group messages.