Re: Having problem when xHCI create Setup Stage TRB


Wu, Hao A
 

Hello,

Looking into the XHCI spec, I think the current implementation in XhciDxe & XhciPei
does not follow the spec when it comes to the TRT field.

Could you help to provide more information on what error is met?
Thanks in advance.

Best Regards,
Hao Wu

-----Original Message-----
From: discuss@edk2.groups.io <discuss@edk2.groups.io> On Behalf Of
wenyi,xie via groups.io
Sent: Wednesday, May 26, 2021 2:09 PM
To: discuss@edk2.groups.io
Subject: [edk2-discuss] Having problem when xHCI create Setup Stage TRB

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.