The BarExisted() function in "MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c" raises the TPL to TPL_HIGH_LEVEL before accessing PCI config space.
The PciExpressLib instance under "MdePkg/Library/BasePciExpressLib" -- serving the PCI config space access -- calls PcdGet64(PcdPciExpressBaseAddress) in turn, for each such call. The PcdGet64() function, when issued at TPL_HIGH_LEVEL, triggers an ASSERT(). PcdGet64() is based on a protocol in this UEFI phase, and protocol handler services are not allowed above TPL_NOTIFY (see Table 23 "TPL Restrictions" in the UEFI spec). Clone the library, and in a new constructor, cache the PCD in a global variable. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <[email protected]> Reviewed-by: Olivier Martin <[email protected]> --- MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf => ArmPlatformPkg/ArmVirtualizationPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf | 10 +++++----- {MdePkg/Library/BasePciExpressLib => ArmPlatformPkg/ArmVirtualizationPkg/Library/BaseCachingPciExpressLib}/PciExpressLib.c | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf b/ArmPlatformPkg/ArmVirtualizationPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf similarity index 74% copy from MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf copy to ArmPlatformPkg/ArmVirtualizationPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf index 4b14b5d..f6a346d 100644 --- a/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf @@ -18,15 +18,15 @@ [Defines] INF_VERSION = 0x00010005 - BASE_NAME = BasePciExpressLib - MODULE_UNI_FILE = BasePciExpressLib.uni - FILE_GUID = 287e50f4-a188-4699-b907-3e4080ca5688 + BASE_NAME = BaseCachingPciExpressLib + FILE_GUID = 3f3ffd80-04dc-4a2b-9d25-ecca55c2e520 MODULE_TYPE = BASE VERSION_STRING = 1.0 - LIBRARY_CLASS = PciExpressLib + LIBRARY_CLASS = PciExpressLib|DXE_DRIVER UEFI_DRIVER UEFI_APPLICATION + CONSTRUCTOR = PciExpressLibInitialize # -# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# VALID_ARCHITECTURES = ARM AARCH64 # [Sources] diff --git a/MdePkg/Library/BasePciExpressLib/PciExpressLib.c b/ArmPlatformPkg/ArmVirtualizationPkg/Library/BaseCachingPciExpressLib/PciExpressLib.c similarity index 96% copy from MdePkg/Library/BasePciExpressLib/PciExpressLib.c copy to ArmPlatformPkg/ArmVirtualizationPkg/Library/BaseCachingPciExpressLib/PciExpressLib.c index 61be009..f2eb038 100644 --- a/MdePkg/Library/BasePciExpressLib/PciExpressLib.c +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/BaseCachingPciExpressLib/PciExpressLib.c @@ -68,12 +68,22 @@ PciExpressRegisterForRuntimeAccess ( return RETURN_UNSUPPORTED; } +STATIC UINT64 mPciExpressBaseAddress; + +RETURN_STATUS +EFIAPI +PciExpressLibInitialize ( + VOID + ) +{ + mPciExpressBaseAddress = PcdGet64 (PcdPciExpressBaseAddress); + return RETURN_SUCCESS; +} + + /** Gets the base address of PCI Express. - This internal functions retrieves PCI Express Base Address via a PCD entry - PcdPciExpressBaseAddress. - @return The base address of PCI Express. **/ @@ -82,7 +92,7 @@ GetPciExpressBaseAddress ( VOID ) { - return (VOID*)(UINTN) PcdGet64 (PcdPciExpressBaseAddress); + return (VOID*)(UINTN) mPciExpressBaseAddress; } /** -- 1.8.3.1 ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
