public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST
       [not found] <cover.1713162827.git.xianglei.cai@intel.com>
@ 2024-04-15  6:33 ` Xianglei Cai
  2024-04-15  6:36   ` [edk2-devel] 回复: " gaoliming via groups.io
  0 siblings, 1 reply; 5+ messages in thread
From: Xianglei Cai @ 2024-04-15  6:33 UTC (permalink / raw)
  To: devel
  Cc: Xianglei Cai, Ray Ni, Liming Gao, Krzysztof Lewandowski,
	Jenny Huang, More Shih, Ian Chiu

https://bugzilla.tianocore.org/show_bug.cgi?id=4727

Recently some of XHCI host controllers require to have
extra 1ms delay before accessing any MMIO register
during reset. PHY transition from P3 to P0 can take
around 1.3ms and the xHCI reset can take around 1.5ms.
Add PCD to control the delay, the default is 2 ms.

Cc: Ray Ni                   <ray.ni@intel.com>
Cc: Liming Gao               <gaoliming@byosoft.com.cn>
Cc: Krzysztof Lewandowski    <krzysztof.lewandowski@intel.com>
Cc: Jenny Huang              <jenny.huang@intel.com>
Cc: More Shih                <more.shih@intel.com>
Cc: Ian Chiu                 <ian.chiu@intel.com>
Signed-off-by: Xianglei Cai <xianglei.cai@intel.com>
Reviewed-by: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com>
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h      | 1 +
 MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf | 4 ++++
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c   | 2 +-
 MdeModulePkg/MdeModulePkg.dec            | 5 +++++
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
index 44016758724c..c9a12095c29e 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
@@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/DebugLib.h>
 #include <Library/ReportStatusCodeLib.h>
 #include <Library/TimerLib.h>
+#include <Library/PcdLib.h>
 
 #include <IndustryStandard/Pci.h>
 
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
index 18ef87916ae4..e6c1ac8a6346 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
@@ -56,6 +56,7 @@
   DebugLib
   ReportStatusCodeLib
   TimerLib
+  PcdLib
 
 [Guids]
   gEfiEventExitBootServicesGuid                 ## SOMETIMES_CONSUMES ## Event
@@ -64,6 +65,9 @@
   gEfiPciIoProtocolGuid                         ## TO_START
   gEfiUsb2HcProtocolGuid                        ## BY_START
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdDelayXhciHCReset  ## CONSUMES
+
 # [Event]
 # EVENT_TYPE_PERIODIC_TIMER       ## CONSUMES
 #
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
index 40f2f1f22766..525942a167b0 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
@@ -864,7 +864,7 @@ XhcResetHC (
     // Otherwise there may have the timeout case happened.
     // The below is a workaround to solve such problem.
     //
-    gBS->Stall (XHC_1_MILLISECOND);
+    gBS->Stall (PcdGet16 (PcdDelayXhciHCReset));
     Status = XhcWaitOpRegBit (Xhc, XHC_USBCMD_OFFSET, XHC_USBCMD_RESET, FALSE, Timeout);
 
     if (!EFI_ERROR (Status)) {
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index a91058e5b5df..d9e2e724df9e 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1148,6 +1148,11 @@
   # @Prompt Enable large address image loading.
   gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BOOLEAN|0x30001059
 
+  ## Indicates time delay for XHCI registers access after it issues HCRST.
+  # Default is 2000, it represent delay is 2 ms.
+  # @Prompt Delay access XHCI register after it issues HCRST (us)
+  gEfiMdeModulePkgTokenSpaceGuid.PcdDelayXhciHCReset|2000|UINT16|0x30001060
+
 [PcdsFixedAtBuild, PcdsPatchableInModule]
   ## Dynamic type PCD can be registered callback function for Pcd setting action.
   #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of callback function
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117758): https://edk2.groups.io/g/devel/message/117758
Mute This Topic: https://groups.io/mt/105531079/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* [edk2-devel] 回复: [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST
  2024-04-15  6:33 ` [edk2-devel] [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST Xianglei Cai
@ 2024-04-15  6:36   ` gaoliming via groups.io
  2024-04-18  9:00     ` [edk2-devel] " Xianglei Cai
  0 siblings, 1 reply; 5+ messages in thread
From: gaoliming via groups.io @ 2024-04-15  6:36 UTC (permalink / raw)
  To: 'Xianglei Cai', devel
  Cc: 'Ray Ni', 'Krzysztof Lewandowski',
	'Jenny Huang', 'More Shih', 'Ian Chiu'

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: Xianglei Cai <xianglei.cai@intel.com>
> 发送时间: 2024年4月15日 14:34
> 收件人: devel@edk2.groups.io
> 抄送: Xianglei Cai <xianglei.cai@intel.com>; Ray Ni <ray.ni@intel.com>;
> Liming Gao <gaoliming@byosoft.com.cn>; Krzysztof Lewandowski
> <krzysztof.lewandowski@intel.com>; Jenny Huang <jenny.huang@intel.com>;
> More Shih <more.shih@intel.com>; Ian Chiu <ian.chiu@intel.com>
> 主题: [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of
> HCRST
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=4727
> 
> Recently some of XHCI host controllers require to have
> extra 1ms delay before accessing any MMIO register
> during reset. PHY transition from P3 to P0 can take
> around 1.3ms and the xHCI reset can take around 1.5ms.
> Add PCD to control the delay, the default is 2 ms.
> 
> Cc: Ray Ni                   <ray.ni@intel.com>
> Cc: Liming Gao               <gaoliming@byosoft.com.cn>
> Cc: Krzysztof Lewandowski    <krzysztof.lewandowski@intel.com>
> Cc: Jenny Huang              <jenny.huang@intel.com>
> Cc: More Shih                <more.shih@intel.com>
> Cc: Ian Chiu                 <ian.chiu@intel.com>
> Signed-off-by: Xianglei Cai <xianglei.cai@intel.com>
> Reviewed-by: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h      | 1 +
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf | 4 ++++
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c   | 2 +-
>  MdeModulePkg/MdeModulePkg.dec            | 5 +++++
>  4 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> index 44016758724c..c9a12095c29e 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> @@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include <Library/DebugLib.h>
>  #include <Library/ReportStatusCodeLib.h>
>  #include <Library/TimerLib.h>
> +#include <Library/PcdLib.h>
> 
>  #include <IndustryStandard/Pci.h>
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> index 18ef87916ae4..e6c1ac8a6346 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> @@ -56,6 +56,7 @@
>    DebugLib
>    ReportStatusCodeLib
>    TimerLib
> +  PcdLib
> 
>  [Guids]
>    gEfiEventExitBootServicesGuid                 ##
> SOMETIMES_CONSUMES ## Event
> @@ -64,6 +65,9 @@
>    gEfiPciIoProtocolGuid                         ## TO_START
>    gEfiUsb2HcProtocolGuid                        ## BY_START
> 
> +[Pcd]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdDelayXhciHCReset  ##
> CONSUMES
> +
>  # [Event]
>  # EVENT_TYPE_PERIODIC_TIMER       ## CONSUMES
>  #
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> index 40f2f1f22766..525942a167b0 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> @@ -864,7 +864,7 @@ XhcResetHC (
>      // Otherwise there may have the timeout case happened.
>      // The below is a workaround to solve such problem.
>      //
> -    gBS->Stall (XHC_1_MILLISECOND);
> +    gBS->Stall (PcdGet16 (PcdDelayXhciHCReset));
>      Status = XhcWaitOpRegBit (Xhc, XHC_USBCMD_OFFSET,
> XHC_USBCMD_RESET, FALSE, Timeout);
> 
>      if (!EFI_ERROR (Status)) {
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec
> index a91058e5b5df..d9e2e724df9e 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -1148,6 +1148,11 @@
>    # @Prompt Enable large address image loading.
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BOO
> LEAN|0x30001059
> 
> +  ## Indicates time delay for XHCI registers access after it issues
HCRST.
> +  # Default is 2000, it represent delay is 2 ms.
> +  # @Prompt Delay access XHCI register after it issues HCRST (us)
> +
> gEfiMdeModulePkgTokenSpaceGuid.PcdDelayXhciHCReset|2000|UINT16|0x3
> 0001060
> +
>  [PcdsFixedAtBuild, PcdsPatchableInModule]
>    ## Dynamic type PCD can be registered callback function for Pcd setting
> action.
>    #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum
> number of callback function
> --
> 2.42.0.windows.2





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117760): https://edk2.groups.io/g/devel/message/117760
Mute This Topic: https://groups.io/mt/105531090/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [edk2-devel] [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST
  2024-04-15  6:36   ` [edk2-devel] 回复: " gaoliming via groups.io
@ 2024-04-18  9:00     ` Xianglei Cai
  2024-04-25  9:58       ` Xianglei Cai
  0 siblings, 1 reply; 5+ messages in thread
From: Xianglei Cai @ 2024-04-18  9:00 UTC (permalink / raw)
  To: gaoliming, devel@edk2.groups.io
  Cc: Ni, Ray, Lewandowski, Krzysztof, Huang, Jenny, Shih, More,
	Chiu, Ian

Hi Liming,

Could you help pick the change to master branch?

Thanks,
Xianglei

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn> 
Sent: Monday, April 15, 2024 2:36 PM
To: Cai, Xianglei <xianglei.cai@intel.com>; devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com>; Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com>; Chiu, Ian <Ian.chiu@intel.com>
Subject: 回复: [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: Xianglei Cai <xianglei.cai@intel.com>
> 发送时间: 2024年4月15日 14:34
> 收件人: devel@edk2.groups.io
> 抄送: Xianglei Cai <xianglei.cai@intel.com>; Ray Ni <ray.ni@intel.com>; 
> Liming Gao <gaoliming@byosoft.com.cn>; Krzysztof Lewandowski 
> <krzysztof.lewandowski@intel.com>; Jenny Huang 
> <jenny.huang@intel.com>; More Shih <more.shih@intel.com>; Ian Chiu 
> <ian.chiu@intel.com>
> 主题: [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of 
> HCRST
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=4727
> 
> Recently some of XHCI host controllers require to have extra 1ms delay 
> before accessing any MMIO register during reset. PHY transition from 
> P3 to P0 can take around 1.3ms and the xHCI reset can take around 
> 1.5ms.
> Add PCD to control the delay, the default is 2 ms.
> 
> Cc: Ray Ni                   <ray.ni@intel.com>
> Cc: Liming Gao               <gaoliming@byosoft.com.cn>
> Cc: Krzysztof Lewandowski    <krzysztof.lewandowski@intel.com>
> Cc: Jenny Huang              <jenny.huang@intel.com>
> Cc: More Shih                <more.shih@intel.com>
> Cc: Ian Chiu                 <ian.chiu@intel.com>
> Signed-off-by: Xianglei Cai <xianglei.cai@intel.com>
> Reviewed-by: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h      | 1 +
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf | 4 ++++
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c   | 2 +-
>  MdeModulePkg/MdeModulePkg.dec            | 5 +++++
>  4 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> index 44016758724c..c9a12095c29e 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> @@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  
> #include <Library/DebugLib.h>  #include 
> <Library/ReportStatusCodeLib.h>  #include <Library/TimerLib.h>
> +#include <Library/PcdLib.h>
> 
>  #include <IndustryStandard/Pci.h>
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> index 18ef87916ae4..e6c1ac8a6346 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> @@ -56,6 +56,7 @@
>    DebugLib
>    ReportStatusCodeLib
>    TimerLib
> +  PcdLib
> 
>  [Guids]
>    gEfiEventExitBootServicesGuid                 ##
> SOMETIMES_CONSUMES ## Event
> @@ -64,6 +65,9 @@
>    gEfiPciIoProtocolGuid                         ## TO_START
>    gEfiUsb2HcProtocolGuid                        ## BY_START
> 
> +[Pcd]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdDelayXhciHCReset  ##
> CONSUMES
> +
>  # [Event]
>  # EVENT_TYPE_PERIODIC_TIMER       ## CONSUMES
>  #
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> index 40f2f1f22766..525942a167b0 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> @@ -864,7 +864,7 @@ XhcResetHC (
>      // Otherwise there may have the timeout case happened.
>      // The below is a workaround to solve such problem.
>      //
> -    gBS->Stall (XHC_1_MILLISECOND);
> +    gBS->Stall (PcdGet16 (PcdDelayXhciHCReset));
>      Status = XhcWaitOpRegBit (Xhc, XHC_USBCMD_OFFSET, 
> XHC_USBCMD_RESET, FALSE, Timeout);
> 
>      if (!EFI_ERROR (Status)) {
> diff --git a/MdeModulePkg/MdeModulePkg.dec 
> b/MdeModulePkg/MdeModulePkg.dec index a91058e5b5df..d9e2e724df9e 
> 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -1148,6 +1148,11 @@
>    # @Prompt Enable large address image loading.
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BOO
> LEAN|0x30001059
> 
> +  ## Indicates time delay for XHCI registers access after it issues
HCRST.
> +  # Default is 2000, it represent delay is 2 ms.
> +  # @Prompt Delay access XHCI register after it issues HCRST (us)
> +
> gEfiMdeModulePkgTokenSpaceGuid.PcdDelayXhciHCReset|2000|UINT16|0x3
> 0001060
> +
>  [PcdsFixedAtBuild, PcdsPatchableInModule]
>    ## Dynamic type PCD can be registered callback function for Pcd 
> setting action.
>    #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum 
> number of callback function
> --
> 2.42.0.windows.2





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117969): https://edk2.groups.io/g/devel/message/117969
Mute This Topic: https://groups.io/mt/105594498/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [edk2-devel] [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST
  2024-04-18  9:00     ` [edk2-devel] " Xianglei Cai
@ 2024-04-25  9:58       ` Xianglei Cai
  2024-05-07  1:25         ` Xianglei Cai
  0 siblings, 1 reply; 5+ messages in thread
From: Xianglei Cai @ 2024-04-25  9:58 UTC (permalink / raw)
  To: gaoliming, devel@edk2.groups.io
  Cc: Ni, Ray, Lewandowski, Krzysztof, Huang, Jenny, Shih, More,
	Chiu, Ian

Hi @gaoliming,

Could you provide the eta when the patch can be merged?

Thanks,
Xianglei

-----Original Message-----
From: Cai, Xianglei 
Sent: Thursday, April 18, 2024 5:00 PM
To: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com>; Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com>; Chiu, Ian <Ian.chiu@intel.com>
Subject: RE: [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST

Hi Liming,

Could you help pick the change to master branch?

Thanks,
Xianglei

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn>
Sent: Monday, April 15, 2024 2:36 PM
To: Cai, Xianglei <xianglei.cai@intel.com>; devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com>; Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com>; Chiu, Ian <Ian.chiu@intel.com>
Subject: 回复: [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: Xianglei Cai <xianglei.cai@intel.com>
> 发送时间: 2024年4月15日 14:34
> 收件人: devel@edk2.groups.io
> 抄送: Xianglei Cai <xianglei.cai@intel.com>; Ray Ni <ray.ni@intel.com>; 
> Liming Gao <gaoliming@byosoft.com.cn>; Krzysztof Lewandowski 
> <krzysztof.lewandowski@intel.com>; Jenny Huang 
> <jenny.huang@intel.com>; More Shih <more.shih@intel.com>; Ian Chiu 
> <ian.chiu@intel.com>
> 主题: [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of 
> HCRST
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=4727
> 
> Recently some of XHCI host controllers require to have extra 1ms delay 
> before accessing any MMIO register during reset. PHY transition from
> P3 to P0 can take around 1.3ms and the xHCI reset can take around 
> 1.5ms.
> Add PCD to control the delay, the default is 2 ms.
> 
> Cc: Ray Ni                   <ray.ni@intel.com>
> Cc: Liming Gao               <gaoliming@byosoft.com.cn>
> Cc: Krzysztof Lewandowski    <krzysztof.lewandowski@intel.com>
> Cc: Jenny Huang              <jenny.huang@intel.com>
> Cc: More Shih                <more.shih@intel.com>
> Cc: Ian Chiu                 <ian.chiu@intel.com>
> Signed-off-by: Xianglei Cai <xianglei.cai@intel.com>
> Reviewed-by: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h      | 1 +
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf | 4 ++++
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c   | 2 +-
>  MdeModulePkg/MdeModulePkg.dec            | 5 +++++
>  4 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> index 44016758724c..c9a12095c29e 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> @@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent 
> #include <Library/DebugLib.h>  #include 
> <Library/ReportStatusCodeLib.h>  #include <Library/TimerLib.h>
> +#include <Library/PcdLib.h>
> 
>  #include <IndustryStandard/Pci.h>
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> index 18ef87916ae4..e6c1ac8a6346 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> @@ -56,6 +56,7 @@
>    DebugLib
>    ReportStatusCodeLib
>    TimerLib
> +  PcdLib
> 
>  [Guids]
>    gEfiEventExitBootServicesGuid                 ##
> SOMETIMES_CONSUMES ## Event
> @@ -64,6 +65,9 @@
>    gEfiPciIoProtocolGuid                         ## TO_START
>    gEfiUsb2HcProtocolGuid                        ## BY_START
> 
> +[Pcd]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdDelayXhciHCReset  ##
> CONSUMES
> +
>  # [Event]
>  # EVENT_TYPE_PERIODIC_TIMER       ## CONSUMES
>  #
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> index 40f2f1f22766..525942a167b0 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> @@ -864,7 +864,7 @@ XhcResetHC (
>      // Otherwise there may have the timeout case happened.
>      // The below is a workaround to solve such problem.
>      //
> -    gBS->Stall (XHC_1_MILLISECOND);
> +    gBS->Stall (PcdGet16 (PcdDelayXhciHCReset));
>      Status = XhcWaitOpRegBit (Xhc, XHC_USBCMD_OFFSET, 
> XHC_USBCMD_RESET, FALSE, Timeout);
> 
>      if (!EFI_ERROR (Status)) {
> diff --git a/MdeModulePkg/MdeModulePkg.dec 
> b/MdeModulePkg/MdeModulePkg.dec index a91058e5b5df..d9e2e724df9e
> 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -1148,6 +1148,11 @@
>    # @Prompt Enable large address image loading.
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BOO
> LEAN|0x30001059
> 
> +  ## Indicates time delay for XHCI registers access after it issues
HCRST.
> +  # Default is 2000, it represent delay is 2 ms.
> +  # @Prompt Delay access XHCI register after it issues HCRST (us)
> +
> gEfiMdeModulePkgTokenSpaceGuid.PcdDelayXhciHCReset|2000|UINT16|0x3
> 0001060
> +
>  [PcdsFixedAtBuild, PcdsPatchableInModule]
>    ## Dynamic type PCD can be registered callback function for Pcd 
> setting action.
>    #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum 
> number of callback function
> --
> 2.42.0.windows.2





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118285): https://edk2.groups.io/g/devel/message/118285
Mute This Topic: https://groups.io/mt/105594498/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [edk2-devel] [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST
  2024-04-25  9:58       ` Xianglei Cai
@ 2024-05-07  1:25         ` Xianglei Cai
  0 siblings, 0 replies; 5+ messages in thread
From: Xianglei Cai @ 2024-05-07  1:25 UTC (permalink / raw)
  To: gaoliming, devel@edk2.groups.io
  Cc: Ni, Ray, Lewandowski, Krzysztof, Huang, Jenny, Shih, More,
	Chiu, Ian

Hi Liming,

I create one pull request: https://github.com/tianocore/edk2/pull/5630.
Is it helpful for merge the change?

Thanks,
Xianglei

-----Original Message-----
From: Cai, Xianglei 
Sent: Thursday, April 25, 2024 5:59 PM
To: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com>; Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com>; Chiu, Ian <Ian.chiu@intel.com>
Subject: RE: [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST

Hi @gaoliming,

Could you provide the eta when the patch can be merged?

Thanks,
Xianglei

-----Original Message-----
From: Cai, Xianglei
Sent: Thursday, April 18, 2024 5:00 PM
To: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com>; Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com>; Chiu, Ian <Ian.chiu@intel.com>
Subject: RE: [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST

Hi Liming,

Could you help pick the change to master branch?

Thanks,
Xianglei

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn>
Sent: Monday, April 15, 2024 2:36 PM
To: Cai, Xianglei <xianglei.cai@intel.com>; devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com>; Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com>; Chiu, Ian <Ian.chiu@intel.com>
Subject: 回复: [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: Xianglei Cai <xianglei.cai@intel.com>
> 发送时间: 2024年4月15日 14:34
> 收件人: devel@edk2.groups.io
> 抄送: Xianglei Cai <xianglei.cai@intel.com>; Ray Ni <ray.ni@intel.com>; 
> Liming Gao <gaoliming@byosoft.com.cn>; Krzysztof Lewandowski 
> <krzysztof.lewandowski@intel.com>; Jenny Huang 
> <jenny.huang@intel.com>; More Shih <more.shih@intel.com>; Ian Chiu 
> <ian.chiu@intel.com>
> 主题: [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of 
> HCRST
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=4727
> 
> Recently some of XHCI host controllers require to have extra 1ms delay 
> before accessing any MMIO register during reset. PHY transition from
> P3 to P0 can take around 1.3ms and the xHCI reset can take around 
> 1.5ms.
> Add PCD to control the delay, the default is 2 ms.
> 
> Cc: Ray Ni                   <ray.ni@intel.com>
> Cc: Liming Gao               <gaoliming@byosoft.com.cn>
> Cc: Krzysztof Lewandowski    <krzysztof.lewandowski@intel.com>
> Cc: Jenny Huang              <jenny.huang@intel.com>
> Cc: More Shih                <more.shih@intel.com>
> Cc: Ian Chiu                 <ian.chiu@intel.com>
> Signed-off-by: Xianglei Cai <xianglei.cai@intel.com>
> Reviewed-by: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h      | 1 +
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf | 4 ++++
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c   | 2 +-
>  MdeModulePkg/MdeModulePkg.dec            | 5 +++++
>  4 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> index 44016758724c..c9a12095c29e 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> @@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent 
> #include <Library/DebugLib.h>  #include 
> <Library/ReportStatusCodeLib.h>  #include <Library/TimerLib.h>
> +#include <Library/PcdLib.h>
> 
>  #include <IndustryStandard/Pci.h>
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> index 18ef87916ae4..e6c1ac8a6346 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> @@ -56,6 +56,7 @@
>    DebugLib
>    ReportStatusCodeLib
>    TimerLib
> +  PcdLib
> 
>  [Guids]
>    gEfiEventExitBootServicesGuid                 ##
> SOMETIMES_CONSUMES ## Event
> @@ -64,6 +65,9 @@
>    gEfiPciIoProtocolGuid                         ## TO_START
>    gEfiUsb2HcProtocolGuid                        ## BY_START
> 
> +[Pcd]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdDelayXhciHCReset  ##
> CONSUMES
> +
>  # [Event]
>  # EVENT_TYPE_PERIODIC_TIMER       ## CONSUMES
>  #
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> index 40f2f1f22766..525942a167b0 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> @@ -864,7 +864,7 @@ XhcResetHC (
>      // Otherwise there may have the timeout case happened.
>      // The below is a workaround to solve such problem.
>      //
> -    gBS->Stall (XHC_1_MILLISECOND);
> +    gBS->Stall (PcdGet16 (PcdDelayXhciHCReset));
>      Status = XhcWaitOpRegBit (Xhc, XHC_USBCMD_OFFSET, 
> XHC_USBCMD_RESET, FALSE, Timeout);
> 
>      if (!EFI_ERROR (Status)) {
> diff --git a/MdeModulePkg/MdeModulePkg.dec 
> b/MdeModulePkg/MdeModulePkg.dec index a91058e5b5df..d9e2e724df9e
> 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -1148,6 +1148,11 @@
>    # @Prompt Enable large address image loading.
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BOO
> LEAN|0x30001059
> 
> +  ## Indicates time delay for XHCI registers access after it issues
HCRST.
> +  # Default is 2000, it represent delay is 2 ms.
> +  # @Prompt Delay access XHCI register after it issues HCRST (us)
> +
> gEfiMdeModulePkgTokenSpaceGuid.PcdDelayXhciHCReset|2000|UINT16|0x3
> 0001060
> +
>  [PcdsFixedAtBuild, PcdsPatchableInModule]
>    ## Dynamic type PCD can be registered callback function for Pcd 
> setting action.
>    #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum 
> number of callback function
> --
> 2.42.0.windows.2





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118621): https://edk2.groups.io/g/devel/message/118621
Mute This Topic: https://groups.io/mt/105594498/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

end of thread, other threads:[~2024-05-07  1:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1713162827.git.xianglei.cai@intel.com>
2024-04-15  6:33 ` [edk2-devel] [PATCH V3 1/1] MdeModulePkg/XhciDxe: Add PCD for the delay of HCRST Xianglei Cai
2024-04-15  6:36   ` [edk2-devel] 回复: " gaoliming via groups.io
2024-04-18  9:00     ` [edk2-devel] " Xianglei Cai
2024-04-25  9:58       ` Xianglei Cai
2024-05-07  1:25         ` Xianglei Cai

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