public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value
@ 2022-12-10 15:08 Chang, Abner
  2022-12-12  3:27 ` Wu, Hao A
  0 siblings, 1 reply; 6+ messages in thread
From: Chang, Abner @ 2022-12-10 15:08 UTC (permalink / raw)
  To: devel; +Cc: Kuei-Hung.Lin, Hao A Wu, Ray Ni, Garrett Kirkendall, Abner Chang

From: Abner Chang <abner.chang@amd.com>

In V3: Add AMD copyright.
In V2: Remove the signed-off-by: Abner Chang.

Initialize XHCI DCI slot's context entries value.

Signed-off-by: Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
Cc: Abner Chang <abner.chang@amd.com>
---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 7 +++++++
 MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
index 13b0400e83d..f08722905f3 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -4,6 +4,7 @@
 
 Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR>
 Copyright (c) Microsoft Corporation.<BR>
+Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -2807,6 +2808,9 @@ XhcInitializeEndpointContext (
   MaxDci = 0;
 
   NumEp = IfDesc->NumEndpoints;
+  if (NumEp == 0) {
+    MaxDci = 1;
+  }
 
   EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
   for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
@@ -3006,6 +3010,9 @@ XhcInitializeEndpointContext64 (
   MaxDci = 0;
 
   NumEp = IfDesc->NumEndpoints;
+  if (NumEp == 0) {
+    MaxDci = 1;
+  }
 
   EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
   for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
index cc597a43717..8400c90f7ad 100644
--- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
@@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid
 which is used to enable recovery function from USB Drivers.
 
 Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.<BR>
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -1752,6 +1753,9 @@ XhcPeiSetConfigCmd (
     }
 
     NumEp = IfDesc->NumEndpoints;
+    if ((NumEp == 0) && (MaxDci == 0)) {
+      MaxDci = 1;
+    }
 
     EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
     for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
@@ -1974,6 +1978,9 @@ XhcPeiSetConfigCmd64 (
     }
 
     NumEp = IfDesc->NumEndpoints;
+    if ((NumEp == 0) && (MaxDci == 0)) {
+      MaxDci = 1;
+    }
 
     EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
     for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
-- 
2.37.1.windows.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value
  2022-12-10 15:08 [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value Chang, Abner
@ 2022-12-12  3:27 ` Wu, Hao A
  2022-12-20  2:45   ` Chang, Abner
  0 siblings, 1 reply; 6+ messages in thread
From: Wu, Hao A @ 2022-12-12  3:27 UTC (permalink / raw)
  To: abner.chang@amd.com, devel@edk2.groups.io
  Cc: Kuei-Hung.Lin@amd.com, Ni, Ray, Garrett Kirkendall

For the 3 patches:
[PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block
[PATCH V2] MdeModulePkg/Usb: Read a large number of blocks
[PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value

I found that they will cause CI failures: https://github.com/tianocore/edk2/pull/3749
Could you help to update them and help to ensure they can pass the CI test? Thanks in advance.

Best Regards,
Hao Wu

> -----Original Message-----
> From: abner.chang@amd.com <abner.chang@amd.com>
> Sent: Saturday, December 10, 2022 11:08 PM
> To: devel@edk2.groups.io
> Cc: Kuei-Hung.Lin@amd.com; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
> <ray.ni@intel.com>; Garrett Kirkendall <garrett.kirkendall@amd.com>;
> Abner Chang <abner.chang@amd.com>
> Subject: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context
> value
> 
> From: Abner Chang <abner.chang@amd.com>
> 
> In V3: Add AMD copyright.
> In V2: Remove the signed-off-by: Abner Chang.
> 
> Initialize XHCI DCI slot's context entries value.
> 
> Signed-off-by: Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
> Cc: Abner Chang <abner.chang@amd.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 7 +++++++
>  MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 7 +++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> index 13b0400e83d..f08722905f3 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> @@ -4,6 +4,7 @@
> 
>  Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR>
>  Copyright (c) Microsoft Corporation.<BR>
> +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.<BR>
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -2807,6 +2808,9 @@ XhcInitializeEndpointContext (
>    MaxDci = 0;
> 
>    NumEp = IfDesc->NumEndpoints;
> +  if (NumEp == 0) {
> +    MaxDci = 1;
> +  }
> 
>    EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
>    for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
> @@ -3006,6 +3010,9 @@ XhcInitializeEndpointContext64 (
>    MaxDci = 0;
> 
>    NumEp = IfDesc->NumEndpoints;
> +  if (NumEp == 0) {
> +    MaxDci = 1;
> +  }
> 
>    EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
>    for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
> diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> index cc597a43717..8400c90f7ad 100644
> --- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> +++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> @@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based
> on gPeiUsbControllerPpiGuid
>  which is used to enable recovery function from USB Drivers.
> 
>  Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.<BR>
> 
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -1752,6 +1753,9 @@ XhcPeiSetConfigCmd (
>      }
> 
>      NumEp = IfDesc->NumEndpoints;
> +    if ((NumEp == 0) && (MaxDci == 0)) {
> +      MaxDci = 1;
> +    }
> 
>      EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
>      for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
> @@ -1974,6 +1978,9 @@ XhcPeiSetConfigCmd64 (
>      }
> 
>      NumEp = IfDesc->NumEndpoints;
> +    if ((NumEp == 0) && (MaxDci == 0)) {
> +      MaxDci = 1;
> +    }
> 
>      EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
>      for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
> --
> 2.37.1.windows.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value
  2022-12-12  3:27 ` Wu, Hao A
@ 2022-12-20  2:45   ` Chang, Abner
  2022-12-20  3:03     ` Wu, Hao A
  0 siblings, 1 reply; 6+ messages in thread
From: Chang, Abner @ 2022-12-20  2:45 UTC (permalink / raw)
  To: Wu, Hao A, devel@edk2.groups.io
  Cc: Lin, Kuei-Hung (Timothy), Ni, Ray, Kirkendall, Garrett

[AMD Official Use Only - General]

Hi Hao,
That is the uncrustify check error. I already fixed it at "[PATCH V3] MdeModulePkg/Usb: Read a large number of blocks."

Also, these three patches are passed the CI test.
https://github.com/tianocore/edk2/pull/3794

Thanks
Abner

> -----Original Message-----
> From: Wu, Hao A <hao.a.wu@intel.com>
> Sent: Monday, December 12, 2022 11:27 AM
> To: Chang, Abner <Abner.Chang@amd.com>; devel@edk2.groups.io
> Cc: Lin, Kuei-Hung (Timothy) <Kuei-Hung.Lin@amd.com>; Ni, Ray
> <ray.ni@intel.com>; Kirkendall, Garrett <Garrett.Kirkendall@amd.com>
> Subject: RE: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context
> value
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> For the 3 patches:
> [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block [PATCH
> V2] MdeModulePkg/Usb: Read a large number of blocks [PATCH V3]
> MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value
> 
> I found that they will cause CI failures:
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> ub.com%2Ftianocore%2Fedk2%2Fpull%2F3749&amp;data=05%7C01%7Cabn
> er.chang%40amd.com%7Cfe921dc0e08b4cdf30a208dadbf0cb8c%7C3dd8961f
> e4884e608e11a82d994e183d%7C0%7C0%7C638064124508360013%7CUnknow
> n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1ha
> WwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=0iQKJ3X3IJv1CSqe
> mjTWyT1hlYvqGZsYPAdwXEi%2B%2FZ4%3D&amp;reserved=0
> Could you help to update them and help to ensure they can pass the CI test?
> Thanks in advance.
> 
> Best Regards,
> Hao Wu
> 
> > -----Original Message-----
> > From: abner.chang@amd.com <abner.chang@amd.com>
> > Sent: Saturday, December 10, 2022 11:08 PM
> > To: devel@edk2.groups.io
> > Cc: Kuei-Hung.Lin@amd.com; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
> > <ray.ni@intel.com>; Garrett Kirkendall <garrett.kirkendall@amd.com>;
> > Abner Chang <abner.chang@amd.com>
> > Subject: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context
> > value
> >
> > From: Abner Chang <abner.chang@amd.com>
> >
> > In V3: Add AMD copyright.
> > In V2: Remove the signed-off-by: Abner Chang.
> >
> > Initialize XHCI DCI slot's context entries value.
> >
> > Signed-off-by: Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
> > Cc: Abner Chang <abner.chang@amd.com>
> > ---
> >  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 7 +++++++
> > MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 7 +++++++
> >  2 files changed, 14 insertions(+)
> >
> > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > index 13b0400e83d..f08722905f3 100644
> > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > @@ -4,6 +4,7 @@
> >
> >  Copyright (c) 2011 - 2020, Intel Corporation. All rights
> > reserved.<BR>  Copyright (c) Microsoft Corporation.<BR>
> > +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights
> > +reserved.<BR>
> >  SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >  **/
> > @@ -2807,6 +2808,9 @@ XhcInitializeEndpointContext (
> >    MaxDci = 0;
> >
> >    NumEp = IfDesc->NumEndpoints;
> > +  if (NumEp == 0) {
> > +    MaxDci = 1;
> > +  }
> >
> >    EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> >    for (EpIndex = 0; EpIndex < NumEp; EpIndex++) { @@ -3006,6 +3010,9
> > @@ XhcInitializeEndpointContext64 (
> >    MaxDci = 0;
> >
> >    NumEp = IfDesc->NumEndpoints;
> > +  if (NumEp == 0) {
> > +    MaxDci = 1;
> > +  }
> >
> >    EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> >    for (EpIndex = 0; EpIndex < NumEp; EpIndex++) { diff --git
> > a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > index cc597a43717..8400c90f7ad 100644
> > --- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > +++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > @@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based
> on
> > gPeiUsbControllerPpiGuid  which is used to enable recovery function
> > from USB Drivers.
> >
> >  Copyright (c) 2014 - 2017, Intel Corporation. All rights
> > reserved.<BR>
> > +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights
> > +reserved.<BR>
> >
> >  SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> > @@ -1752,6 +1753,9 @@ XhcPeiSetConfigCmd (
> >      }
> >
> >      NumEp = IfDesc->NumEndpoints;
> > +    if ((NumEp == 0) && (MaxDci == 0)) {
> > +      MaxDci = 1;
> > +    }
> >
> >      EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> >      for (EpIndex = 0; EpIndex < NumEp; EpIndex++) { @@ -1974,6
> > +1978,9 @@ XhcPeiSetConfigCmd64 (
> >      }
> >
> >      NumEp = IfDesc->NumEndpoints;
> > +    if ((NumEp == 0) && (MaxDci == 0)) {
> > +      MaxDci = 1;
> > +    }
> >
> >      EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> >      for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
> > --
> > 2.37.1.windows.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value
  2022-12-20  2:45   ` Chang, Abner
@ 2022-12-20  3:03     ` Wu, Hao A
  2022-12-20  3:05       ` Chang, Abner
  2022-12-21 15:44       ` Chang, Abner
  0 siblings, 2 replies; 6+ messages in thread
From: Wu, Hao A @ 2022-12-20  3:03 UTC (permalink / raw)
  To: Chang, Abner, devel@edk2.groups.io
  Cc: Lin, Kuei-Hung (Timothy), Ni, Ray, Kirkendall, Garrett

Thanks,

For this patch "MdeModulePkg/XhciPei: Unlinked XhciPei memory block", my take is that there will also be an updated version, right?
If this is the case, could you help to send out a single 3-patch series for them instead of sending 3 separated patches? Thanks in advance.

Best Regards,
Hao Wu

> -----Original Message-----
> From: Chang, Abner <Abner.Chang@amd.com>
> Sent: Tuesday, December 20, 2022 10:45 AM
> To: Wu, Hao A <hao.a.wu@intel.com>; devel@edk2.groups.io
> Cc: Lin, Kuei-Hung (Timothy) <Kuei-Hung.Lin@amd.com>; Ni, Ray
> <ray.ni@intel.com>; Kirkendall, Garrett <Garrett.Kirkendall@amd.com>
> Subject: RE: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context
> value
> 
> [AMD Official Use Only - General]
> 
> Hi Hao,
> That is the uncrustify check error. I already fixed it at "[PATCH V3]
> MdeModulePkg/Usb: Read a large number of blocks."
> 
> Also, these three patches are passed the CI test.
> https://github.com/tianocore/edk2/pull/3794
> 
> Thanks
> Abner
> 
> > -----Original Message-----
> > From: Wu, Hao A <hao.a.wu@intel.com>
> > Sent: Monday, December 12, 2022 11:27 AM
> > To: Chang, Abner <Abner.Chang@amd.com>; devel@edk2.groups.io
> > Cc: Lin, Kuei-Hung (Timothy) <Kuei-Hung.Lin@amd.com>; Ni, Ray
> > <ray.ni@intel.com>; Kirkendall, Garrett <Garrett.Kirkendall@amd.com>
> > Subject: RE: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's
> > Context value
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > For the 3 patches:
> > [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block
> [PATCH
> > V2] MdeModulePkg/Usb: Read a large number of blocks [PATCH V3]
> > MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value
> >
> > I found that they will cause CI failures:
> >
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> >
> ub.com%2Ftianocore%2Fedk2%2Fpull%2F3749&amp;data=05%7C01%7Cabn
> >
> er.chang%40amd.com%7Cfe921dc0e08b4cdf30a208dadbf0cb8c%7C3dd8961
> f
> >
> e4884e608e11a82d994e183d%7C0%7C0%7C638064124508360013%7CUnkno
> w
> >
> n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1ha
> > WwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=0iQKJ3X3IJv1CSqe
> > mjTWyT1hlYvqGZsYPAdwXEi%2B%2FZ4%3D&amp;reserved=0
> > Could you help to update them and help to ensure they can pass the CI test?
> > Thanks in advance.
> >
> > Best Regards,
> > Hao Wu
> >
> > > -----Original Message-----
> > > From: abner.chang@amd.com <abner.chang@amd.com>
> > > Sent: Saturday, December 10, 2022 11:08 PM
> > > To: devel@edk2.groups.io
> > > Cc: Kuei-Hung.Lin@amd.com; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
> > > <ray.ni@intel.com>; Garrett Kirkendall <garrett.kirkendall@amd.com>;
> > > Abner Chang <abner.chang@amd.com>
> > > Subject: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's
> > > Context value
> > >
> > > From: Abner Chang <abner.chang@amd.com>
> > >
> > > In V3: Add AMD copyright.
> > > In V2: Remove the signed-off-by: Abner Chang.
> > >
> > > Initialize XHCI DCI slot's context entries value.
> > >
> > > Signed-off-by: Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
> > > Cc: Hao A Wu <hao.a.wu@intel.com>
> > > Cc: Ray Ni <ray.ni@intel.com>
> > > Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
> > > Cc: Abner Chang <abner.chang@amd.com>
> > > ---
> > >  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 7 +++++++
> > > MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 7 +++++++
> > >  2 files changed, 14 insertions(+)
> > >
> > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > > index 13b0400e83d..f08722905f3 100644
> > > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > > @@ -4,6 +4,7 @@
> > >
> > >  Copyright (c) 2011 - 2020, Intel Corporation. All rights
> > > reserved.<BR>  Copyright (c) Microsoft Corporation.<BR>
> > > +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights
> > > +reserved.<BR>
> > >  SPDX-License-Identifier: BSD-2-Clause-Patent
> > >
> > >  **/
> > > @@ -2807,6 +2808,9 @@ XhcInitializeEndpointContext (
> > >    MaxDci = 0;
> > >
> > >    NumEp = IfDesc->NumEndpoints;
> > > +  if (NumEp == 0) {
> > > +    MaxDci = 1;
> > > +  }
> > >
> > >    EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> > >    for (EpIndex = 0; EpIndex < NumEp; EpIndex++) { @@ -3006,6
> > > +3010,9 @@ XhcInitializeEndpointContext64 (
> > >    MaxDci = 0;
> > >
> > >    NumEp = IfDesc->NumEndpoints;
> > > +  if (NumEp == 0) {
> > > +    MaxDci = 1;
> > > +  }
> > >
> > >    EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> > >    for (EpIndex = 0; EpIndex < NumEp; EpIndex++) { diff --git
> > > a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > > b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > > index cc597a43717..8400c90f7ad 100644
> > > --- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > > +++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > > @@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid
> based
> > on
> > > gPeiUsbControllerPpiGuid  which is used to enable recovery function
> > > from USB Drivers.
> > >
> > >  Copyright (c) 2014 - 2017, Intel Corporation. All rights
> > > reserved.<BR>
> > > +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights
> > > +reserved.<BR>
> > >
> > >  SPDX-License-Identifier: BSD-2-Clause-Patent
> > >
> > > @@ -1752,6 +1753,9 @@ XhcPeiSetConfigCmd (
> > >      }
> > >
> > >      NumEp = IfDesc->NumEndpoints;
> > > +    if ((NumEp == 0) && (MaxDci == 0)) {
> > > +      MaxDci = 1;
> > > +    }
> > >
> > >      EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> > >      for (EpIndex = 0; EpIndex < NumEp; EpIndex++) { @@ -1974,6
> > > +1978,9 @@ XhcPeiSetConfigCmd64 (
> > >      }
> > >
> > >      NumEp = IfDesc->NumEndpoints;
> > > +    if ((NumEp == 0) && (MaxDci == 0)) {
> > > +      MaxDci = 1;
> > > +    }
> > >
> > >      EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> > >      for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
> > > --
> > > 2.37.1.windows.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value
  2022-12-20  3:03     ` Wu, Hao A
@ 2022-12-20  3:05       ` Chang, Abner
  2022-12-21 15:44       ` Chang, Abner
  1 sibling, 0 replies; 6+ messages in thread
From: Chang, Abner @ 2022-12-20  3:05 UTC (permalink / raw)
  To: Wu, Hao A, devel@edk2.groups.io
  Cc: Lin, Kuei-Hung (Timothy), Ni, Ray, Kirkendall, Garrett

[AMD Official Use Only - General]

Ah ok, that would be good.

Thanks
Abner

> -----Original Message-----
> From: Wu, Hao A <hao.a.wu@intel.com>
> Sent: Tuesday, December 20, 2022 11:03 AM
> To: Chang, Abner <Abner.Chang@amd.com>; devel@edk2.groups.io
> Cc: Lin, Kuei-Hung (Timothy) <Kuei-Hung.Lin@amd.com>; Ni, Ray
> <ray.ni@intel.com>; Kirkendall, Garrett <Garrett.Kirkendall@amd.com>
> Subject: RE: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context
> value
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Thanks,
> 
> For this patch "MdeModulePkg/XhciPei: Unlinked XhciPei memory block",
> my take is that there will also be an updated version, right?
> If this is the case, could you help to send out a single 3-patch series for them
> instead of sending 3 separated patches? Thanks in advance.
> 
> Best Regards,
> Hao Wu
> 
> > -----Original Message-----
> > From: Chang, Abner <Abner.Chang@amd.com>
> > Sent: Tuesday, December 20, 2022 10:45 AM
> > To: Wu, Hao A <hao.a.wu@intel.com>; devel@edk2.groups.io
> > Cc: Lin, Kuei-Hung (Timothy) <Kuei-Hung.Lin@amd.com>; Ni, Ray
> > <ray.ni@intel.com>; Kirkendall, Garrett <Garrett.Kirkendall@amd.com>
> > Subject: RE: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's
> > Context value
> >
> > [AMD Official Use Only - General]
> >
> > Hi Hao,
> > That is the uncrustify check error. I already fixed it at "[PATCH V3]
> > MdeModulePkg/Usb: Read a large number of blocks."
> >
> > Also, these three patches are passed the CI test.
> >
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> >
> ub.com%2Ftianocore%2Fedk2%2Fpull%2F3794&data=05%7C01%7CAbner.Ch
> ang%40a
> >
> md.com%7C187600a1cd0942afb7b708dae236cbf5%7C3dd8961fe4884e608e11
> a82d99
> >
> 4e183d%7C0%7C0%7C638071022231599779%7CUnknown%7CTWFpbGZsb3d8
> eyJWIjoiMC
> >
> 4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%
> 7C%7C%
> >
> 7C&sdata=AqFmywwFq9wJmix13UNfBDdT84wtFK%2BH8THRa7iYcm4%3D&r
> eserved=0
> >
> > Thanks
> > Abner
> >
> > > -----Original Message-----
> > > From: Wu, Hao A <hao.a.wu@intel.com>
> > > Sent: Monday, December 12, 2022 11:27 AM
> > > To: Chang, Abner <Abner.Chang@amd.com>; devel@edk2.groups.io
> > > Cc: Lin, Kuei-Hung (Timothy) <Kuei-Hung.Lin@amd.com>; Ni, Ray
> > > <ray.ni@intel.com>; Kirkendall, Garrett <Garrett.Kirkendall@amd.com>
> > > Subject: RE: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's
> > > Context value
> > >
> > > Caution: This message originated from an External Source. Use proper
> > > caution when opening attachments, clicking links, or responding.
> > >
> > >
> > > For the 3 patches:
> > > [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block
> > [PATCH
> > > V2] MdeModulePkg/Usb: Read a large number of blocks [PATCH V3]
> > > MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value
> > >
> > > I found that they will cause CI failures:
> > >
> >
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> > >
> >
> ub.com%2Ftianocore%2Fedk2%2Fpull%2F3749&amp;data=05%7C01%7Cabn
> > >
> >
> er.chang%40amd.com%7Cfe921dc0e08b4cdf30a208dadbf0cb8c%7C3dd8961
> > f
> > >
> > e4884e608e11a82d994e183d%7C0%7C0%7C638064124508360013%7CUnkno
> > w
> > >
> >
> n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1ha
> > >
> WwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=0iQKJ3X3IJv1CSqe
> > > mjTWyT1hlYvqGZsYPAdwXEi%2B%2FZ4%3D&amp;reserved=0
> > > Could you help to update them and help to ensure they can pass the CI
> test?
> > > Thanks in advance.
> > >
> > > Best Regards,
> > > Hao Wu
> > >
> > > > -----Original Message-----
> > > > From: abner.chang@amd.com <abner.chang@amd.com>
> > > > Sent: Saturday, December 10, 2022 11:08 PM
> > > > To: devel@edk2.groups.io
> > > > Cc: Kuei-Hung.Lin@amd.com; Wu, Hao A <hao.a.wu@intel.com>; Ni,
> Ray
> > > > <ray.ni@intel.com>; Garrett Kirkendall
> > > > <garrett.kirkendall@amd.com>; Abner Chang
> <abner.chang@amd.com>
> > > > Subject: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's
> > > > Context value
> > > >
> > > > From: Abner Chang <abner.chang@amd.com>
> > > >
> > > > In V3: Add AMD copyright.
> > > > In V2: Remove the signed-off-by: Abner Chang.
> > > >
> > > > Initialize XHCI DCI slot's context entries value.
> > > >
> > > > Signed-off-by: Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
> > > > Cc: Hao A Wu <hao.a.wu@intel.com>
> > > > Cc: Ray Ni <ray.ni@intel.com>
> > > > Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
> > > > Cc: Abner Chang <abner.chang@amd.com>
> > > > ---
> > > >  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 7 +++++++
> > > > MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 7 +++++++
> > > >  2 files changed, 14 insertions(+)
> > > >
> > > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > > > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > > > index 13b0400e83d..f08722905f3 100644
> > > > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > > > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > > > @@ -4,6 +4,7 @@
> > > >
> > > >  Copyright (c) 2011 - 2020, Intel Corporation. All rights
> > > > reserved.<BR>  Copyright (c) Microsoft Corporation.<BR>
> > > > +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights
> > > > +reserved.<BR>
> > > >  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > >
> > > >  **/
> > > > @@ -2807,6 +2808,9 @@ XhcInitializeEndpointContext (
> > > >    MaxDci = 0;
> > > >
> > > >    NumEp = IfDesc->NumEndpoints;
> > > > +  if (NumEp == 0) {
> > > > +    MaxDci = 1;
> > > > +  }
> > > >
> > > >    EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> > > >    for (EpIndex = 0; EpIndex < NumEp; EpIndex++) { @@ -3006,6
> > > > +3010,9 @@ XhcInitializeEndpointContext64 (
> > > >    MaxDci = 0;
> > > >
> > > >    NumEp = IfDesc->NumEndpoints;
> > > > +  if (NumEp == 0) {
> > > > +    MaxDci = 1;
> > > > +  }
> > > >
> > > >    EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> > > >    for (EpIndex = 0; EpIndex < NumEp; EpIndex++) { diff --git
> > > > a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > > > b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > > > index cc597a43717..8400c90f7ad 100644
> > > > --- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > > > +++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > > > @@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid
> > based
> > > on
> > > > gPeiUsbControllerPpiGuid  which is used to enable recovery
> > > > function from USB Drivers.
> > > >
> > > >  Copyright (c) 2014 - 2017, Intel Corporation. All rights
> > > > reserved.<BR>
> > > > +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights
> > > > +reserved.<BR>
> > > >
> > > >  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > >
> > > > @@ -1752,6 +1753,9 @@ XhcPeiSetConfigCmd (
> > > >      }
> > > >
> > > >      NumEp = IfDesc->NumEndpoints;
> > > > +    if ((NumEp == 0) && (MaxDci == 0)) {
> > > > +      MaxDci = 1;
> > > > +    }
> > > >
> > > >      EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> > > >      for (EpIndex = 0; EpIndex < NumEp; EpIndex++) { @@ -1974,6
> > > > +1978,9 @@ XhcPeiSetConfigCmd64 (
> > > >      }
> > > >
> > > >      NumEp = IfDesc->NumEndpoints;
> > > > +    if ((NumEp == 0) && (MaxDci == 0)) {
> > > > +      MaxDci = 1;
> > > > +    }
> > > >
> > > >      EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> > > >      for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
> > > > --
> > > > 2.37.1.windows.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value
  2022-12-20  3:03     ` Wu, Hao A
  2022-12-20  3:05       ` Chang, Abner
@ 2022-12-21 15:44       ` Chang, Abner
  1 sibling, 0 replies; 6+ messages in thread
From: Chang, Abner @ 2022-12-21 15:44 UTC (permalink / raw)
  To: Wu, Hao A, devel@edk2.groups.io
  Cc: Lin, Kuei-Hung (Timothy), Ni, Ray, Kirkendall, Garrett

[-- Attachment #1: Type: text/plain, Size: 7758 bytes --]

[AMD Official Use Only - General]

Hi Hao,
I just sent out three patches and below is PR which passed the CI.
https://github.com/tianocore/edk2/pull/3794

Thanks
Abner

> -----Original Message-----
> From: Wu, Hao A <hao.a.wu@intel.com>
> Sent: Tuesday, December 20, 2022 11:03 AM
> To: Chang, Abner <Abner.Chang@amd.com>; devel@edk2.groups.io
> Cc: Lin, Kuei-Hung (Timothy) <Kuei-Hung.Lin@amd.com>; Ni, Ray
> <ray.ni@intel.com>; Kirkendall, Garrett <Garrett.Kirkendall@amd.com>
> Subject: RE: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context
> value
> 
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
> 
> 
> Thanks,
> 
> For this patch "MdeModulePkg/XhciPei: Unlinked XhciPei memory block", my
> take is that there will also be an updated version, right?
> If this is the case, could you help to send out a single 3-patch series for them
> instead of sending 3 separated patches? Thanks in advance.
> 
> Best Regards,
> Hao Wu
> 
> > -----Original Message-----
> > From: Chang, Abner <Abner.Chang@amd.com>
> > Sent: Tuesday, December 20, 2022 10:45 AM
> > To: Wu, Hao A <hao.a.wu@intel.com>; devel@edk2.groups.io
> > Cc: Lin, Kuei-Hung (Timothy) <Kuei-Hung.Lin@amd.com>; Ni, Ray
> > <ray.ni@intel.com>; Kirkendall, Garrett <Garrett.Kirkendall@amd.com>
> > Subject: RE: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's
> > Context value
> >
> > [AMD Official Use Only - General]
> >
> > Hi Hao,
> > That is the uncrustify check error. I already fixed it at "[PATCH V3]
> > MdeModulePkg/Usb: Read a large number of blocks."
> >
> > Also, these three patches are passed the CI test.
> > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> >
> ub.com%2Ftianocore%2Fedk2%2Fpull%2F3794&data=05%7C01%7CAbner.Chan
> g%40a
> >
> md.com%7C187600a1cd0942afb7b708dae236cbf5%7C3dd8961fe4884e608e11
> a82d99
> >
> 4e183d%7C0%7C0%7C638071022231599779%7CUnknown%7CTWFpbGZsb3d8e
> yJWIjoiMC
> >
> 4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C
> %7C%
> >
> 7C&sdata=AqFmywwFq9wJmix13UNfBDdT84wtFK%2BH8THRa7iYcm4%3D&rese
> rved=0
> >
> > Thanks
> > Abner
> >
> > > -----Original Message-----
> > > From: Wu, Hao A <hao.a.wu@intel.com>
> > > Sent: Monday, December 12, 2022 11:27 AM
> > > To: Chang, Abner <Abner.Chang@amd.com>; devel@edk2.groups.io
> > > Cc: Lin, Kuei-Hung (Timothy) <Kuei-Hung.Lin@amd.com>; Ni, Ray
> > > <ray.ni@intel.com>; Kirkendall, Garrett <Garrett.Kirkendall@amd.com>
> > > Subject: RE: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's
> > > Context value
> > >
> > > Caution: This message originated from an External Source. Use proper
> > > caution when opening attachments, clicking links, or responding.
> > >
> > >
> > > For the 3 patches:
> > > [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block
> > [PATCH
> > > V2] MdeModulePkg/Usb: Read a large number of blocks [PATCH V3]
> > > MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value
> > >
> > > I found that they will cause CI failures:
> > >
> > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> > >
> > ub.com%2Ftianocore%2Fedk2%2Fpull%2F3749&amp;data=05%7C01%7Cabn
> > >
> > er.chang%40amd.com%7Cfe921dc0e08b4cdf30a208dadbf0cb8c%7C3dd8961
> > f
> > >
> > e4884e608e11a82d994e183d%7C0%7C0%7C638064124508360013%7CUnkno
> > w
> > >
> > n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1ha
> > > WwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=0iQKJ3X3IJv1CSqe
> > > mjTWyT1hlYvqGZsYPAdwXEi%2B%2FZ4%3D&amp;reserved=0
> > > Could you help to update them and help to ensure they can pass the CI test?
> > > Thanks in advance.
> > >
> > > Best Regards,
> > > Hao Wu
> > >
> > > > -----Original Message-----
> > > > From: abner.chang@amd.com <abner.chang@amd.com>
> > > > Sent: Saturday, December 10, 2022 11:08 PM
> > > > To: devel@edk2.groups.io
> > > > Cc: Kuei-Hung.Lin@amd.com; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
> > > > <ray.ni@intel.com>; Garrett Kirkendall
> > > > <garrett.kirkendall@amd.com>; Abner Chang <abner.chang@amd.com>
> > > > Subject: [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's
> > > > Context value
> > > >
> > > > From: Abner Chang <abner.chang@amd.com>
> > > >
> > > > In V3: Add AMD copyright.
> > > > In V2: Remove the signed-off-by: Abner Chang.
> > > >
> > > > Initialize XHCI DCI slot's context entries value.
> > > >
> > > > Signed-off-by: Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
> > > > Cc: Hao A Wu <hao.a.wu@intel.com>
> > > > Cc: Ray Ni <ray.ni@intel.com>
> > > > Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
> > > > Cc: Abner Chang <abner.chang@amd.com>
> > > > ---
> > > >  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 7 +++++++
> > > > MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 7 +++++++
> > > >  2 files changed, 14 insertions(+)
> > > >
> > > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > > > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > > > index 13b0400e83d..f08722905f3 100644
> > > > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > > > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > > > @@ -4,6 +4,7 @@
> > > >
> > > >  Copyright (c) 2011 - 2020, Intel Corporation. All rights
> > > > reserved.<BR>  Copyright (c) Microsoft Corporation.<BR>
> > > > +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights
> > > > +reserved.<BR>
> > > >  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > >
> > > >  **/
> > > > @@ -2807,6 +2808,9 @@ XhcInitializeEndpointContext (
> > > >    MaxDci = 0;
> > > >
> > > >    NumEp = IfDesc->NumEndpoints;
> > > > +  if (NumEp == 0) {
> > > > +    MaxDci = 1;
> > > > +  }
> > > >
> > > >    EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> > > >    for (EpIndex = 0; EpIndex < NumEp; EpIndex++) { @@ -3006,6
> > > > +3010,9 @@ XhcInitializeEndpointContext64 (
> > > >    MaxDci = 0;
> > > >
> > > >    NumEp = IfDesc->NumEndpoints;
> > > > +  if (NumEp == 0) {
> > > > +    MaxDci = 1;
> > > > +  }
> > > >
> > > >    EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> > > >    for (EpIndex = 0; EpIndex < NumEp; EpIndex++) { diff --git
> > > > a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > > > b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > > > index cc597a43717..8400c90f7ad 100644
> > > > --- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > > > +++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> > > > @@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid
> > based
> > > on
> > > > gPeiUsbControllerPpiGuid  which is used to enable recovery
> > > > function from USB Drivers.
> > > >
> > > >  Copyright (c) 2014 - 2017, Intel Corporation. All rights
> > > > reserved.<BR>
> > > > +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights
> > > > +reserved.<BR>
> > > >
> > > >  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > >
> > > > @@ -1752,6 +1753,9 @@ XhcPeiSetConfigCmd (
> > > >      }
> > > >
> > > >      NumEp = IfDesc->NumEndpoints;
> > > > +    if ((NumEp == 0) && (MaxDci == 0)) {
> > > > +      MaxDci = 1;
> > > > +    }
> > > >
> > > >      EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> > > >      for (EpIndex = 0; EpIndex < NumEp; EpIndex++) { @@ -1974,6
> > > > +1978,9 @@ XhcPeiSetConfigCmd64 (
> > > >      }
> > > >
> > > >      NumEp = IfDesc->NumEndpoints;
> > > > +    if ((NumEp == 0) && (MaxDci == 0)) {
> > > > +      MaxDci = 1;
> > > > +    }
> > > >
> > > >      EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
> > > >      for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
> > > > --
> > > > 2.37.1.windows.1

[-- Attachment #2: Type: message/rfc822, Size: 13938 bytes --]

From: "Chang, Abner via groups.io" <abner.chang=amd.com@groups.io>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Hao A Wu <hao.a.wu@intel.com>, Ray Ni <ray.ni@intel.com>, "Kirkendall, Garrett" <Garrett.Kirkendall@amd.com>, "Chang, Abner" <Abner.Chang@amd.com>, "Lin, Kuei-Hung (Timothy)" <Kuei-Hung.Lin@amd.com>
Subject: [edk2-devel] [PATCH 3/3] MdeModulePkg/XhciPei: Unlinked XhciPei memory block
Date: Wed, 21 Dec 2022 15:42:17 +0000
Message-ID: <1732D953FCEE4284.12545@groups.io>

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


From: Abner Chang <abner.chang@amd.com>

Unlink the XhciPei memory block when it has been freed.

Signed-off-by: Jiangang He <jiangang.he@amd.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
---
 MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c | 29 ++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
index c64b38fcfc8..7dc014e465d 100644
--- a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
+++ b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
@@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid
 which is used to enable recovery function from USB Drivers.

 Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.<BR>

 SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -365,6 +366,32 @@ UsbHcInitMemPool (
   return Pool;
 }

+/**
+  Unlink the memory block from the pool's list.
+
+  @param  Head           The block list head of the memory's pool.
+  @param  BlockToUnlink  The memory block to unlink.
+
+**/
+VOID
+UsbHcUnlinkMemBlock (
+  IN USBHC_MEM_BLOCK  *Head,
+  IN USBHC_MEM_BLOCK  *BlockToUnlink
+  )
+{
+  USBHC_MEM_BLOCK  *Block;
+
+  ASSERT ((Head != NULL) && (BlockToUnlink != NULL));
+
+  for (Block = Head; Block != NULL; Block = Block->Next) {
+    if (Block->Next == BlockToUnlink) {
+      Block->Next         = BlockToUnlink->Next;
+      BlockToUnlink->Next = NULL;
+      break;
+    }
+  }
+}
+
 /**
   Release the memory management pool.

@@ -386,7 +413,7 @@ UsbHcFreeMemPool (
   // first block.
   //
   for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
-    // UsbHcUnlinkMemBlock (Pool->Head, Block);
+    UsbHcUnlinkMemBlock (Pool->Head, Block);
     UsbHcFreeMemBlock (Pool, Block);
   }

--
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97690): https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Fmessage%2F97690&data=05%7C01%7Cabner.chang%40amd.com%7Cfc19cbc943344c1b4ba408dae36a0427%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638072341730469421%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oddTHEzsrA3M%2BDWgm6H3DH3f8NDkfNKhsklRp9TUsx0%3D&reserved=0
Mute This Topic: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.io%2Fmt%2F95808360%2F7039027&data=05%7C01%7Cabner.chang%40amd.com%7Cfc19cbc943344c1b4ba408dae36a0427%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638072341730469421%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=N24EzofHEBkr50g2VoMPaITH5s702887E2c331mYSoY%3D&reserved=0
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Funsub&data=05%7C01%7Cabner.chang%40amd.com%7Cfc19cbc943344c1b4ba408dae36a0427%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638072341730469421%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=npI1cVSbpKZreSExI%2FrguTqKuYkwLeHmroAQ2JN905k%3D&reserved=0 [abner.chang@amd.com]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #3: Type: message/rfc822, Size: 14867 bytes --]

From: "Chang, Abner via groups.io" <abner.chang=amd.com@groups.io>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Hao A Wu <hao.a.wu@intel.com>, Ray Ni <ray.ni@intel.com>, "Kirkendall, Garrett" <Garrett.Kirkendall@amd.com>, "Chang, Abner" <Abner.Chang@amd.com>, "Lin, Kuei-Hung (Timothy)" <Kuei-Hung.Lin@amd.com>
Subject: [edk2-devel] [PATCH 2/3] MdeModulePkg/Usb: Read a large number of blocks
Date: Wed, 21 Dec 2022 15:41:44 +0000
Message-ID: <1732D94C3D119999.12545@groups.io>

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


From: Abner Chang <abner.chang@amd.com>

Changes to allow reading blocks that greater than 65535 sectors.

Signed-off-by: Jiangang He <jiangang.he@amd.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
---
 MdeModulePkg/Bus/Usb/UsbBotPei/PeiAtapi.c | 25 +++++++++++------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbBotPei/PeiAtapi.c b/MdeModulePkg/Bus/Usb/UsbBotPei/PeiAtapi.c
index 422ac5fec99..5111e4579e2 100644
--- a/MdeModulePkg/Bus/Usb/UsbBotPei/PeiAtapi.c
+++ b/MdeModulePkg/Bus/Usb/UsbBotPei/PeiAtapi.c
@@ -2,6 +2,7 @@
 Pei USB ATAPI command implementations.

 Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.<BR>

 SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -382,14 +383,14 @@ PeiUsbRead10 (
   ATAPI_PACKET_COMMAND  Packet;
   ATAPI_READ10_CMD      *Read10Packet;
   UINT16                MaxBlock;
-  UINT16                BlocksRemaining;
-  UINT16                SectorCount;
+  UINT32                BlocksRemaining;
+  UINT32                SectorCount;
   UINT32                Lba32;
   UINT32                BlockSize;
   UINT32                ByteCount;
   VOID                  *PtrBuffer;
   EFI_STATUS            Status;
-  UINT16                TimeOut;
+  UINT32                TimeOut;

   //
   // prepare command packet for the Inquiry Packet Command.
@@ -401,16 +402,13 @@ PeiUsbRead10 (

   BlockSize = (UINT32)PeiBotDevice->Media.BlockSize;

-  MaxBlock        = (UINT16)(65535 / BlockSize);
-  BlocksRemaining = (UINT16)NumberOfBlocks;
+  MaxBlock = (UINT16)(MAX_UINT16 / BlockSize);
+  ASSERT (NumberOfBlocks < MAX_UINT32);
+  BlocksRemaining = (UINT32)NumberOfBlocks;

   Status = EFI_SUCCESS;
   while (BlocksRemaining > 0) {
-    if (BlocksRemaining <= MaxBlock) {
-      SectorCount = BlocksRemaining;
-    } else {
-      SectorCount = MaxBlock;
-    }
+    SectorCount = MIN (BlocksRemaining, MaxBlock);

     //
     // fill the Packet data structure
@@ -435,7 +433,7 @@ PeiUsbRead10 (

     ByteCount = SectorCount * BlockSize;

-    TimeOut = (UINT16)(SectorCount * 2000);
+    TimeOut = SectorCount * 2000;

     //
     // send command packet
@@ -448,16 +446,17 @@ PeiUsbRead10 (
                (VOID *)PtrBuffer,
                ByteCount,
                EfiUsbDataIn,
-               TimeOut
+               (UINT16)MIN (TimeOut, MAX_UINT16)
                );

     if (Status != EFI_SUCCESS) {
       return Status;
     }

+    ASSERT (Lba32 <= (MAX_UINT32-SectorCount));
     Lba32          += SectorCount;
     PtrBuffer       = (UINT8 *)PtrBuffer + SectorCount * BlockSize;
-    BlocksRemaining = (UINT16)(BlocksRemaining - SectorCount);
+    BlocksRemaining = BlocksRemaining - SectorCount;
   }

   return Status;
--
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97689): https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Fmessage%2F97689&data=05%7C01%7Cabner.chang%40amd.com%7C73bf30322ab743bf065c08dae369f0f7%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638072341408928871%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=xX2U2xR%2Bp%2F6AYiyQqdObppuUzPBQkJAyHn4bSOE1d6Q%3D&reserved=0
Mute This Topic: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.io%2Fmt%2F95808341%2F7039027&data=05%7C01%7Cabner.chang%40amd.com%7C73bf30322ab743bf065c08dae369f0f7%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638072341408928871%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=d4VTNFZ8mJgTD4nvdLJoGAJa5oWVzpWpGmrZAHmCQqE%3D&reserved=0
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Funsub&data=05%7C01%7Cabner.chang%40amd.com%7C73bf30322ab743bf065c08dae369f0f7%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638072341408928871%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=y1Vk68SVot9lz2PJWT22P7BRibzHKVYcFkPz8WzSeVk%3D&reserved=0 [abner.chang@amd.com]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #4: Type: message/rfc822, Size: 14677 bytes --]

From: "Chang, Abner via groups.io" <abner.chang=amd.com@groups.io>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Hao A Wu <hao.a.wu@intel.com>, Ray Ni <ray.ni@intel.com>, "Kirkendall, Garrett" <Garrett.Kirkendall@amd.com>, "Chang, Abner" <Abner.Chang@amd.com>, "Lin, Kuei-Hung (Timothy)" <Kuei-Hung.Lin@amd.com>
Subject: [edk2-devel] [PATCH 1/3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value
Date: Wed, 21 Dec 2022 15:41:11 +0000
Message-ID: <1732D944B7F00903.12545@groups.io>

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


From: Abner Chang <abner.chang@amd.com>

Initialize XHCI DCI slot's context entries value.

Signed-off-by: Jiangang He <jiangang.he@amd.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 7 +++++++
 MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
index 13247f7b0df..4b7462704a8 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -4,6 +4,7 @@

 Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR>
 Copyright (c) Microsoft Corporation.<BR>
+Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent

 **/
@@ -2807,6 +2808,9 @@ XhcInitializeEndpointContext (
   MaxDci = 0;

   NumEp = IfDesc->NumEndpoints;
+  if (NumEp == 0) {
+    MaxDci = 1;
+  }

   EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
   for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
@@ -3006,6 +3010,9 @@ XhcInitializeEndpointContext64 (
   MaxDci = 0;

   NumEp = IfDesc->NumEndpoints;
+  if (NumEp == 0) {
+    MaxDci = 1;
+  }

   EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
   for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
index cc597a43717..8400c90f7ad 100644
--- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
@@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid
 which is used to enable recovery function from USB Drivers.

 Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.<BR>

 SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -1752,6 +1753,9 @@ XhcPeiSetConfigCmd (
     }

     NumEp = IfDesc->NumEndpoints;
+    if ((NumEp == 0) && (MaxDci == 0)) {
+      MaxDci = 1;
+    }

     EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
     for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
@@ -1974,6 +1978,9 @@ XhcPeiSetConfigCmd64 (
     }

     NumEp = IfDesc->NumEndpoints;
+    if ((NumEp == 0) && (MaxDci == 0)) {
+      MaxDci = 1;
+    }

     EpDesc = (USB_ENDPOINT_DESCRIPTOR *)(IfDesc + 1);
     for (EpIndex = 0; EpIndex < NumEp; EpIndex++) {
--
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97688): https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Fmessage%2F97688&data=05%7C01%7Cabner.chang%40amd.com%7C93d24d98bbf34d41b39f08dae369e047%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638072341117542409%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Q9npM2Zn6uKw%2Fi%2FQtHNllUeh8iARA0U6zBZ4T%2BaHhzw%3D&reserved=0
Mute This Topic: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.io%2Fmt%2F95808331%2F7039027&data=05%7C01%7Cabner.chang%40amd.com%7C93d24d98bbf34d41b39f08dae369e047%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638072341117542409%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=l2mO2VIZCQE8UhZ%2BWrjPblTwb4GqaoT2197MO9azbvM%3D&reserved=0
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Funsub&data=05%7C01%7Cabner.chang%40amd.com%7C93d24d98bbf34d41b39f08dae369e047%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638072341117542409%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=2bEyXDJVZxQV%2FeeQMmX0HeTicEtpYrC4iS7dERVg%2FrU%3D&reserved=0 [abner.chang@amd.com]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-21 15:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-10 15:08 [PATCH V3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value Chang, Abner
2022-12-12  3:27 ` Wu, Hao A
2022-12-20  2:45   ` Chang, Abner
2022-12-20  3:03     ` Wu, Hao A
2022-12-20  3:05       ` Chang, Abner
2022-12-21 15:44       ` Chang, Abner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox