public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: Wenyi Xie <xiewenyi2@huawei.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Wang, Jian J" <jian.j.wang@intel.com>,
	"Ni, Ray" <ray.ni@intel.com>
Cc: "songdongkuang@huawei.com" <songdongkuang@huawei.com>
Subject: Re: [PATCH EDK2 v1 1/1] MdeModulePkg/Xhci: Fix TRT when data length is 0
Date: Mon, 31 May 2021 01:44:30 +0000	[thread overview]
Message-ID: <BN8PR11MB366623285779A9A35A1E2815CA3F9@BN8PR11MB3666.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1622117066-67642-2-git-send-email-xiewenyi2@huawei.com>

> -----Original Message-----
> From: Wenyi Xie <xiewenyi2@huawei.com>
> Sent: Thursday, May 27, 2021 8:04 PM
> To: devel@edk2.groups.io; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>
> Cc: songdongkuang@huawei.com; xiewenyi2@huawei.com
> Subject: [PATCH EDK2 v1 1/1] MdeModulePkg/Xhci: Fix TRT when data length
> is 0
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3418
> 
> According to xhci spec, 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.
> So if data length equals to 0, TRT is set to 0.


Thanks for the patch, the changes are good to me.
Could you help to provide the information on what kind of test has been performed for this patch?

Best Regards,
Hao Wu


> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 13 +++++++++----
> MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 13 +++++++++----
>  2 files changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> index dc36945962a0..7cbc9a8502ea 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> @@ -298,10 +298,15 @@ XhcCreateTransferTrb (
>        TrbStart->TrbCtrSetup.IOC           = 1;
>        TrbStart->TrbCtrSetup.IDT           = 1;
>        TrbStart->TrbCtrSetup.Type          = TRB_TYPE_SETUP_STAGE;
> -      if (Urb->Ep.Direction == EfiUsbDataIn) {
> -        TrbStart->TrbCtrSetup.TRT = 3;
> -      } else if (Urb->Ep.Direction == EfiUsbDataOut) {
> -        TrbStart->TrbCtrSetup.TRT = 2;
> +      if (Urb->DataLen > 0) {
> +        if (Urb->Ep.Direction == EfiUsbDataIn) {
> +          TrbStart->TrbCtrSetup.TRT = 3;
> +        } else if (Urb->Ep.Direction == EfiUsbDataOut) {
> +          TrbStart->TrbCtrSetup.TRT = 2;
> +        } else {
> +          DEBUG ((DEBUG_ERROR, "XhcCreateTransferTrb: Direction sholud be
> IN or OUT when Data exists!\n"));
> +          ASSERT (FALSE);
> +        }
>        } else {
>          TrbStart->TrbCtrSetup.TRT = 0;
>        }
> diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> index 32d72ef03c2d..5b9892a1cbbb 100644
> --- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> +++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> @@ -291,10 +291,15 @@ XhcPeiCreateTransferTrb (
>        TrbStart->TrbCtrSetup.IOC           = 1;
>        TrbStart->TrbCtrSetup.IDT           = 1;
>        TrbStart->TrbCtrSetup.Type          = TRB_TYPE_SETUP_STAGE;
> -      if (Urb->Ep.Direction == EfiUsbDataIn) {
> -        TrbStart->TrbCtrSetup.TRT = 3;
> -      } else if (Urb->Ep.Direction == EfiUsbDataOut) {
> -        TrbStart->TrbCtrSetup.TRT = 2;
> +      if (Urb->DataLen > 0) {
> +        if (Urb->Ep.Direction == EfiUsbDataIn) {
> +          TrbStart->TrbCtrSetup.TRT = 3;
> +        } else if (Urb->Ep.Direction == EfiUsbDataOut) {
> +          TrbStart->TrbCtrSetup.TRT = 2;
> +        } else {
> +          DEBUG ((DEBUG_ERROR, "XhcPeiCreateTransferTrb: Direction sholud
> be IN or OUT when Data exists!\n"));
> +          ASSERT (FALSE);
> +        }
>        } else {
>          TrbStart->TrbCtrSetup.TRT = 0;
>        }
> --
> 2.20.1.windows.1


  reply	other threads:[~2021-05-31  1:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 12:04 [PATCH EDK2 v1 0/1] MdeModulePkg/Xhci: Fix TRT when data length is 0 wenyi,xie
2021-05-27 12:04 ` [PATCH EDK2 v1 1/1] " wenyi,xie
2021-05-31  1:44   ` Wu, Hao A [this message]
2021-05-31  3:18     ` wenyi,xie
2021-05-31  3:20       ` [edk2-devel] " Wu, Hao A
2021-06-02  7:57         ` Wu, Hao A

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN8PR11MB366623285779A9A35A1E2815CA3F9@BN8PR11MB3666.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox