diff --git a/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h b/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h index 33e976c4f3..54bb0467cc 100644 --- a/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h @@ -72,6 +72,7 @@ typedef enum ArchCommonObjectID { EArchCommonObjMemoryCacheInfo, ///< 44 - Memory Cache Info EArchCommonObjSpcrInfo, ///< 45 - Serial Terminal and Interrupt Info EArchCommonObjTpm2DeviceInfo, ///< 46 - TPM2 Device Info + EArchCommonObjMcfgPciConfigSpaceInfo, ///< 47 - MCFG PCI Configuration Space Info EArchCommonObjMax } EARCH_COMMON_OBJECT_ID; diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiMcfgLib/McfgGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiMcfgLib/McfgGenerator.c index 79a2f598f9..9925c63718 100644 --- a/DynamicTablesPkg/Library/Acpi/Common/AcpiMcfgLib/McfgGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiMcfgLib/McfgGenerator.c @@ -2,6 +2,7 @@ MCFG Table Generator Copyright (c) 2017 - 2019, ARM Limited. All rights reserved. + Copyright (C) 2025, Advanced Micro Devices, Inc. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): @@ -25,9 +26,9 @@ /** ARM standard MCFG Generator Requirements: - The following Configuration Manager Object(s) are required by - this Generator: - - EArchCommonObjPciConfigSpaceInfo + This Generator requires the following Configuration Manager Object(s): + - EArchCommonObjMcfgPciConfigSpaceInfo (primary, preferred) + - EArchCommonObjPciConfigSpaceInfo (secondary, for backward compatibility) */ #pragma pack(1) @@ -56,6 +57,14 @@ GET_OBJECT_LIST ( CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO ); +/** Retrieve the MCFG PCI Configuration Space Information. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceArchCommon, + EArchCommonObjMcfgPciConfigSpaceInfo, + CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO + ); + /** Add the PCI Enhanced Configuration Space Information to the MCFG Table. @param [in] Mcfg Pointer to MCFG Table. @@ -154,12 +163,22 @@ BuildMcfgTable ( } *Table = NULL; - Status = GetEArchCommonObjPciConfigSpaceInfo ( + Status = GetEArchCommonObjMcfgPciConfigSpaceInfo ( CfgMgrProtocol, CM_NULL_TOKEN, &PciConfigSpaceInfoList, &ConfigurationSpaceCount ); + if (Status == EFI_NOT_FOUND) { + // Fallback to the older object if the new one is not found. + Status = GetEArchCommonObjPciConfigSpaceInfo ( + CfgMgrProtocol, + CM_NULL_TOKEN, + &PciConfigSpaceInfoList, + &ConfigurationSpaceCount + ); + } + if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c index a0f00ce2fa..2ca1b1452e 100644 --- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c @@ -184,7 +184,8 @@ STATIC CONST CM_OBJ_PARSER CmArmGenericWatchdogInfoParser[] = { { "Flags", 4, "0x%x", NULL } }; -/** A parser for EArchCommonObjPciConfigSpaceInfo. +/** A parser for EArchCommonObjPciConfigSpaceInfo or + EArchCommonObjMcfgPciConfigSpaceInfo. */ STATIC CONST CM_OBJ_PARSER CmArchCommonPciConfigSpaceInfoParser[] = { { "BaseAddress", 8, "0x%llx", NULL }, @@ -930,6 +931,7 @@ STATIC CONST CM_OBJ_PARSER_ARRAY ArchCommonNamespaceObjectParser[] = { CM_PARSER_ADD_OBJECT (EArchCommonObjMemoryLatBwInfo, CmArchCommonMemoryLatBwInfo), CM_PARSER_ADD_OBJECT (EArchCommonObjMemoryCacheInfo, CmArchCommonMemoryCacheInfo), CM_PARSER_ADD_OBJECT (EArchCommonObjSpcrInfo, CmArchCommonObjSpcrInfoParser), + CM_PARSER_ADD_OBJECT (EArchCommonObjMcfgPciConfigSpaceInfo, CmArchCommonPciConfigSpaceInfoParser), CM_PARSER_ADD_OBJECT_RESERVED (EArchCommonObjMax) };