Re: Having problem when xHCI create Setup Stage TRB


OK, I will submit a BZ bug and patch soon.


On 2021/5/27 16:26, Wu, Hao A wrote:
Could you help to submit a BZ bug tracker at:
And could you help to propose a fix for this issue?

Best Regards,
Hao Wu

-----Original Message-----
From: xiewenyi (A) <xiewenyi2@...>
Sent: Thursday, May 27, 2021 4:20 PM
To: Wu, Hao A <hao.a.wu@...>;
Subject: Re: [edk2-discuss] Having problem when xHCI create Setup Stage

Hi, Wu Hao

As TRT field is not set to EfiUsbNoData when Data Stage does not exist, USB
controller returns trb err and finally lead to usb enumerate fail.


On 2021/5/27 15:24, Wu, Hao A wrote:

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: <> On Behalf Of
wenyi,xie via
Sent: Wednesday, May 26, 2021 2:09 PM
Subject: [edk2-discuss] Having problem when xHCI create Setup Stage

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 :

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 to automatically receive all group messages.