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

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


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

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

Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang,
> Abner via groups.io
> Sent: Wednesday, December 21, 2022 11:41 PM
> To: devel@edk2.groups.io
> Cc: 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>; Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
> Subject: [edk2-devel] [PATCH 1/3] MdeModulePkg/Xhci: Initial XHCI DCI slot's
> Context value
> 
> 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
> 
> 
> 
> 
> 


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

end of thread, other threads:[~2022-12-23  1:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-21 15:41 [PATCH 1/3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value Chang, Abner
2022-12-23  1:00 ` [edk2-devel] " Wu, Hao A

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