diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h index 4401675872..c9a12095c2 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 #include #include +#include #include diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf index 18ef87916a..4ab986a019 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf @@ -45,6 +45,7 @@ [Packages] MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec [LibraryClasses] MemoryAllocationLib @@ -56,6 +57,7 @@ DebugLib ReportStatusCodeLib TimerLib + PcdLib [Guids] gEfiEventExitBootServicesGuid ## SOMETIMES_CONSUMES ## Event @@ -64,6 +66,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 40f2f1f227..525942a167 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 085370eae4..dba6fbe642 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -1154,6 +1154,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