* [PATCH 0/8] ConfigurationManagerProtocol update
@ 2020-07-31 16:19 Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 1/8] DynamicTablesPkg: Include BaseStackCheckLib Tomas Pilar (tpilar)
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Tomas Pilar (tpilar) @ 2020-07-31 16:19 UTC (permalink / raw)
To: devel; +Cc: Sami Mujawar, Alexei Fedorov
This patch series updates the configuration manager protocol
API to allow for configuration managers that dynamically allocate
memory when servicing calls from the Dynamic Tables framework.
Helper methods are provided in TableHelperLib to ensure
backwards compatibility with configuration managers that
do not allocate the memory that is provided to the caller.
Additional methods are provided to reduce the difficulty of
developing Dynamic Tables extensions and Configuration Managers.
The Dynamic Tables framework is simplified to use the new revision
of the protocol, while retaining backwards compatbility.
The refactoring was tested using the AcpiViewApp and the
Configuration Manager that is included in the JunoPkg, running
in the SbsaQemu platform. The resulting dump of the ACPI tables
is identical between a build that includes these patches and
a build without this patchset.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Tomas Pilar <tomas@nuviainc.com>
--
Tomas Pilar (8):
DynamicTablesPkg: Include BaseStackCheckLib
DynamicTablesPkg: Fold Namespaces into CmObjectId Enums
DynamicTablesPkg: Add ConfigurationManagerDumpApp
DynamicTablesPkg: Update ConfigurationManagerProtocol
DynamicTablesPkg: Add CfgMgrProtocol helper functions
DynamicTablesPkg/TableHelperLib: User friendly strings
DynamicTablesPkg: Simplify AddAcpiHeader, CfgMgrGetInfo
DynamicTablesPkg: Remove GET_OBJECT_LIST
.../ConfigurationManagerDumpApp.c | 69 ++
.../ConfigurationManagerDumpApp.inf | 41 +
.../DynamicTableFactoryDxe.c | 1 -
.../DynamicTableManagerDxe.c | 54 +-
DynamicTablesPkg/DynamicTablesPkg.dsc | 7 +
.../Include/ArmNameSpaceObjects.h | 3 +-
.../Include/ConfigurationManagerHelper.h | 126 --
.../Include/ConfigurationManagerNameSpace.h | 43 +
.../Include/ConfigurationManagerObject.h | 57 +-
.../Include/Library/TableHelperLib.h | 205 +++-
.../Protocol/ConfigurationManagerProtocol.h | 83 +-
.../Include/StandardNameSpaceObjects.h | 7 +-
.../Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c | 44 +-
.../Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c | 211 +---
.../Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c | 242 ++--
.../Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 1066 +++++------------
.../Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c | 312 ++---
.../Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c | 108 +-
.../Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 295 ++---
.../Acpi/Arm/AcpiRawLibArm/RawGenerator.c | 1 -
.../Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c | 45 +-
.../Acpi/Arm/AcpiSratLibArm/SratGenerator.c | 447 +++----
.../ConfigurationObjectStrings.c | 92 ++
.../Common/TableHelperLib/TableHelper.c | 468 ++++++--
.../Common/TableHelperLib/TableHelperLib.inf | 10 +-
25 files changed, 1766 insertions(+), 2271 deletions(-)
create mode 100644 DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c
create mode 100644 DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf
delete mode 100644 DynamicTablesPkg/Include/ConfigurationManagerHelper.h
create mode 100644 DynamicTablesPkg/Include/ConfigurationManagerNameSpace.h
create mode 100644 DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationObjectStrings.c
--
2.25.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/8] DynamicTablesPkg: Include BaseStackCheckLib
2020-07-31 16:19 [PATCH 0/8] ConfigurationManagerProtocol update Tomas Pilar (tpilar)
@ 2020-07-31 16:19 ` Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 2/8] DynamicTablesPkg: Fold Namespaces into CmObjectId Enums Tomas Pilar (tpilar)
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Tomas Pilar (tpilar) @ 2020-07-31 16:19 UTC (permalink / raw)
To: devel; +Cc: Sami Mujawar, Alexei Fedorov
In GCC10 the __stack_chk_guard global variable no longer exists,
the stack checking is done a different way. This patch includes the
BaseStackCheckLib as a NULL library which provides the global variable
explicitly. This fixes compilation with GCC10.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Tomas Pilar <tomas@nuviainc.com>
---
DynamicTablesPkg/DynamicTablesPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc b/DynamicTablesPkg/DynamicTablesPkg.dsc
index 02f04447ff..346fa8ccdd 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dsc
+++ b/DynamicTablesPkg/DynamicTablesPkg.dsc
@@ -33,6 +33,7 @@
[LibraryClasses.ARM, LibraryClasses.AARCH64]
NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+ NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
[Components.common]
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/8] DynamicTablesPkg: Fold Namespaces into CmObjectId Enums
2020-07-31 16:19 [PATCH 0/8] ConfigurationManagerProtocol update Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 1/8] DynamicTablesPkg: Include BaseStackCheckLib Tomas Pilar (tpilar)
@ 2020-07-31 16:19 ` Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 3/8] DynamicTablesPkg: Add ConfigurationManagerDumpApp Tomas Pilar (tpilar)
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Tomas Pilar (tpilar) @ 2020-07-31 16:19 UTC (permalink / raw)
To: devel; +Cc: Sami Mujawar, Alexei Fedorov
The enums for CmObjectIds defined in Dynamic Tables Framework
that are used to identify types of configuration manager objects
already include their namespaces in the symbols for enum values.
Namespace enum values are shifted up by NAMESPACE_BIT_SHIFT and
the enums tables for CmObjectIds are bitwise-ORed with their
corresponding namespace.
This means we no longer need to use macros to compose and decompose
CmObjectIds. The macros are adjusted so that they result in NOP.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Tomas Pilar <tomas@nuviainc.com>
---
.../Include/ArmNameSpaceObjects.h | 3 +-
.../Include/ConfigurationManagerNameSpace.h | 43 ++++++++++++++
.../Include/ConfigurationManagerObject.h | 57 ++++++++-----------
.../Include/StandardNameSpaceObjects.h | 7 ++-
4 files changed, 72 insertions(+), 38 deletions(-)
create mode 100644 DynamicTablesPkg/Include/ConfigurationManagerNameSpace.h
diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index 2f32696031..cf7846e024 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -14,6 +14,7 @@
#define ARM_NAMESPACE_OBJECTS_H_
#include <StandardNameSpaceObjects.h>
+#include <ConfigurationManagerNameSpace.h>
#pragma pack(1)
@@ -21,7 +22,7 @@
in the ARM Namespace
*/
typedef enum ArmObjectID {
- EArmObjReserved, ///< 0 - Reserved
+ EArmObjReserved = EObjNameSpaceArm, ///< 0 - Reserved, namespace starts at 0x10000000
EArmObjBootArchInfo, ///< 1 - Boot Architecture Info
EArmObjCpuInfo, ///< 2 - CPU Info
EArmObjPowerManagementProfileInfo, ///< 3 - Power Management Profile Info
diff --git a/DynamicTablesPkg/Include/ConfigurationManagerNameSpace.h b/DynamicTablesPkg/Include/ConfigurationManagerNameSpace.h
new file mode 100644
index 0000000000..acba77e2b3
--- /dev/null
+++ b/DynamicTablesPkg/Include/ConfigurationManagerNameSpace.h
@@ -0,0 +1,43 @@
+/** @file
+
+ Copyright (c) 2020, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef CONFIGURATION_MANAGER_NAMESPACE_H_
+#define CONFIGURATION_MANAGER_NAMESPACE_H_
+
+/** The EOBJECT_NAMESPACE_ID enum describes the defined namespaces
+ for the Configuration Manager Objects.
+
+ Description of Configuration Manager Object ID
+_______________________________________________________________________________
+|31 |30 |29 |28 || 27 | 26 | 25 | 24 || 23 | 22 | 21 | 20 || 19 | 18 | 17 | 16|
+-------------------------------------------------------------------------------
+| Name Space ID || 0 | 0 | 0 | 0 || 0 | 0 | 0 | 0 || 0 | 0 | 0 | 0|
+_______________________________________________________________________________
+
+Bits: [31:28] - Name Space ID
+ 0000 - Standard
+ 0001 - ARM
+ 1000 - Custom/OEM
+ All other values are reserved.
+
+Bits: [27:16] - Reserved.
+_______________________________________________________________________________
+|15 |14 |13 |12 || 11 | 10 | 9 | 8 || 7 | 6 | 5 | 4 || 3 | 2 | 1 | 0|
+-------------------------------------------------------------------------------
+| 0 | 0 | 0 | 0 || 0 | 0 | 0 | 0 || Object ID |
+_______________________________________________________________________________
+
+Bits: [15:8] - Are reserved and must be zero.
+Bits: [7:0] - Object ID
+*/
+typedef enum ObjectNameSpaceID {
+ EObjNameSpaceStandard = 0x00000000, ///< Standard Objects Namespace
+ EObjNameSpaceArm = 0x10000000, ///< ARM Objects Namespace
+ EObjNameSpaceOem = 0x80000000, ///< OEM Objects Namespace
+} EOBJECT_NAMESPACE_ID;
+
+#endif
diff --git a/DynamicTablesPkg/Include/ConfigurationManagerObject.h b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
index b0d3e709ec..9d39bd8a9e 100644
--- a/DynamicTablesPkg/Include/ConfigurationManagerObject.h
+++ b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
@@ -86,25 +86,11 @@ typedef UINT32 CM_OBJECT_ID;
/** A mask for Object ID
*/
-#define OBJECT_ID_MASK 0xFF
+#define OBJECT_ID_MASK 0x000000FF
/** A mask for Namespace ID
*/
-#define NAMESPACE_ID_MASK 0xF
-
-/** Starting bit position for Namespace ID
-*/
-#define NAMESPACE_ID_BIT_SHIFT 28
-
-/** The EOBJECT_NAMESPACE_ID enum describes the defined namespaces
- for the Configuration Manager Objects.
-*/
-typedef enum ObjectNameSpaceID {
- EObjNameSpaceStandard, ///< Standard Objects Namespace
- EObjNameSpaceArm, ///< ARM Objects Namespace
- EObjNameSpaceOem = 0x8, ///< OEM Objects Namespace
- EObjNameSpaceMax
-} EOBJECT_NAMESPACE_ID;
+#define NAMESPACE_ID_MASK 0xF0000000
/** A descriptor for Configuration Manager Objects.
@@ -133,19 +119,21 @@ typedef struct CmObjDescriptor {
@retval Returns the Namespace ID corresponding to the CmObjectID.
**/
-#define GET_CM_NAMESPACE_ID(CmObjectId) \
- (((CmObjectId) >> NAMESPACE_ID_BIT_SHIFT) & \
- NAMESPACE_ID_MASK)
+#define GET_CM_NAMESPACE_ID(CmObjectId) ((CmObjectId) & NAMESPACE_ID_MASK)
+
+/** Deprecated, use just CmObjectId.
-/** This macro returns the Object ID from the CmObjectID.
+ This macro returns the Object ID from the CmObjectID.
@param [in] CmObjectId The Configuration Manager Object ID.
@retval Returns the Object ID corresponding to the CmObjectID.
**/
-#define GET_CM_OBJECT_ID(CmObjectId) ((CmObjectId) & OBJECT_ID_MASK)
+#define GET_CM_OBJECT_ID(CmObjectId) (CmObjectId)
-/** This macro returns a Configuration Manager Object ID
+/** Deprecated. Use just ObjectId.
+
+ This macro returns a Configuration Manager Object ID
from the NameSpace ID and the ObjectID.
@param [in] NameSpaceId The namespace ID for the Object.
@@ -153,38 +141,39 @@ typedef struct CmObjDescriptor {
@retval Returns the Configuration Manager Object ID.
**/
-#define CREATE_CM_OBJECT_ID(NameSpaceId, ObjectId) \
- ((((NameSpaceId) & NAMESPACE_ID_MASK) << NAMESPACE_ID_BIT_SHIFT) | \
- ((ObjectId) & OBJECT_ID_MASK))
+#define CREATE_CM_OBJECT_ID(NameSpaceId, ObjectId) (ObjectId)
+
+/** Deprecated, use just ObjectId.
-/** This macro returns a Configuration Manager Object ID
+ This macro returns a Configuration Manager Object ID
in the Standard Object Namespace.
@param [in] ObjectId The Object ID.
@retval Returns a Standard Configuration Manager Object ID.
**/
-#define CREATE_CM_STD_OBJECT_ID(ObjectId) \
- (CREATE_CM_OBJECT_ID (EObjNameSpaceStandard, ObjectId))
+#define CREATE_CM_STD_OBJECT_ID(ObjectId) (ObjectId)
-/** This macro returns a Configuration Manager Object ID
+/** Deprecated, use just ObjectId.
+
+ This macro returns a Configuration Manager Object ID
in the ARM Object Namespace.
@param [in] ObjectId The Object ID.
@retval Returns an ARM Configuration Manager Object ID.
**/
-#define CREATE_CM_ARM_OBJECT_ID(ObjectId) \
- (CREATE_CM_OBJECT_ID (EObjNameSpaceArm, ObjectId))
+#define CREATE_CM_ARM_OBJECT_ID(ObjectId) (ObjectId)
+
+/** Deprecated, use just ObjectId.
-/** This macro returns a Configuration Manager Object ID
+ This macro returns a Configuration Manager Object ID
in the OEM Object Namespace.
@param [in] ObjectId The Object ID.
@retval Returns an OEM Configuration Manager Object ID.
**/
-#define CREATE_CM_OEM_OBJECT_ID(ObjectId) \
- (CREATE_CM_OBJECT_ID (EObjNameSpaceOem, ObjectId))
+#define CREATE_CM_OEM_OBJECT_ID(ObjectId) (ObjectId)
#endif // CONFIGURATION_MANAGER_OBJECT_H_
diff --git a/DynamicTablesPkg/Include/StandardNameSpaceObjects.h b/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
index 0ba6b16369..053ef937a4 100644
--- a/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
@@ -15,6 +15,7 @@
#include <AcpiTableGenerator.h>
#include <SmbiosTableGenerator.h>
+#include <ConfigurationManagerNameSpace.h>
#pragma pack(1)
@@ -44,9 +45,9 @@ typedef UINTN CM_OBJECT_TOKEN;
in the Standard Namespace.
*/
typedef enum StdObjectID {
- EStdObjCfgMgrInfo = 0x00000000, ///< 0 - Configuration Manager Info
- EStdObjAcpiTableList, ///< 1 - ACPI table Info List
- EStdObjSmbiosTableList, ///< 2 - SMBIOS table Info List
+ EStdObjCfgMgrInfo = EObjNameSpaceStandard, ///< 0 - Configuration Manager Info, namespace starts at 0
+ EStdObjAcpiTableList, ///< 1 - ACPI table Info List
+ EStdObjSmbiosTableList, ///< 2 - SMBIOS table Info List
EStdObjMax
} ESTD_OBJECT_ID;
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/8] DynamicTablesPkg: Add ConfigurationManagerDumpApp
2020-07-31 16:19 [PATCH 0/8] ConfigurationManagerProtocol update Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 1/8] DynamicTablesPkg: Include BaseStackCheckLib Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 2/8] DynamicTablesPkg: Fold Namespaces into CmObjectId Enums Tomas Pilar (tpilar)
@ 2020-07-31 16:19 ` Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 4/8] DynamicTablesPkg: Update ConfigurationManagerProtocol Tomas Pilar (tpilar)
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Tomas Pilar (tpilar) @ 2020-07-31 16:19 UTC (permalink / raw)
To: devel; +Cc: Sami Mujawar, Alexei Fedorov
Simple application to dump the contents of the configuration
manager loaded in the platform to the screen.
There is no provision in the ConfigurationManagerProtocol for
informing consumers of the contents of the database, so the app
scans through the known namespaces using the GetObject method.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Tomas Pilar <tomas@nuviainc.com>
---
.../ConfigurationManagerDumpApp.c | 76 +++++++++++++++++++
.../ConfigurationManagerDumpApp.h | 8 ++
.../ConfigurationManagerDumpApp.inf | 42 ++++++++++
.../ConfigurationObjectStrings.c | 50 ++++++++++++
DynamicTablesPkg/DynamicTablesPkg.dsc | 6 ++
5 files changed, 182 insertions(+)
create mode 100644 DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c
create mode 100644 DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.h
create mode 100644 DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf
create mode 100644 DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationObjectStrings.c
diff --git a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c
new file mode 100644
index 0000000000..15936c78c1
--- /dev/null
+++ b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c
@@ -0,0 +1,76 @@
+#include <Uefi.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+
+#include "ConfigurationManagerDumpApp.h"
+
+EDKII_CONFIGURATION_MANAGER_PROTOCOL *mCfgMgr;
+
+EFI_STATUS
+EFIAPI
+UefiMain(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE * SystemTable
+ )
+{
+ EFI_STATUS Status = gBS->LocateProtocol (
+ &gEdkiiConfigurationManagerProtocolGuid, NULL, (VOID **)&mCfgMgr);
+
+ UINTN ObjectId;
+ CM_OBJ_DESCRIPTOR CmObject;
+ UINTN Count = 0;
+
+
+ if (EFI_ERROR(Status)) {
+ Print(L"No Configuration Manager installed!\n");
+ return EFI_UNSUPPORTED;
+ }
+
+ for (ObjectId = EObjNameSpaceStandard; ObjectId < EStdObjMax; ObjectId++) {
+ Status = mCfgMgr->GetObject (mCfgMgr, ObjectId, CM_NULL_TOKEN, &CmObject);
+ if (EFI_ERROR(Status)) {
+ continue;
+ }
+
+ Print (
+ L"<%s>::<%s>\n",
+ ObjectNameSpaceString[EObjNameSpaceStandard],
+ StdObjectString[ObjectId - EObjNameSpaceStandard]);
+
+ Print (
+ L"Id=%x Size=0x%x at=%p count=%d\n",
+ CmObject.ObjectId,
+ CmObject.Size,
+ CmObject.Count,
+ CmObject.Count);
+
+ Count++;
+ }
+
+ for (ObjectId = EObjNameSpaceArm; ObjectId < EArmObjMax; ObjectId++) {
+ Status = mCfgMgr->GetObject (mCfgMgr, ObjectId, CM_NULL_TOKEN, &CmObject);
+ if (EFI_ERROR(Status)) {
+ continue;
+ }
+
+ Print (
+ L"<%s>::<%s>\n",
+ ObjectNameSpaceString[EObjNameSpaceArm],
+ ArmObjectString[ObjectId - EObjNameSpaceArm]);
+
+ Print (
+ L"Id=%x Size=0x%x at=%p count=%d\n",
+ CmObject.ObjectId,
+ CmObject.Size,
+ CmObject.Count,
+ CmObject.Count);
+
+ Count++;
+ }
+
+ Print(L"Found %d objects\n", Count);
+ return EFI_SUCCESS;
+}
+
+
diff --git a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.h b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.h
new file mode 100644
index 0000000000..5017d55b4a
--- /dev/null
+++ b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.h
@@ -0,0 +1,8 @@
+#ifndef CONFIGURATION_MANAGER_DUMP_APP_H_
+#define CONFIGURATION_MANAGER_DUMP_APP_H_
+
+extern CHAR16 *ArmObjectString[];
+extern CHAR16 *ObjectNameSpaceString[];
+extern CHAR16 *StdObjectString[];
+
+#endif
diff --git a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf
new file mode 100644
index 0000000000..9f8beb916d
--- /dev/null
+++ b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf
@@ -0,0 +1,42 @@
+## @file
+# Application that will dump the contents of the configuration
+# manager.
+#
+# Copyright (c) 2020, ARM Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION = 0x00010019
+ BASE_NAME = ConfigurationManagerDumpApp
+ FILE_GUID = 1E12FA81-8465-4D78-918F-735DB8CB828B
+ MODULE_TYPE = UEFI_APPLICATION
+ VERSION_STRING = 1.0
+ ENTRY_POINT = UefiMain
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = ARM AARCH64
+#
+
+[Sources]
+ ConfigurationManagerDumpApp.c
+ ConfigurationManagerDumpApp.h
+ ConfigurationObjectStrings.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ DynamicTablesPkg/DynamicTablesPkg.dec
+
+[LibraryClasses]
+ UefiLib
+ UefiBootServicesTableLib
+ UefiApplicationEntryPoint
+
+[Protocols]
+ gEdkiiConfigurationManagerProtocolGuid # PROTOCOL PRODUCES
+
+
diff --git a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationObjectStrings.c b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationObjectStrings.c
new file mode 100644
index 0000000000..ad8dbb6354
--- /dev/null
+++ b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationObjectStrings.c
@@ -0,0 +1,50 @@
+
+CHAR16 *ArmObjectString[] = {
+ L"Reserved",
+ L"Boot Architecture Info",
+ L"CPU Info",
+ L"Power Management Profile Info",
+ L"GIC CPU Interface Info",
+ L"GIC Distributor Info",
+ L"GIC MSI Frame Info",
+ L"GIC Redistributor Info",
+ L"GIC ITS Info",
+ L"Serial Console Port Info",
+ L"Serial Debug Port Info",
+ L"Generic Timer Info",
+ L"Platform GT Block Info",
+ L"Generic Timer Block Frame Info",
+ L"Platform Generic Watchdog",
+ L"PCI Configuration Space Info",
+ L"Hypervisor Vendor Id",
+ L"Fixed feature flags for FADT",
+ L"ITS Group",
+ L"Named Component",
+ L"Root Complex",
+ L"SMMUv1 or SMMUv2",
+ L"SMMUv3",
+ L"PMCG",
+ L"GIC ITS Identifier Array",
+ L"ID Mapping Array",
+ L"SMMU Interrupt Array",
+ L"Processor Hierarchy Info",
+ L"Cache Info",
+ L"Processor Node ID Info",
+ L"CM Object Reference",
+ L"Memory Affinity Info",
+ L"Device Handle Acpi",
+ L"Device Handle Pci",
+ L"Generic Initiator Affinity"
+};
+
+CHAR16 *ObjectNameSpaceString[] = {
+ L"Standard Objects Namespace",
+ L"ARM Objects Namespace",
+ L"OEM Objects Namespace"
+};
+
+CHAR16 *StdObjectString[] = {
+ L"Configuration Manager Info",
+ L"ACPI table Info List",
+ L"SMBIOS table Info List"
+};
diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc b/DynamicTablesPkg/DynamicTablesPkg.dsc
index 346fa8ccdd..367e06a855 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dsc
+++ b/DynamicTablesPkg/DynamicTablesPkg.dsc
@@ -30,6 +30,11 @@
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+
[LibraryClasses.ARM, LibraryClasses.AARCH64]
NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
@@ -38,6 +43,7 @@
[Components.common]
DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
+ DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf
[BuildOptions]
*_*_*_CC_FLAGS = -DDISABLE_NEW_DEPRECATED_INTERFACES
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/8] DynamicTablesPkg: Update ConfigurationManagerProtocol
2020-07-31 16:19 [PATCH 0/8] ConfigurationManagerProtocol update Tomas Pilar (tpilar)
` (2 preceding siblings ...)
2020-07-31 16:19 ` [PATCH 3/8] DynamicTablesPkg: Add ConfigurationManagerDumpApp Tomas Pilar (tpilar)
@ 2020-07-31 16:19 ` Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 5/8] DynamicTablesPkg: Add CfgMgrProtocol helper functions Tomas Pilar (tpilar)
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Tomas Pilar (tpilar) @ 2020-07-31 16:19 UTC (permalink / raw)
To: devel; +Cc: Sami Mujawar, Alexei Fedorov
The Configuration Manager Protocol is updated to include
a FreeObject function that must be used by the callers to
GetObject to clean up any dynamic allocations and other resources
reserved by the Configuration Manager in the process of fulfilling the
request in GetObject.
A NULL inline static FreeObject function is provided for the ease
of transition for v1.0 managers.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Tomas Pilar <tomas@nuviainc.com>
---
.../Protocol/ConfigurationManagerProtocol.h | 83 ++++++++++++++++++-
1 file changed, 80 insertions(+), 3 deletions(-)
diff --git a/DynamicTablesPkg/Include/Protocol/ConfigurationManagerProtocol.h b/DynamicTablesPkg/Include/Protocol/ConfigurationManagerProtocol.h
index 7de1be3b23..72bf3c79bc 100644
--- a/DynamicTablesPkg/Include/Protocol/ConfigurationManagerProtocol.h
+++ b/DynamicTablesPkg/Include/Protocol/ConfigurationManagerProtocol.h
@@ -25,7 +25,7 @@
/** This macro defines the Configuration Manager Protocol Revision.
*/
-#define EDKII_CONFIGURATION_MANAGER_PROTOCOL_REVISION CREATE_REVISION (1, 0)
+#define EDKII_CONFIGURATION_MANAGER_PROTOCOL_REVISION CREATE_REVISION (1, 1)
#pragma pack(1)
@@ -35,10 +35,18 @@
typedef struct ConfigurationManagerProtocol EDKII_CONFIGURATION_MANAGER_PROTOCOL;
typedef struct PlatformRepositoryInfo EDKII_PLATFORM_REPOSITORY_INFO;
-/** The GetObject function defines the interface implemented by the
+/** The GetObject function defines the interface of the
Configuration Manager Protocol for returning the Configuration
Manager Objects.
+ If Token is CM_NULL_TOKEN, the function provides in its output all
+ the objects of the given CmObjectId. If the Token is not CM_NULL_TOKEN,
+ the function provides only those object that match both the CmObjectId
+ and Token.
+
+ The memory in CmObject.Data may be static or dynamic. The caller of this
+ function must call FreeObject on the CmObject populated by this function.
+
@param [in] This Pointer to the Configuration Manager Protocol.
@param [in] CmObjectId The Configuration Manager Object ID.
@param [in] Token An optional token identifying the object. If
@@ -62,10 +70,24 @@ EFI_STATUS
IN OUT CM_OBJ_DESCRIPTOR * CONST CmObject
);
-/** The SetObject function defines the interface implemented by the
+/** The SetObject function defines the interface of the
Configuration Manager Protocol for updating the Configuration
Manager Objects.
+ If Token is CM_NULL_TOKEN, and CmObject is not NULL, then the objects
+ in the configuration manager that match the CmObjectId and do not
+ have an associated cross reference Token are replaced by the contents of
+ CmObject.
+
+ If Token is not CM_NULL_TOKEN and CmObject is not NULL, then the objects
+ that match both CmObjectId and Token in the configuration manager are
+ replaced with the contents of CmObject.
+
+ If CmObject is NULL, then objects that match the CmObjectId and Token
+ are removed from the configuration manager. If Token is also CM_NULL_TOKEN,
+ then all objects of given CmObjectId are removed, regardless of their
+ cross-reference Token.
+
@param [in] This Pointer to the Configuration Manager Protocol.
@param [in] CmObjectId The Configuration Manager Object ID.
@param [in] Token An optional token identifying the object. If
@@ -90,6 +112,29 @@ EFI_STATUS
IN CM_OBJ_DESCRIPTOR * CONST CmObject
);
+/** The FreeObject function defines the interface of the
+ Configuration Manager Protocol for correctly freeing resources
+ that have been reserved by calls to the GetObject interface.
+
+ The caller of GetObject must use this function to dispose of CmObject
+ populated by the GetObject call when the CmObject is no longer needed.
+
+ If an implementation of the Configuration Manager Protocol does not
+ use dynamically allocated memory, this function should simply return
+ EFI_SUCCESS.
+
+ @param [in] This Pointer to the Configuration Manager Protocol
+ @param [in] CmObject Pointer to the CmObject that has been populated
+ by the GetObject function and is to be destroyed.
+ @retval EFI_SUCCESS The CmObject was successfully destroyed
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EDKII_CONFIGURATION_MANAGER_FREE_OBJECT) (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CM_OBJ_DESCRIPTOR * CmObject
+ );
+
/** The EDKII_CONFIGURATION_MANAGER_PROTOCOL structure describes the
Configuration Manager Protocol interface.
*/
@@ -111,12 +156,44 @@ typedef struct ConfigurationManagerProtocol {
provisioned by the Configuration Manager.
*/
EDKII_PLATFORM_REPOSITORY_INFO * PlatRepoInfo;
+
+ /** The interface used to destroy CmObject instances
+ populated by calls to GetObject
+ */
+ EDKII_CONFIGURATION_MANAGER_FREE_OBJECT FreeObject;
} EDKII_CONFIGURATION_MANAGER_PROTOCOL;
/** The Configuration Manager Protocol GUID.
*/
extern EFI_GUID gEdkiiConfigurationManagerProtocolGuid;
+/** Inline NULL implementation of FreeObject for backward compatibility
+ of configuration managers that do not require to deallocate any
+ memory following a call to GetObject.
+
+ @param[in] This Pointer to Configuration Manager Protocol instance
+ @param[in] CmObject Pointer to CmObject populated by GetObject
+
+ @retval EFI_SUCCESS Successfully handled CmObject.
+ @retval EFI_INVALID_PARAMETER CmObject is NULL.
+ @retval EFI_INVALID_PARAMETER This is NULL.
+ @retval EFI_INVALID_PARAMETER CmObject is not valid.
+**/
+static
+inline
+EFI_STATUS
+EFIAPI EdkiiCfgMgrFreeObjectNull (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CM_OBJ_DESCRIPTOR * CmObject
+ )
+{
+ if (!This || !CmObject) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ return EFI_SUCCESS;
+}
+
#pragma pack()
#endif // CONFIGURATION_MANAGER_PROTOCOL_H_
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/8] DynamicTablesPkg: Add CfgMgrProtocol helper functions
2020-07-31 16:19 [PATCH 0/8] ConfigurationManagerProtocol update Tomas Pilar (tpilar)
` (3 preceding siblings ...)
2020-07-31 16:19 ` [PATCH 4/8] DynamicTablesPkg: Update ConfigurationManagerProtocol Tomas Pilar (tpilar)
@ 2020-07-31 16:19 ` Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 6/8] DynamicTablesPkg/TableHelperLib: User friendly strings Tomas Pilar (tpilar)
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Tomas Pilar (tpilar) @ 2020-07-31 16:19 UTC (permalink / raw)
To: devel; +Cc: Sami Mujawar, Alexei Fedorov
Add functions abstracting adding and removing of objects using
the ConfigurationManagerProtocol to TableHelperLib. Also add
helpers for writing component library constructors for component
libraries populating a ConfigurationManager.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Tomas Pilar <tomas@nuviainc.com>
---
.../Include/Library/TableHelperLib.h | 170 ++++++++
.../Common/TableHelperLib/TableHelper.c | 379 +++++++++++++++++-
.../Common/TableHelperLib/TableHelperLib.inf | 6 +
3 files changed, 554 insertions(+), 1 deletion(-)
diff --git a/DynamicTablesPkg/Include/Library/TableHelperLib.h b/DynamicTablesPkg/Include/Library/TableHelperLib.h
index e4a8dfa046..0d3d1bbd60 100644
--- a/DynamicTablesPkg/Include/Library/TableHelperLib.h
+++ b/DynamicTablesPkg/Include/Library/TableHelperLib.h
@@ -12,6 +12,176 @@
#ifndef TABLE_HELPER_LIB_H_
#define TABLE_HELPER_LIB_H_
+#include <Protocol/ConfigurationManagerProtocol.h>
+
+/**
+ Get a unique token that can be used for configuration object
+ cross referencing.
+
+ @retval Unique arbitrary cross reference token.
+**/
+UINTN
+EFIAPI
+GetNewToken();
+
+/**
+ Return the count of objects of a given ObjectId.
+
+ @param[in] CmObjectId The id of the desired configuration objects.
+ @param[out] ItemCount Number of objects with given ObjectId.
+**/
+EFI_STATUS
+EFIAPI
+CfgMgrCountObjects (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ OUT UINT32 *ItemCount
+ );
+
+/**
+ Get a single object form the configuration manager with the
+ matching ObjectId regardless of any cross reference tokens.
+
+ @param[in] CmObjectId The id of the desired configuration object
+ @param[out] Buffer Buffer containing the payload of the CmObject.
+
+ @retval EFI_SUCCESS Payload was successfully returned
+ @retval EFI_NOT_FOUND There was no such object
+ @retval EFI_UNSUPPORTED ConfigurationManangerProtocol is not installed
+**/
+EFI_STATUS
+EFIAPI
+CfgMgrGetSimpleObject(
+ IN CONST CM_OBJECT_ID CmObjectId,
+ OUT VOID ** Buffer
+ );
+
+/**
+ Prototype for an initialiser function to be used by component
+ libraries that are linked as NULL libraries to a Configuration
+ Manager binary and used to populate said Configuration Manager
+ with objects.
+
+ @param[in] CfgMgrProtocol The newly installed ConfigurationManagerProtocol
+ that can be used by the library to populate the
+ Configuration Manager with objects.
+**/
+typedef EFI_STATUS (EFIAPI *CFG_MGR_COMPONENT_LIB_INIT) (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CfgMgrProtocol
+ );
+
+/**
+ Register a callback inintialiser to be called when a configuration
+ manager is installed. The initialiser function is expected to
+ populate the newly installed configuration manager with objects when
+ called.
+
+ This helper should be used by component libraries that want to
+ provide configuration objects and are to be linked in as NULL
+ libraries into the configuration manager binary.
+
+ @param[in] InitFunction An initialiser function that will be called when
+ a configuration manager becomes available.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate necessary memory.
+ @retval EFI_SUCCESS Registration was successful.
+**/
+EFI_STATUS
+EFIAPI
+RegisterForCfgManager (
+ IN CONST CFG_MGR_COMPONENT_LIB_INIT InitFunction
+ );
+
+/**
+ Remove a configuration object from the configuration manager. If a
+ cross reference token is supplied, only objects referenced by that
+ token will be removed. If a token is not supplied, all objects of the
+ given type will be removed.
+
+ @param[in] CmObjectId The id of the object that is to be removed.
+ @param[in] Token Unique cross-reference token of the object to be removed.
+
+ @retval EFI_UNSUPPORTED There is no configuration manager installed.
+ @retval EFI_NOT_FOUND The combination of id and token was not found in the
+ configuration manager.
+ @retval EFI_SUCCESS Object was successfully deleted.
+**/
+EFI_STATUS
+EFIAPI
+CfgMgrRemoveObject (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token OPTIONAL
+ );
+
+/**
+ Add an instance of object to the configuration manager. If an object with
+ the specified object id and token already exists in the manager, append the
+ provided object to the existing list. Otherwise, create a new list with this
+ object being the only member.
+
+ @param[in] CmObjectId The id of the object that is to be added.
+ @param[in] Token The unique cross-reference token for this object.
+ @param[in] Buffer The instance of the object being added.
+ @param[in] BufferSize Size of Buffer in bytes.
+
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory when appending data
+ @retval EFI_UNSUPPORTED There is no Configuration Manager installed
+ @retval EFI_SUCCESS Object was successfully added to the Configuration Manager
+**/
+EFI_STATUS
+EFIAPI
+CfgMgrAddObject (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
+ IN VOID * Buffer,
+ IN UINTN BufferSize
+ );
+
+/**
+ Add multiple objects of the same type/token to the configuration manager.
+ If an object with the specified object id and token already exists in the
+ manager, append the provided objects to the existing list. Otherwise, create
+ a new list.
+
+ @param[in] CmObjectId The id of the object that is to be added.
+ @param[in] Token The unique cross-reference token for this object.
+ @param[in] Buffer The instance of the objects being added.
+ @param[in] BufferSize Size of Buffer in bytes.
+ @param[in] ItemCount Number of instances of object in the Buffer.
+
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory when appending data.
+ @retval EFI_UNSUPPORTED There is no Configuration Manager installed.
+ @retval EFI_SUCCESS Object was successfully added to the Configuration Manager.
+**/
+EFI_STATUS
+EFIAPI
+CfgMgrAddObjects (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
+ IN VOID * Buffer,
+ IN UINTN BufferSize,
+ IN UINT32 ItemCount
+ );
+
+/**
+ Retrieve an object with a given id from the installed configuration
+ manager. If a token is not specified, returns all objects of given
+ id, regardless of token. The methods unwraps the CmObject abstraction
+ and only returns the payloads.
+
+ @param[in] CmObjectId The id of the desired configuration objects.
+ @param[in] Token Optional cross reference token. If not supplied, all.
+ objects of the given id are returned.
+ @param[out] Buffer Buffer containing a number of payloads of CmObjects.
+ @param[out] ItemCount The count of payloads in Buffer.
+**/
+EFI_STATUS
+EFIAPI
+CfgMgrGetObjects (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
+ OUT VOID ** Buffer OPTIONAL,
+ OUT UINT32 * ItemCount OPTIONAL
+ );
+
/** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO
object from the Configuration Manager.
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c
index fc6cf3b088..18c0e95e0d 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c
@@ -6,9 +6,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Protocol/AcpiTable.h>
+
#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/PrintLib.h>
// Module specific include files.
#include <AcpiTableGenerator.h>
@@ -16,6 +20,378 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
+/**
+ Get a unique token that can be used for configuration object
+ cross referencing.
+
+ @retval Unique arbitrary cross reference token
+**/
+UINTN
+EFIAPI
+GetNewToken()
+{
+ UINTN Token;
+ EFI_STATUS Status = gBS->GetNextMonotonicCount(&Token);
+ if (EFI_ERROR(Status)) {
+ return CM_NULL_TOKEN;
+ }
+
+ return Token;
+}
+
+/**
+ Event callback for executing the registered component library
+ inintialiser with the newly installed ConfigurationManagerProtocol
+ as the only parameter.
+**/
+STATIC
+VOID
+EFIAPI
+ComponentInitEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ ASSERT (Context != NULL);
+
+ CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CfgMgrProtocol;
+ CFG_MGR_COMPONENT_LIB_INIT InitFunction = Context;
+
+ EFI_STATUS Status = gBS->LocateProtocol (
+ &gEdkiiConfigurationManagerProtocolGuid,
+ NULL,
+ (VOID **) &CfgMgrProtocol);
+
+
+ if (EFI_ERROR(Status)) { // Should never happen
+ gBS->CloseEvent(Event);
+ RegisterForCfgManager(InitFunction);
+ return;
+ }
+
+ InitFunction(CfgMgrProtocol);
+}
+
+/**
+ Register a callback inintialiser to be called when a configuration
+ manager is installed. The initialiser function is expected to
+ populate the newly installed configuration manager with objects when
+ called.
+
+ This helper should be used by component libraries that want to
+ provide configuration objects and are to be linked in as NULL
+ libraries into the configuration manager binary.
+
+ @param[in] InitFunction An initialiser function that will be called when
+ a configuration manager becomes available.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate necessary memory
+ @retval EFI_SUCCESS Registration was successful
+**/
+EFI_STATUS
+EFIAPI
+RegisterForCfgManager (
+ CONST CFG_MGR_COMPONENT_LIB_INIT InitFunction
+ )
+{
+ EFI_STATUS Status = EFI_NOT_STARTED;
+ EFI_EVENT InitEvent;
+ VOID *Registration;
+
+ ASSERT(InitFunction != NULL);
+
+ Status = gBS->CreateEvent (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ ComponentInitEvent,
+ InitFunction,
+ &InitEvent);
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = gBS->RegisterProtocolNotify (
+ &gEdkiiConfigurationManagerProtocolGuid,
+ InitEvent,
+ &Registration);
+
+ if (EFI_ERROR(Status)) {
+ gBS->CloseEvent(InitEvent);
+ }
+
+ return Status;
+}
+
+/**
+ Return the count of objects of a given ObjectId.
+ If there are no objects, ItemCount is set to zero.
+
+ @param[in] CmObjectId The id of the desired configuration objects.
+ @param[out] ItemCount Number of objects with given ObjectId.
+**/
+EFI_STATUS
+EFIAPI
+CfgMgrCountObjects (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ OUT UINT32 *ItemCount
+ )
+{
+ EFI_STATUS Status = EFI_NOT_STARTED;
+
+ Status = CfgMgrGetObjects (CmObjectId, CM_NULL_TOKEN, NULL, ItemCount);
+ if (Status == EFI_NOT_FOUND) {
+ *ItemCount = 0;
+ }
+
+ return Status;
+}
+
+/**
+ Retrieve an object with a given id from the installed configuration
+ manager. If a token is not specified, returns all objects of given
+ id, regardless of token. The methods unwraps the CmObject abstraction
+ and only returns the payloads.
+
+ If Buffer is not NULL, the data will be returned in allocated memory. The
+ caller must free this memory when they are done with the data.
+
+ If ItemCount is not NULL, the count of items matching the criteria
+ is returned.
+
+ @param[in] CmObjectId The id of the desired configuration objects
+ @param[in] Token Optional cross reference token. If not supplied, all
+ objects of the given id are returned.
+ @param[out] Buffer Buffer containing a number of payloads of CmObjects.
+ @param[out] ItemCount The count of payloads in Buffer
+**/
+EFI_STATUS
+EFIAPI
+CfgMgrGetObjects (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
+ OUT VOID ** Buffer OPTIONAL,
+ OUT UINT32 * ItemCount OPTIONAL
+ )
+{
+ EDKII_CONFIGURATION_MANAGER_PROTOCOL *CfgMgr;
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (
+ &gEdkiiConfigurationManagerProtocolGuid, NULL, (VOID **) &CfgMgr);
+ if (EFI_ERROR(Status)) {
+ DEBUG ((DEBUG_ERROR, "ERROR: No Configuration Manager Protocol Found!\n"));
+ return EFI_UNSUPPORTED;
+ }
+
+ CM_OBJ_DESCRIPTOR Object;
+
+ Status = CfgMgr->GetObject(CfgMgr, CmObjectId, Token, &Object);
+ if (EFI_ERROR(Status)) {
+ if (Status != EFI_NOT_FOUND) {
+ DEBUG (
+ (DEBUG_ERROR,
+ "ERROR: FADT: Failed to get <%s> [%r]\n",
+ CmObjectIdName (CmObjectId),
+ Status));
+ }
+
+ return Status;
+ }
+
+ if (Buffer) {
+ *Buffer = AllocateCopyPool (Object.Size, Object.Data);
+ if (Buffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ }
+
+ if (ItemCount) {
+ *ItemCount = Object.Count;
+ }
+
+ if (CfgMgr->Revision >= CREATE_REVISION(1, 1)) {
+ CfgMgr->FreeObject(CfgMgr, &Object);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Get a single object form the configuration manager with the
+ matching ObjectId regardless of any cross reference tokens.
+
+ @param[in] CmObjectId The id of the desired configuration object
+ @param[out] Buffer Buffer containing the payload of the CmObject.
+
+ @retval EFI_SUCCESS Payload was successfully returned
+ @retval EFI_NOT_FOUND There was no such object
+ @retval EFI_UNSUPPORTED ConfigurationManangerProtocol is not installed
+**/
+EFI_STATUS
+EFIAPI
+CfgMgrGetSimpleObject(
+ IN CONST CM_OBJECT_ID CmObjectId,
+ OUT VOID ** Buffer
+ )
+{
+ EFI_STATUS Status;
+
+ Status = CfgMgrGetObjects(CmObjectId, CM_NULL_TOKEN, Buffer, NULL);
+ if (Status == EFI_NOT_FOUND) {
+ DEBUG ((DEBUG_ERROR,
+ "ERROR: Failed to get <%s> [%r]\n",
+ CmObjectIdName (CmObjectId),
+ Status));
+ }
+ return Status;
+}
+
+/**
+ Add an instance of object to the configuration manager. If an object with
+ the specified object id and token already exists in the manager, append the
+ provided object to the existing list. Otherwise, create a new list with this
+ object being the only member.
+
+ @param[in] CmObjectId The id of the object that is to be added
+ @param[in] Token The unique cross-reference token for this object
+ @param[in] Buffer The instance of the object being added
+ @param[in] BufferSize Size of Buffer in bytes
+
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory when appending data
+ @retval EFI_UNSUPPORTED There is no Configuration Manager installed
+ @retval EFI_SUCCESS Object was successfully added to the Configuration Manager
+**/
+EFI_STATUS
+EFIAPI
+CfgMgrAddObject (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
+ IN VOID * Buffer,
+ IN UINTN BufferSize
+ )
+{
+ EFI_STATUS Status;
+ EDKII_CONFIGURATION_MANAGER_PROTOCOL *CfgMgrProtocol;
+ CM_OBJ_DESCRIPTOR CurrentObject = { 0 };
+ CM_OBJ_DESCRIPTOR NewObject;
+
+ ASSERT(Buffer != NULL);
+ ASSERT(BufferSize != 0);
+
+ Status = gBS->LocateProtocol (
+ &gEdkiiConfigurationManagerProtocolGuid, NULL, (VOID **) &CfgMgrProtocol);
+
+ if (EFI_ERROR(Status)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = CfgMgrProtocol->GetObject (
+ CfgMgrProtocol, CmObjectId, Token, &CurrentObject);
+
+ NewObject.ObjectId = CmObjectId;
+ NewObject.Count = 1 + CurrentObject.Count;
+ NewObject.Size = BufferSize +CurrentObject.Size;
+
+ NewObject.Data = AllocateZeroPool(NewObject.Size);
+ if (NewObject.Data == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem(NewObject.Data, CurrentObject.Data, CurrentObject.Size); // NOP if CurrentObject does not exist
+ CopyMem((UINT8 *) NewObject.Data + CurrentObject.Size, Buffer, BufferSize);
+
+ Status =
+ CfgMgrProtocol->SetObject (CfgMgrProtocol, CmObjectId, Token, &NewObject);
+
+ FreePool (NewObject.Data);
+ return Status;
+}
+
+/**
+ Add multiple objects of the same type/token to the configuration manager.
+ If an object with the specified object id and token already exists in the
+ manager, append the provided objects to the existing list. Otherwise, create
+ a new list.
+
+ @param[in] CmObjectId The id of the object that is to be added.
+ @param[in] Token The unique cross-reference token for this object.
+ @param[in] Buffer The instance of the objects being added.
+ @param[in] BufferSize Size of Buffer in bytes.
+ @param[in] ItemCount Number of instances of object in the Buffer.
+
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory when appending data.
+ @retval EFI_UNSUPPORTED There is no Configuration Manager installed.
+ @retval EFI_SUCCESS Object was successfully added to the Configuration Manager.
+**/
+EFI_STATUS
+EFIAPI
+CfgMgrAddObjects (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
+ IN VOID * Buffer,
+ IN UINTN BufferSize,
+ IN UINT32 ItemCount
+ )
+{
+ UINTN Index;
+ UINT8 *Cursor = Buffer;
+ UINTN ItemSize = BufferSize / ItemCount;
+ EFI_STATUS Status = EFI_NOT_STARTED;
+
+ for (Index = 0; Index < ItemCount; Index++) {
+ Status = CfgMgrAddObject(CmObjectId, Token, Cursor, ItemSize);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ Cursor += ItemSize;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Remove a configuration object from the configuration manager. If a
+ cross reference token is supplied, only objects referenced by that
+ token will be removed. If a token is not supplied, all objects of the
+ given type will be removed.
+
+ @param[in] CmObjectId The id of object that is to be removed
+ @param[in] Token Unique cross-reference token of the object to be removed
+
+ @retval EFI_UNSUPPORTED There is no configuration manager installed
+ @retval EFI_NOT_FOUND The combination of id and token was not found in the
+ configuration manager
+ @retval EFI_SUCCESS Object was successfully deleted
+**/
+EFI_STATUS
+EFIAPI
+CfgMgrRemoveObject (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token OPTIONAL
+ )
+{
+ EFI_STATUS Status = EFI_NOT_STARTED;
+ EDKII_CONFIGURATION_MANAGER_PROTOCOL *CfgMgrProtocol;
+ CM_OBJ_DESCRIPTOR CurrentObject;
+
+ Status = gBS->LocateProtocol (
+ &gEdkiiConfigurationManagerProtocolGuid, NULL, (VOID **) &CfgMgrProtocol);
+
+ if (EFI_ERROR(Status)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = CfgMgrProtocol->GetObject (
+ CfgMgrProtocol, CmObjectId, Token, &CurrentObject);
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ return CfgMgrProtocol->SetObject (CfgMgrProtocol, CmObjectId, Token, NULL);
+}
+
+
/** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO
object from the Configuration Manager.
@@ -44,6 +420,7 @@ GetCgfMgrInfo (
ASSERT (CfgMfrInfo != NULL);
*CfgMfrInfo = NULL;
+
Status = CfgMgrProtocol->GetObject (
CfgMgrProtocol,
CREATE_CM_STD_OBJECT_ID (EStdObjCfgMgrInfo),
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
index 26d82e6850..e12380073e 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
@@ -23,8 +23,14 @@
[LibraryClasses]
BaseLib
+ BaseMemoryLib
+ DebugLib
+ PrintLib
+ MemoryAllocationLib
+ UefiBootServicesTableLib
[Protocols]
+ gEfiSerialIoProtocolGuid
[Guids]
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/8] DynamicTablesPkg/TableHelperLib: User friendly strings
2020-07-31 16:19 [PATCH 0/8] ConfigurationManagerProtocol update Tomas Pilar (tpilar)
` (4 preceding siblings ...)
2020-07-31 16:19 ` [PATCH 5/8] DynamicTablesPkg: Add CfgMgrProtocol helper functions Tomas Pilar (tpilar)
@ 2020-07-31 16:19 ` Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 7/8] DynamicTablesPkg: Simplify AddAcpiHeader, CfgMgrGetInfo Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 8/8] DynamicTablesPkg: Remove GET_OBJECT_LIST Tomas Pilar (tpilar)
7 siblings, 0 replies; 9+ messages in thread
From: Tomas Pilar (tpilar) @ 2020-07-31 16:19 UTC (permalink / raw)
To: devel; +Cc: Sami Mujawar, Alexei Fedorov
Add user friendly strings for CmObjectIds to TableHelperLib
and add debug print invocations to common helper methods.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Tomas Pilar <tomas@nuviainc.com>
---
.../ConfigurationManagerDumpApp.c | 13 +--
.../ConfigurationManagerDumpApp.h | 8 --
.../ConfigurationManagerDumpApp.inf | 3 +-
.../ConfigurationObjectStrings.c | 50 ----------
.../Include/Library/TableHelperLib.h | 12 +++
.../ConfigurationObjectStrings.c | 92 +++++++++++++++++++
.../Common/TableHelperLib/TableHelperLib.inf | 1 +
7 files changed, 109 insertions(+), 70 deletions(-)
delete mode 100644 DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.h
delete mode 100644 DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationObjectStrings.c
create mode 100644 DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationObjectStrings.c
diff --git a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c
index 15936c78c1..20977c1b82 100644
--- a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c
+++ b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c
@@ -1,10 +1,9 @@
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
-#include "ConfigurationManagerDumpApp.h"
-
EDKII_CONFIGURATION_MANAGER_PROTOCOL *mCfgMgr;
EFI_STATUS
@@ -33,10 +32,7 @@ UefiMain(
continue;
}
- Print (
- L"<%s>::<%s>\n",
- ObjectNameSpaceString[EObjNameSpaceStandard],
- StdObjectString[ObjectId - EObjNameSpaceStandard]);
+ Print (L"<%s>\n", CmObjectIdName (ObjectId));
Print (
L"Id=%x Size=0x%x at=%p count=%d\n",
@@ -54,10 +50,7 @@ UefiMain(
continue;
}
- Print (
- L"<%s>::<%s>\n",
- ObjectNameSpaceString[EObjNameSpaceArm],
- ArmObjectString[ObjectId - EObjNameSpaceArm]);
+ Print (L"<%s>\n", CmObjectIdName(ObjectId));
Print (
L"Id=%x Size=0x%x at=%p count=%d\n",
diff --git a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.h b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.h
deleted file mode 100644
index 5017d55b4a..0000000000
--- a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef CONFIGURATION_MANAGER_DUMP_APP_H_
-#define CONFIGURATION_MANAGER_DUMP_APP_H_
-
-extern CHAR16 *ArmObjectString[];
-extern CHAR16 *ObjectNameSpaceString[];
-extern CHAR16 *StdObjectString[];
-
-#endif
diff --git a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf
index 9f8beb916d..f930ca3dcb 100644
--- a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf
+++ b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf
@@ -23,8 +23,6 @@
[Sources]
ConfigurationManagerDumpApp.c
- ConfigurationManagerDumpApp.h
- ConfigurationObjectStrings.c
[Packages]
MdePkg/MdePkg.dec
@@ -32,6 +30,7 @@
DynamicTablesPkg/DynamicTablesPkg.dec
[LibraryClasses]
+ TableHelperLib
UefiLib
UefiBootServicesTableLib
UefiApplicationEntryPoint
diff --git a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationObjectStrings.c b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationObjectStrings.c
deleted file mode 100644
index ad8dbb6354..0000000000
--- a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationObjectStrings.c
+++ /dev/null
@@ -1,50 +0,0 @@
-
-CHAR16 *ArmObjectString[] = {
- L"Reserved",
- L"Boot Architecture Info",
- L"CPU Info",
- L"Power Management Profile Info",
- L"GIC CPU Interface Info",
- L"GIC Distributor Info",
- L"GIC MSI Frame Info",
- L"GIC Redistributor Info",
- L"GIC ITS Info",
- L"Serial Console Port Info",
- L"Serial Debug Port Info",
- L"Generic Timer Info",
- L"Platform GT Block Info",
- L"Generic Timer Block Frame Info",
- L"Platform Generic Watchdog",
- L"PCI Configuration Space Info",
- L"Hypervisor Vendor Id",
- L"Fixed feature flags for FADT",
- L"ITS Group",
- L"Named Component",
- L"Root Complex",
- L"SMMUv1 or SMMUv2",
- L"SMMUv3",
- L"PMCG",
- L"GIC ITS Identifier Array",
- L"ID Mapping Array",
- L"SMMU Interrupt Array",
- L"Processor Hierarchy Info",
- L"Cache Info",
- L"Processor Node ID Info",
- L"CM Object Reference",
- L"Memory Affinity Info",
- L"Device Handle Acpi",
- L"Device Handle Pci",
- L"Generic Initiator Affinity"
-};
-
-CHAR16 *ObjectNameSpaceString[] = {
- L"Standard Objects Namespace",
- L"ARM Objects Namespace",
- L"OEM Objects Namespace"
-};
-
-CHAR16 *StdObjectString[] = {
- L"Configuration Manager Info",
- L"ACPI table Info List",
- L"SMBIOS table Info List"
-};
diff --git a/DynamicTablesPkg/Include/Library/TableHelperLib.h b/DynamicTablesPkg/Include/Library/TableHelperLib.h
index 0d3d1bbd60..9269e77377 100644
--- a/DynamicTablesPkg/Include/Library/TableHelperLib.h
+++ b/DynamicTablesPkg/Include/Library/TableHelperLib.h
@@ -24,6 +24,18 @@ UINTN
EFIAPI
GetNewToken();
+/**
+ Returns the user friendly name for the given ObjectId.
+
+ @param[in] CmObjectId The id of the configuration manager object
+ @return User friendly name for object id.
+**/
+const CHAR16*
+EFIAPI
+CmObjectIdName(
+ IN CONST CM_OBJECT_ID CmObjectrId
+ );
+
/**
Return the count of objects of a given ObjectId.
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationObjectStrings.c b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationObjectStrings.c
new file mode 100644
index 0000000000..e4c0e77633
--- /dev/null
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationObjectStrings.c
@@ -0,0 +1,92 @@
+/** @file
+ ConfigurationObjectStrings.c
+
+ Copyright (c) 2020, ARM Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <ConfigurationManagerObject.h>
+
+const CHAR16 *ArmObjectString[] = {
+ L"Reserved",
+ L"Boot Architecture Info",
+ L"CPU Info",
+ L"Power Management Profile Info",
+ L"GIC CPU Interface Info",
+ L"GIC Distributor Info",
+ L"GIC MSI Frame Info",
+ L"GIC Redistributor Info",
+ L"GIC ITS Info",
+ L"Serial Console Port Info",
+ L"Serial Debug Port Info",
+ L"Generic Timer Info",
+ L"Platform GT Block Info",
+ L"Generic Timer Block Frame Info",
+ L"Platform Generic Watchdog",
+ L"PCI Configuration Space Info",
+ L"Hypervisor Vendor Id",
+ L"Fixed feature flags for FADT",
+ L"ITS Group",
+ L"Named Component",
+ L"Root Complex",
+ L"SMMUv1 or SMMUv2",
+ L"SMMUv3",
+ L"PMCG",
+ L"GIC ITS Identifier Array",
+ L"ID Mapping Array",
+ L"SMMU Interrupt Array",
+ L"Processor Hierarchy Info",
+ L"Cache Info",
+ L"Processor Node ID Info",
+ L"CM Object Reference",
+ L"Memory Affinity Info",
+ L"Device Handle Acpi",
+ L"Device Handle Pci",
+ L"Generic Initiator Affinity"
+};
+
+const CHAR16 *ObjectNameSpaceString[] = {
+ L"Standard Objects Namespace",
+ L"ARM Objects Namespace",
+ L"OEM Objects Namespace"
+};
+
+const CHAR16 *StdObjectString[] = {
+ L"Configuration Manager Info",
+ L"ACPI table Info List",
+ L"SMBIOS table Info List"
+};
+
+const CHAR16* UnknownObject = L"Unknown Object";
+
+/**
+ Returns the user friendly name for the given ObjectId.
+
+ @param[in] CmObjectId The id of the configuration manager object
+ @return User friendly name for object id.
+**/
+const CHAR16*
+EFIAPI
+CmObjectIdName(
+ IN CONST CM_OBJECT_ID CmObjectId
+ )
+{
+ switch (GET_CM_NAMESPACE_ID(CmObjectId)) {
+ case EObjNameSpaceStandard:
+ if (CmObjectId < EStdObjMax) {
+ return StdObjectString[CmObjectId - EObjNameSpaceStandard];
+ } else {
+ return UnknownObject;
+ }
+ case EObjNameSpaceArm:
+ if (CmObjectId < EArmObjMax) {
+ return ArmObjectString[CmObjectId - EObjNameSpaceArm];
+ } else {
+ return UnknownObject;
+ }
+ default:
+ return UnknownObject;
+ }
+
+ return UnknownObject;
+}
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
index e12380073e..0fbc1fe5b2 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
@@ -16,6 +16,7 @@
[Sources]
TableHelper.c
+ ConfigurationObjectStrings.c
[Packages]
MdePkg/MdePkg.dec
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 7/8] DynamicTablesPkg: Simplify AddAcpiHeader, CfgMgrGetInfo
2020-07-31 16:19 [PATCH 0/8] ConfigurationManagerProtocol update Tomas Pilar (tpilar)
` (5 preceding siblings ...)
2020-07-31 16:19 ` [PATCH 6/8] DynamicTablesPkg/TableHelperLib: User friendly strings Tomas Pilar (tpilar)
@ 2020-07-31 16:19 ` Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 8/8] DynamicTablesPkg: Remove GET_OBJECT_LIST Tomas Pilar (tpilar)
7 siblings, 0 replies; 9+ messages in thread
From: Tomas Pilar (tpilar) @ 2020-07-31 16:19 UTC (permalink / raw)
To: devel; +Cc: Sami Mujawar, Alexei Fedorov
Simplify the methods to use the other object getter methods.
The methods no longer need CfgMgr context parameter, the getter
helpers retrieve the singleton platform protocol.
The CfgMgrGetInfo always allocates the memory that is passed to the caller.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Tomas Pilar <tomas@nuviainc.com>
---
.../DynamicTableManagerDxe.c | 20 ++--
.../Include/Library/TableHelperLib.h | 23 ++---
.../Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c | 10 +-
.../Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c | 12 +--
.../Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c | 8 +-
.../Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 8 +-
.../Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c | 8 +-
.../Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c | 8 +-
.../Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 8 +-
.../Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c | 10 +-
.../Acpi/Arm/AcpiSratLibArm/SratGenerator.c | 8 +-
.../Common/TableHelperLib/TableHelper.c | 97 ++++---------------
.../Common/TableHelperLib/TableHelperLib.inf | 3 +-
13 files changed, 56 insertions(+), 167 deletions(-)
diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
index e27dcaf374..b194a38659 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
@@ -661,7 +661,7 @@ DynamicTableManagerDxeInitialize (
{
EFI_STATUS Status;
EDKII_CONFIGURATION_MANAGER_PROTOCOL * CfgMgrProtocol;
- CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMfrInfo;
+ CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMgrInfo;
EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL * TableFactoryProtocol;
// Locate the Dynamic Table Factory
@@ -695,7 +695,7 @@ DynamicTableManagerDxeInitialize (
return Status;
}
- Status = GetCgfMgrInfo (CfgMgrProtocol, &CfgMfrInfo);
+ Status = CfgMgrGetInfo (&CfgMgrInfo);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -708,15 +708,17 @@ DynamicTableManagerDxeInitialize (
DEBUG ((
DEBUG_INFO,
"INFO: Configuration Manager Version = 0x%x, OemID = %c%c%c%c%c%c\n",
- CfgMfrInfo->Revision,
- CfgMfrInfo->OemId[0],
- CfgMfrInfo->OemId[1],
- CfgMfrInfo->OemId[2],
- CfgMfrInfo->OemId[3],
- CfgMfrInfo->OemId[4],
- CfgMfrInfo->OemId[5]
+ CfgMgrInfo->Revision,
+ CfgMgrInfo->OemId[0],
+ CfgMgrInfo->OemId[1],
+ CfgMgrInfo->OemId[2],
+ CfgMgrInfo->OemId[3],
+ CfgMgrInfo->OemId[4],
+ CfgMgrInfo->OemId[5]
));
+ FreePool(CfgMgrInfo);
+
Status = ProcessAcpiTables (TableFactoryProtocol, CfgMgrProtocol);
if (EFI_ERROR (Status)) {
DEBUG ((
diff --git a/DynamicTablesPkg/Include/Library/TableHelperLib.h b/DynamicTablesPkg/Include/Library/TableHelperLib.h
index 9269e77377..0dce81827b 100644
--- a/DynamicTablesPkg/Include/Library/TableHelperLib.h
+++ b/DynamicTablesPkg/Include/Library/TableHelperLib.h
@@ -194,33 +194,26 @@ CfgMgrGetObjects (
OUT UINT32 * ItemCount OPTIONAL
);
-/** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO
+/** The CfgMgrGetInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO
object from the Configuration Manager.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager protocol
- interface.
@param [out] CfgMfrInfo Pointer to the Configuration Manager Info
object structure.
@retval EFI_SUCCESS The object is returned.
- @retval EFI_INVALID_PARAMETER The Object ID is invalid.
@retval EFI_NOT_FOUND The requested Object is not found.
- @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
- Manager is less than the Object size.
**/
EFI_STATUS
EFIAPI
-GetCgfMgrInfo (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
+CfgMgrGetInfo (
OUT CM_STD_OBJ_CONFIGURATION_MANAGER_INFO ** CfgMfrInfo
);
-/** The AddAcpiHeader function updates the ACPI header structure. It uses the
- ACPI table Generator and the Configuration Manager protocol to obtain the
- information required for constructing the header.
+/** The AddAcpiHeader function updates the ACPI header structure pointed by
+ the AcpiHeader. It utilizes the ACPI table Generator and the Configuration
+ Manager protocol to obtain any information required for constructing the
+ header.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- protocol interface.
@param [in] Generator Pointer to the ACPI table Generator.
@param [in,out] AcpiHeader Pointer to the ACPI table header to be
updated.
@@ -230,14 +223,10 @@ GetCgfMgrInfo (
@retval EFI_SUCCESS The ACPI table is updated successfully.
@retval EFI_INVALID_PARAMETER A parameter is invalid.
@retval EFI_NOT_FOUND The required object information is not found.
- @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
- Manager is less than the Object size for the
- requested object.
**/
EFI_STATUS
EFIAPI
AddAcpiHeader (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST ACPI_TABLE_GENERATOR * CONST Generator,
IN OUT EFI_ACPI_DESCRIPTION_HEADER * CONST AcpiHeader,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
index 51c843d25f..21a7f9bf64 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
@@ -330,12 +330,10 @@ BuildDbg2Table (
}
Status = AddAcpiHeader (
- CfgMgrProtocol,
- This,
- (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2,
- AcpiTableInfo,
- sizeof (DBG2_TABLE)
- );
+ This,
+ (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiDbg2,
+ AcpiTableInfo,
+ sizeof (DBG2_TABLE));
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
index b748c982b2..febaca3dae 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
@@ -528,19 +528,17 @@ BuildFadtTable (
*Table = NULL;
Status = AddAcpiHeader (
- CfgMgrProtocol,
- This,
- (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt,
- AcpiTableInfo,
- sizeof (EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE)
- );
+ This,
+ (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiFadt,
+ AcpiTableInfo,
+ sizeof (EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE));
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
"ERROR: FADT: Failed to add ACPI header. Status = %r\n",
Status
));
- goto error_handler;
+ return Status;
}
// Update PmProfile Info
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
index c109f2ac20..4af410fb5b 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
@@ -593,13 +593,7 @@ BuildGtdtTable (
TableSize
));
- Status = AddAcpiHeader (
- CfgMgrProtocol,
- This,
- &Gtdt->Header,
- AcpiTableInfo,
- TableSize
- );
+ Status = AddAcpiHeader (This, &Gtdt->Header, AcpiTableInfo, TableSize);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
index 65d006c89e..97f86ddb30 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
@@ -1942,13 +1942,7 @@ BuildIortTable (
TableSize
));
- Status = AddAcpiHeader (
- CfgMgrProtocol,
- This,
- &Iort->Header,
- AcpiTableInfo,
- (UINT32)TableSize
- );
+ Status = AddAcpiHeader (This, &Iort->Header, AcpiTableInfo, (UINT32) TableSize);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
index 2651ca1541..ab42c96b06 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
@@ -641,13 +641,7 @@ BuildMadtTable (
TableSize
));
- Status = AddAcpiHeader (
- CfgMgrProtocol,
- This,
- &Madt->Header,
- AcpiTableInfo,
- TableSize
- );
+ Status = AddAcpiHeader (This, &Madt->Header, AcpiTableInfo, TableSize);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
index 1293ac8e43..a486e2297a 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
@@ -210,13 +210,7 @@ BuildMcfgTable (
TableSize
));
- Status = AddAcpiHeader (
- CfgMgrProtocol,
- This,
- &Mcfg->Header,
- AcpiTableInfo,
- TableSize
- );
+ Status = AddAcpiHeader (This, &Mcfg->Header, AcpiTableInfo, TableSize);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
index d70fc59e75..99eb6e0929 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
@@ -1291,13 +1291,7 @@ BuildPpttTable (
));
// Add ACPI header
- Status = AddAcpiHeader (
- CfgMgrProtocol,
- This,
- &Pptt->Header,
- AcpiTableInfo,
- TableSize
- );
+ Status = AddAcpiHeader (This, &Pptt->Header, AcpiTableInfo, TableSize);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
index 4b2580da7d..46f53f819a 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
@@ -202,12 +202,10 @@ BuildSpcrTable (
DEBUG ((DEBUG_INFO, " Interrupt = %d\n", SerialPortInfo->Interrupt));
Status = AddAcpiHeader (
- CfgMgrProtocol,
- This,
- (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiSpcr,
- AcpiTableInfo,
- sizeof (EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE)
- );
+ This,
+ (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiSpcr,
+ AcpiTableInfo,
+ sizeof (EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE));
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c
index 620e2929ef..fda0837f32 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c
@@ -610,13 +610,7 @@ BuildSratTable (
TableSize
));
- Status = AddAcpiHeader (
- CfgMgrProtocol,
- This,
- &Srat->Header,
- AcpiTableInfo,
- TableSize
- );
+ Status = AddAcpiHeader (This, &Srat->Header, AcpiTableInfo, TableSize);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c
index 18c0e95e0d..2f266feb9c 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c
@@ -392,74 +392,30 @@ CfgMgrRemoveObject (
}
-/** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO
- object from the Configuration Manager.
+/** The CfgMgrGetInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO
+ object from the Configuration Manager. The caller is responsible for freeing
+ the memory allocated by this function.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager protocol
- interface.
- @param [out] CfgMfrInfo Pointer to the Configuration Manager Info
+ @param [out] CfgMgrInfo Pointer to the Configuration Manager Info
object structure.
@retval EFI_SUCCESS The object is returned.
- @retval EFI_INVALID_PARAMETER The Object ID is invalid.
@retval EFI_NOT_FOUND The requested Object is not found.
- @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
- Manager is less than the Object size.
+ @retval EFI_INVALID_PARAMETER CfgMgrInfo is NULL.
**/
EFI_STATUS
EFIAPI
-GetCgfMgrInfo (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
- OUT CM_STD_OBJ_CONFIGURATION_MANAGER_INFO ** CfgMfrInfo
+CfgMgrGetInfo (
+ OUT CM_STD_OBJ_CONFIGURATION_MANAGER_INFO ** CfgMgrInfo
)
{
- EFI_STATUS Status;
- CM_OBJ_DESCRIPTOR CmObjectDesc;
-
- ASSERT (CfgMgrProtocol != NULL);
- ASSERT (CfgMfrInfo != NULL);
-
- *CfgMfrInfo = NULL;
-
- Status = CfgMgrProtocol->GetObject (
- CfgMgrProtocol,
- CREATE_CM_STD_OBJECT_ID (EStdObjCfgMgrInfo),
- CM_NULL_TOKEN,
- &CmObjectDesc
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: Failed to Get Configuration Manager Info. Status = %r\n",
- Status
- ));
- return Status;
- }
-
- if (CmObjectDesc.ObjectId != CREATE_CM_STD_OBJECT_ID (EStdObjCfgMgrInfo)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: EStdObjCfgMgrInfo: Invalid ObjectId = 0x%x, expected Id = 0x%x\n",
- CmObjectDesc.ObjectId,
- CREATE_CM_STD_OBJECT_ID (EStdObjCfgMgrInfo)
- ));
- ASSERT (FALSE);
+ if (CfgMgrInfo == NULL) {
return EFI_INVALID_PARAMETER;
}
- if (CmObjectDesc.Size <
- (sizeof (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO) * CmObjectDesc.Count)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: EStdObjCfgMgrInfo: Buffer too small, size = 0x%x\n",
- CmObjectDesc.Size
- ));
- ASSERT (FALSE);
- return EFI_BAD_BUFFER_SIZE;
- }
+ *CfgMgrInfo = NULL;
- *CfgMfrInfo = (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO*)CmObjectDesc.Data;
- return Status;
+ return CfgMgrGetSimpleObject (EStdObjCfgMgrInfo, (VOID **)CfgMgrInfo);
}
/** The AddAcpiHeader function updates the ACPI header structure pointed by
@@ -467,8 +423,6 @@ GetCgfMgrInfo (
Manager protocol to obtain any information required for constructing the
header.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- protocol interface.
@param [in] Generator Pointer to the ACPI table Generator.
@param [in,out] AcpiHeader Pointer to the ACPI table header to be
updated.
@@ -478,14 +432,10 @@ GetCgfMgrInfo (
@retval EFI_SUCCESS The ACPI table is updated successfully.
@retval EFI_INVALID_PARAMETER A parameter is invalid.
@retval EFI_NOT_FOUND The required object information is not found.
- @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
- Manager is less than the Object size for the
- requested object.
**/
EFI_STATUS
EFIAPI
AddAcpiHeader (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST ACPI_TABLE_GENERATOR * CONST Generator,
IN OUT EFI_ACPI_DESCRIPTION_HEADER * CONST AcpiHeader,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo,
@@ -495,27 +445,17 @@ AddAcpiHeader (
EFI_STATUS Status;
CM_STD_OBJ_CONFIGURATION_MANAGER_INFO * CfgMfrInfo;
- ASSERT (CfgMgrProtocol != NULL);
- ASSERT (Generator != NULL);
- ASSERT (AcpiHeader != NULL);
- ASSERT (Length >= sizeof (EFI_ACPI_DESCRIPTION_HEADER));
-
- if ((CfgMgrProtocol == NULL) ||
- (Generator == NULL) ||
+ if ((Generator == NULL) ||
(AcpiHeader == NULL) ||
- (Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER))
- ) {
+ (Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER))) {
+ DEBUG ((DEBUG_ERROR,
+ "ERROR: Cannot add ACPI header [Invalid Pamrameter].\n"));
return EFI_INVALID_PARAMETER;
}
- Status = GetCgfMgrInfo (CfgMgrProtocol, &CfgMfrInfo);
+ Status = CfgMgrGetInfo (&CfgMfrInfo);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: Failed to get Configuration Manager info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
// UINT32 Signature
@@ -555,8 +495,9 @@ AddAcpiHeader (
// UINT32 CreatorRevision
AcpiHeader->CreatorRevision = Generator->CreatorRevision;
-error_handler:
- return Status;
+ FreePool (CfgMfrInfo);
+
+ return EFI_SUCCESS;
}
/**
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
index 0fbc1fe5b2..4ee478dab9 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
@@ -32,6 +32,5 @@
[Protocols]
gEfiSerialIoProtocolGuid
-
-[Guids]
+ gEdkiiConfigurationManagerProtocolGuid
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 8/8] DynamicTablesPkg: Remove GET_OBJECT_LIST
2020-07-31 16:19 [PATCH 0/8] ConfigurationManagerProtocol update Tomas Pilar (tpilar)
` (6 preceding siblings ...)
2020-07-31 16:19 ` [PATCH 7/8] DynamicTablesPkg: Simplify AddAcpiHeader, CfgMgrGetInfo Tomas Pilar (tpilar)
@ 2020-07-31 16:19 ` Tomas Pilar (tpilar)
7 siblings, 0 replies; 9+ messages in thread
From: Tomas Pilar (tpilar) @ 2020-07-31 16:19 UTC (permalink / raw)
To: devel; +Cc: Sami Mujawar, Alexei Fedorov
Replace macro-generated accessor functions in DynamicTables
generators with TableHelperLib helpers that are compatible
with v1.1 revision of Configuration Manager Protocol.
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Tomas Pilar <tomas@nuviainc.com>
---
.../DynamicTableFactoryDxe.c | 1 -
.../DynamicTableManagerDxe.c | 34 +-
.../Include/ConfigurationManagerHelper.h | 126 --
.../Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c | 34 +-
.../Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c | 199 +---
.../Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c | 234 ++--
.../Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 1058 +++++------------
.../Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c | 304 ++---
.../Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c | 100 +-
.../Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 287 ++---
.../Acpi/Arm/AcpiRawLibArm/RawGenerator.c | 1 -
.../Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c | 35 +-
.../Acpi/Arm/AcpiSratLibArm/SratGenerator.c | 437 +++----
13 files changed, 785 insertions(+), 2065 deletions(-)
delete mode 100644 DynamicTablesPkg/Include/ConfigurationManagerHelper.h
diff --git a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
index d1432348f0..b8f3e1c877 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
+++ b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
@@ -15,7 +15,6 @@
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
-#include <ConfigurationManagerHelper.h>
#include <DeviceTreeTableGenerator.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
index b194a38659..ae827fdf2c 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
@@ -8,6 +8,7 @@
**/
#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
#include <Library/PcdLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/AcpiTable.h>
@@ -15,22 +16,12 @@
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
-#include <ConfigurationManagerHelper.h>
#include <DeviceTreeTableGenerator.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
#include <Protocol/DynamicTableFactoryProtocol.h>
#include <SmbiosTableGenerator.h>
-/** This macro expands to a function that retrieves the ACPI Table
- List from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceStandard,
- EStdObjAcpiTableList,
- CM_STD_OBJ_ACPI_TABLE_INFO
- )
-
/** A helper function to build and install a single ACPI table.
This is a helper function that invokes the Table generator interface
@@ -516,12 +507,7 @@ ProcessAcpiTables (
return Status;
}
- Status = GetEStdObjAcpiTableList (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &AcpiTableInfo,
- &AcpiTableCount
- );
+ Status = CfgMgrCountObjects (EStdObjAcpiTableList, &AcpiTableCount);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -546,6 +532,9 @@ ProcessAcpiTables (
AcpiTableCount
));
+ CfgMgrGetObjects (
+ EStdObjAcpiTableList, CM_NULL_TOKEN, (VOID**)&AcpiTableInfo, &AcpiTableCount);
+
// Check if mandatory ACPI tables are present.
Status = VerifyMandatoryTablesArePresent (
AcpiTableInfo,
@@ -558,7 +547,7 @@ ProcessAcpiTables (
" Status = %r\n",
Status
));
- return Status;
+ goto EXIT;
}
// Add the FADT Table first.
@@ -578,7 +567,7 @@ ProcessAcpiTables (
" Status = %r\n",
Status
));
- return Status;
+ goto EXIT;
}
break;
}
@@ -626,10 +615,12 @@ ProcessAcpiTables (
" Status = %r\n",
Status
));
- return Status;
+ goto EXIT;
}
} // for
+EXIT:
+ FreePool(AcpiTableInfo);
return Status;
}
@@ -697,11 +688,6 @@ DynamicTableManagerDxeInitialize (
Status = CfgMgrGetInfo (&CfgMgrInfo);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: Failed to get Configuration Manager info. Status = %r\n",
- Status
- ));
return Status;
}
diff --git a/DynamicTablesPkg/Include/ConfigurationManagerHelper.h b/DynamicTablesPkg/Include/ConfigurationManagerHelper.h
deleted file mode 100644
index 29f34a0434..0000000000
--- a/DynamicTablesPkg/Include/ConfigurationManagerHelper.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/** @file
-
- Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
- @par Glossary:
- - Cm or CM - Configuration Manager
- - Obj or OBJ - Object
-**/
-
-#ifndef CONFIGURATION_MANAGER_HELPER_H_
-#define CONFIGURATION_MANAGER_HELPER_H_
-
-/** The GET_OBJECT_LIST macro expands to a function that is used to retrieve
- an object or an object list from the Configuration Manager using the
- Configuration Manager Protocol interface.
-
- The macro expands to a function which has the following prototype:
-
- STATIC
- EFI_STATUS
- EFIAPI
- Get<CmObjectId> (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
- IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
- OUT Type ** List,
- OUT UINT32 * Count OPTIONAL
- );
-
- Generated function parameters:
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager protocol
- interface.
- @param [in] Token Reference token for the Object.
- @param [out] List Pointer to the Object list.
- @param [out] Count Count of the objects returned in the list.
-
- Macro Parameters:
- @param [in] CmObjectNameSpace The Object Namespace
- @param [in] CmObjectId Object Id.
- @param [in] Type Structure used to describe the Object.
-
- @retval EFI_SUCCESS Success.
- @retval EFI_INVALID_PARAMETER A parameter is invalid.
- @retval EFI_NOT_FOUND The required object information is not found.
- @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
- Manager is less than the Object size for the
- requested object.
-**/
-#define GET_OBJECT_LIST(CmObjectNameSpace, CmObjectId, Type) \
-STATIC \
-EFI_STATUS \
-EFIAPI \
-Get##CmObjectId ( \
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, \
- IN CONST CM_OBJECT_TOKEN Token OPTIONAL, \
- OUT Type ** List, \
- OUT UINT32 * CONST Count OPTIONAL \
- ) \
-{ \
- EFI_STATUS Status; \
- CM_OBJ_DESCRIPTOR CmObjectDesc; \
- UINT32 ObjCount = 0; \
- if (List == NULL) { \
- Status = EFI_INVALID_PARAMETER; \
- DEBUG (( \
- DEBUG_ERROR, \
- "ERROR: Get" #CmObjectId ": Invalid out parameter for" \
- " object list. Status = %r\n", \
- Status \
- )); \
- goto error_handler; \
- } \
- Status = CfgMgrProtocol->GetObject ( \
- CfgMgrProtocol, \
- CREATE_CM_OBJECT_ID ( \
- CmObjectNameSpace, \
- CmObjectId \
- ), \
- Token, \
- &CmObjectDesc \
- ); \
- if (EFI_ERROR (Status)) { \
- DEBUG (( \
- DEBUG_INFO, \
- "INFO: Get" #CmObjectId ": Platform does not implement " \
- #CmObjectId ". Status = %r\n", \
- Status \
- )); \
- *List = NULL; \
- goto error_handler; \
- } \
- if (CmObjectDesc.ObjectId != \
- CREATE_CM_OBJECT_ID (CmObjectNameSpace, CmObjectId)) { \
- DEBUG (( \
- DEBUG_ERROR, \
- "ERROR: Get" #CmObjectId ": " #CmObjectId \
- ": Invalid ObjectId = 0x%x\n, expected Id = 0x%x\n", \
- CmObjectDesc.ObjectId, \
- CREATE_CM_OBJECT_ID (CmObjectNameSpace, CmObjectId) \
- )); \
- ASSERT (FALSE); \
- Status = EFI_INVALID_PARAMETER; \
- goto error_handler; \
- } \
- if (CmObjectDesc.Size < (sizeof (Type) * CmObjectDesc.Count)) { \
- DEBUG (( \
- DEBUG_ERROR, \
- "ERROR: Get" #CmObjectId ": " #CmObjectId \
- ": Buffer too small, size = 0x%x\n", \
- CmObjectDesc.Size \
- )); \
- ASSERT (FALSE); \
- Status = EFI_BAD_BUFFER_SIZE; \
- goto error_handler; \
- } \
- ObjCount = CmObjectDesc.Count; \
- *List = (Type*)CmObjectDesc.Data; \
-error_handler: \
- if (Count != NULL) { \
- *Count = ObjCount; \
- } \
- return Status; \
-}
-
-#endif // CONFIGURATION_MANAGER_HELPER_H_
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
index 21a7f9bf64..b6a1dc0ddf 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
@@ -12,6 +12,7 @@
#include <IndustryStandard/DebugPort2Table.h>
#include <Library/AcpiLib.h>
#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
#include <Library/PL011UartLib.h>
#include <Protocol/AcpiTable.h>
#include <Protocol/SerialIo.h>
@@ -19,7 +20,6 @@
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
-#include <ConfigurationManagerHelper.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
@@ -166,15 +166,6 @@ DBG2_TABLE AcpiDbg2 = {
#pragma pack()
-/** This macro expands to a function that retrieves the Serial
- debug port information from the Configuration Manager
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjSerialDebugPortInfo,
- CM_ARM_SERIAL_PORT_INFO
- );
-
/** Initialize the PL011/SBSA UART with the parameters obtained from
the Configuration Manager.
@@ -285,21 +276,14 @@ BuildDbg2Table (
return EFI_INVALID_PARAMETER;
}
+ // Pointers to allocated memory
*Table = NULL;
- Status = GetEArmObjSerialDebugPortInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &SerialPortInfo,
- NULL
- );
+ Status = CfgMgrGetSimpleObject (
+ EArmObjSerialDebugPortInfo, (VOID **)&SerialPortInfo);
+
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: DBG2: Failed to get serial port information. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
if (SerialPortInfo->BaseAddress == 0) {
@@ -335,11 +319,6 @@ BuildDbg2Table (
AcpiTableInfo,
sizeof (DBG2_TABLE));
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: DBG2: Failed to add ACPI header. Status = %r\n",
- Status
- ));
goto error_handler;
}
@@ -372,6 +351,7 @@ BuildDbg2Table (
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2;
error_handler:
+ FreePool(SerialPortInfo);
return Status;
}
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
index febaca3dae..8b523b0e3d 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
@@ -11,12 +11,12 @@
#include <Library/AcpiLib.h>
#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
#include <Protocol/AcpiTable.h>
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
-#include <ConfigurationManagerHelper.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
@@ -198,47 +198,8 @@ EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
#pragma pack()
-/** This macro expands to a function that retrieves the Power
- Management Profile Information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPowerManagementProfileInfo,
- CM_ARM_POWER_MANAGEMENT_PROFILE_INFO
- );
-
-/** This macro expands to a function that retrieves the Boot
- Architecture Information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjBootArchInfo,
- CM_ARM_BOOT_ARCH_INFO
- );
-
-/** This macro expands to a function that retrieves the Hypervisor
- Vendor ID from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjHypervisorVendorIdentity,
- CM_ARM_HYPERVISOR_VENDOR_ID
- );
-
-/** This macro expands to a function that retrieves the Fixed
- feature flags for the platform from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjFixedFeatureFlags,
- CM_ARM_FIXED_FEATURE_FLAGS
- );
-
/** Update the Power Management Profile information in the FADT Table.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
-
@retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER A parameter is invalid.
@retval EFI_NOT_FOUND The required object was not found.
@@ -249,30 +210,16 @@ GET_OBJECT_LIST (
STATIC
EFI_STATUS
EFIAPI
-FadtAddPmProfileInfo (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol
-)
+FadtAddPmProfileInfo (VOID)
{
EFI_STATUS Status;
CM_ARM_POWER_MANAGEMENT_PROFILE_INFO * PmProfile;
- ASSERT (CfgMgrProtocol != NULL);
-
// Get the Power Management Profile from the Platform Configuration Manager
- Status = GetEArmObjPowerManagementProfileInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &PmProfile,
- NULL
- );
+ Status = CfgMgrGetSimpleObject (
+ EArmObjPowerManagementProfileInfo, (VOID **)&PmProfile);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: FADT: Failed to get Power Management Profile information." \
- " Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
DEBUG ((
@@ -283,15 +230,13 @@ FadtAddPmProfileInfo (
AcpiFadt.PreferredPmProfile = PmProfile->PowerManagementProfile;
-error_handler:
- return Status;
+ FreePool(PmProfile);
+
+ return EFI_SUCCESS;
}
/** Updates the Boot Architecture information in the FADT Table.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
-
@retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER A parameter is invalid.
@retval EFI_NOT_FOUND The required object was not found.
@@ -302,29 +247,15 @@ error_handler:
STATIC
EFI_STATUS
EFIAPI
-FadtAddBootArchInfo (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol
-)
+FadtAddBootArchInfo (VOID)
{
EFI_STATUS Status;
CM_ARM_BOOT_ARCH_INFO * BootArchInfo;
- ASSERT (CfgMgrProtocol != NULL);
-
// Get the Boot Architecture flags from the Platform Configuration Manager
- Status = GetEArmObjBootArchInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &BootArchInfo,
- NULL
- );
+ Status = CfgMgrGetSimpleObject (EArmObjBootArchInfo, (VOID **)&BootArchInfo);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: FADT: Failed to get Boot Architecture flags. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
DEBUG ((
@@ -335,15 +266,13 @@ FadtAddBootArchInfo (
AcpiFadt.ArmBootArch = BootArchInfo->BootArchFlags;
-error_handler:
- return Status;
+ FreePool(BootArchInfo);
+
+ return EFI_SUCCESS;
}
/** Update the Hypervisor Vendor ID in the FADT Table.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
-
@retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER A parameter is invalid.
@retval EFI_NOT_FOUND The required object was not found.
@@ -354,38 +283,16 @@ error_handler:
STATIC
EFI_STATUS
EFIAPI
-FadtAddHypervisorVendorId (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol
-)
+FadtAddHypervisorVendorId (VOID)
{
EFI_STATUS Status;
CM_ARM_HYPERVISOR_VENDOR_ID * HypervisorVendorInfo;
- ASSERT (CfgMgrProtocol != NULL);
-
// Get the Hypervisor Vendor ID from the Platform Configuration Manager
- Status = GetEArmObjHypervisorVendorIdentity (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &HypervisorVendorInfo,
- NULL
- );
+ Status = CfgMgrGetSimpleObject (
+ EArmObjHypervisorVendorIdentity, (VOID **) &HypervisorVendorInfo);
if (EFI_ERROR (Status)) {
- if (Status == EFI_NOT_FOUND) {
- DEBUG ((
- DEBUG_INFO,
- "INFO: FADT: Platform does not have a Hypervisor Vendor ID."
- "Status = %r\n",
- Status
- ));
- } else {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: FADT: Failed to get Hypervisor Vendor ID. Status = %r\n",
- Status
- ));
- }
- goto error_handler;
+ return Status;
}
DEBUG ((
@@ -396,8 +303,9 @@ FadtAddHypervisorVendorId (
AcpiFadt.HypervisorVendorIdentity = HypervisorVendorInfo->HypervisorVendorId;
-error_handler:
- return Status;
+ FreePool (HypervisorVendorInfo);
+
+ return EFI_SUCCESS;
}
/** Update the Fixed Feature Flags in the FADT Table.
@@ -415,38 +323,17 @@ error_handler:
STATIC
EFI_STATUS
EFIAPI
-FadtAddFixedFeatureFlags (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol
-)
+FadtAddFixedFeatureFlags (VOID)
{
EFI_STATUS Status;
CM_ARM_FIXED_FEATURE_FLAGS * FixedFeatureFlags;
- ASSERT (CfgMgrProtocol != NULL);
-
// Get the Fixed feature flags from the Platform Configuration Manager
- Status = GetEArmObjFixedFeatureFlags (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &FixedFeatureFlags,
- NULL
- );
+
+ Status = CfgMgrGetSimpleObject (
+ EArmObjFixedFeatureFlags, (VOID **)&FixedFeatureFlags);
if (EFI_ERROR (Status)) {
- if (Status == EFI_NOT_FOUND) {
- DEBUG ((
- DEBUG_INFO,
- "INFO: FADT: Platform does not define additional Fixed feature flags."
- "Status = %r\n",
- Status
- ));
- } else {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: FADT: Failed to get Fixed feature flags. Status = %r\n",
- Status
- ));
- }
- goto error_handler;
+ return Status;
}
DEBUG ((
@@ -467,8 +354,9 @@ FadtAddFixedFeatureFlags (
AcpiFadt.Flags |= (FixedFeatureFlags->Flags &
VALID_HARDWARE_REDUCED_FLAG_MASK);
-error_handler:
- return Status;
+ FreePool (FixedFeatureFlags);
+
+ return EFI_SUCCESS;
}
/** Construct the FADT table.
@@ -507,7 +395,6 @@ BuildFadtTable (
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
- ASSERT (CfgMgrProtocol != NULL);
ASSERT (Table != NULL);
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
@@ -533,30 +420,25 @@ BuildFadtTable (
AcpiTableInfo,
sizeof (EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE));
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: FADT: Failed to add ACPI header. Status = %r\n",
- Status
- ));
return Status;
}
// Update PmProfile Info
- Status = FadtAddPmProfileInfo (CfgMgrProtocol);
+ Status = FadtAddPmProfileInfo ();
if (EFI_ERROR (Status)) {
- goto error_handler;
+ return Status;
}
// Update BootArch Info
- Status = FadtAddBootArchInfo (CfgMgrProtocol);
+ Status = FadtAddBootArchInfo ();
if (EFI_ERROR (Status)) {
- goto error_handler;
+ return Status;
}
// Add the Hypervisor Vendor Id if present
// Note if no hypervisor is present the zero bytes
// will be placed in this field.
- Status = FadtAddHypervisorVendorId (CfgMgrProtocol);
+ Status = FadtAddHypervisorVendorId ();
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND) {
DEBUG ((
@@ -570,11 +452,11 @@ BuildFadtTable (
"ERROR: FADT: Error reading Hypervisor Vendor ID, Status = %r",
Status
));
- goto error_handler;
+ return Status;
}
}
- Status = FadtAddFixedFeatureFlags (CfgMgrProtocol);
+ Status = FadtAddFixedFeatureFlags ();
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND) {
DEBUG ((
@@ -582,20 +464,19 @@ BuildFadtTable (
"INFO: FADT: No Fixed feature flags found," \
" assuming no additional flags are defined for the platform.\n"
));
- Status = EFI_SUCCESS;
} else {
DEBUG ((
DEBUG_ERROR,
"ERROR: FADT: Error reading Fixed feature flags, Status = %r",
Status
));
- goto error_handler;
+ return Status;
}
}
- *Table = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt;
-error_handler:
- return Status;
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER *) &AcpiFadt;
+
+ return EFI_SUCCESS;
}
/** This macro defines the FADT Table Generator revision.
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
index 4af410fb5b..119265187a 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
@@ -17,7 +17,6 @@
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
-#include <ConfigurationManagerHelper.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
@@ -32,49 +31,11 @@ Requirements:
- EArmObjGTBlockTimerFrameInfo (OPTIONAL)
*/
-/** This macro expands to a function that retrieves the Generic
- Timer Information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGenericTimerInfo,
- CM_ARM_GENERIC_TIMER_INFO
- );
-
-/** This macro expands to a function that retrieves the SBSA Generic
- Watchdog Timer Information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPlatformGenericWatchdogInfo,
- CM_ARM_GENERIC_WATCHDOG_INFO
- );
-
-/** This macro expands to a function that retrieves the Platform Generic
- Timer Block Information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPlatformGTBlockInfo,
- CM_ARM_GTBLOCK_INFO
- );
-
-/** This macro expands to a function that retrieves the Generic
- Timer Block Timer Frame Information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGTBlockTimerFrameInfo,
- CM_ARM_GTBLOCK_TIMER_FRAME_INFO
- );
-
/** Add the Generic Timer Information to the GTDT table.
Also update the Platform Timer offset information if the platform
implements platform timers.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] Gtdt Pointer to the GTDT Table.
@param [in] PlatformTimerCount Platform timer count.
@param [in] AcpiTableRevision Acpi Revision targeted by the platform.
@@ -90,7 +51,6 @@ STATIC
EFI_STATUS
EFIAPI
AddGenericTimerInfo (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
IN CONST UINT32 PlatformTimerCount,
IN CONST UINT32 AcpiTableRevision
@@ -99,24 +59,13 @@ AddGenericTimerInfo (
EFI_STATUS Status;
CM_ARM_GENERIC_TIMER_INFO * GenericTimerInfo;
- ASSERT (CfgMgrProtocol != NULL);
- ASSERT (Gtdt != NULL);
-
- Status = GetEArmObjGenericTimerInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GenericTimerInfo,
- NULL
- );
+ ASSERT (Gtdt != NULL);
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: GTDT: Failed to get GenericTimerInfo. Status = %r\n",
- Status
- ));
- return Status;
- }
+ Status = CfgMgrGetSimpleObject (
+ EArmObjGenericTimerInfo, (VOID **)&GenericTimerInfo);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
Gtdt->CntControlBasePhysicalAddress =
GenericTimerInfo->CounterControlBaseAddress;
@@ -140,7 +89,9 @@ AddGenericTimerInfo (
Gtdt->VirtualPL2TimerFlags = GenericTimerInfo->VirtualPL2TimerFlags;
}
- return Status;
+ FreePool (GenericTimerInfo);
+
+ return EFI_SUCCESS;
}
/** Add the SBSA Generic Watchdog Timers to the GTDT table.
@@ -148,26 +99,36 @@ AddGenericTimerInfo (
@param [in] Gtdt Pointer to the GTDT Table.
@param [in] WatchdogOffset Offset to the watchdog information in the
GTDT Table.
- @param [in] WatchdogInfoList Pointer to the watchdog information list.
- @param [in] WatchdogCount Platform timer count.
**/
STATIC
VOID
AddGenericWatchdogList (
IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
- IN CONST UINT32 WatchdogOffset,
- IN CONST CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList,
- IN UINT32 WatchdogCount
+ IN CONST UINT32 WatchdogOffset
)
{
EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE * Watchdog;
+ UINT32 WatchdogCount;
+ VOID *WatchdogInfoList;
+ CM_ARM_GENERIC_WATCHDOG_INFO *Cursor;
+ EFI_STATUS Status;
ASSERT (Gtdt != NULL);
- ASSERT (WatchdogInfoList != NULL);
+
+ Status = CfgMgrGetObjects (
+ EArmObjPlatformGenericWatchdogInfo,
+ CM_NULL_TOKEN,
+ &WatchdogInfoList,
+ &WatchdogCount);
+
+ if (EFI_ERROR(Status)) {
+ return;
+ }
Watchdog = (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE *)
((UINT8*)Gtdt + WatchdogOffset);
+ Cursor = WatchdogInfoList;
while (WatchdogCount-- != 0) {
// Add watchdog entry
DEBUG ((DEBUG_INFO, "GTDT: Watchdog = 0x%p\n", Watchdog));
@@ -176,14 +137,16 @@ AddGenericWatchdogList (
sizeof (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE);
Watchdog->Reserved = EFI_ACPI_RESERVED_BYTE;
Watchdog->RefreshFramePhysicalAddress =
- WatchdogInfoList->RefreshFrameAddress;
+ Cursor->RefreshFrameAddress;
Watchdog->WatchdogControlFramePhysicalAddress =
- WatchdogInfoList->ControlFrameAddress;
- Watchdog->WatchdogTimerGSIV = WatchdogInfoList->TimerGSIV;
- Watchdog->WatchdogTimerFlags = WatchdogInfoList->Flags;
+ Cursor->ControlFrameAddress;
+ Watchdog->WatchdogTimerGSIV = Cursor->TimerGSIV;
+ Watchdog->WatchdogTimerFlags = Cursor->Flags;
Watchdog++;
- WatchdogInfoList++;
+ Cursor++;
} // for
+
+ FreePool (WatchdogInfoList);
}
/**
@@ -313,8 +276,6 @@ AddGTBlockTimerFrames (
/** Add the GT Block Timers in the GTDT Table.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] Gtdt Pointer to the GTDT Table.
@param [in] GTBlockOffset Offset of the GT Block
information in the GTDT Table.
@@ -328,7 +289,6 @@ AddGTBlockTimerFrames (
STATIC
EFI_STATUS
AddGTBlockList (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt,
IN CONST UINT32 GTBlockOffset,
IN CONST CM_ARM_GTBLOCK_INFO * GTBlockInfo,
@@ -351,12 +311,11 @@ AddGTBlockList (
while (BlockTimerCount-- != 0) {
DEBUG ((DEBUG_INFO, "GTDT: GTBlock = 0x%p\n", GTBlock));
- Status = GetEArmObjGTBlockTimerFrameInfo (
- CfgMgrProtocol,
- GTBlockInfo->GTBlockTimerFrameToken,
- >BlockTimerFrameList,
- >BlockTimerFrameCount
- );
+ Status = CfgMgrGetObjects (
+ EArmObjGTBlockTimerFrameInfo,
+ GTBlockInfo->GTBlockTimerFrameToken,
+ NULL,
+ >BlockTimerFrameCount);
if (EFI_ERROR (Status) ||
(GTBlockTimerFrameCount != GTBlockInfo->GTBlockTimerFrameCount)) {
DEBUG ((
@@ -397,18 +356,20 @@ AddGTBlockList (
GtBlockFrame = (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE*)
((UINT8*)GTBlock + GTBlock->GTBlockTimerOffset);
+ CfgMgrGetObjects (
+ EArmObjGTBlockTimerFrameInfo,
+ GTBlockInfo->GTBlockTimerFrameToken,
+ (VOID **)>BlockTimerFrameList,
+ >BlockTimerFrameCount);
+
// Add GT Block Timer frames
Status = AddGTBlockTimerFrames (
GtBlockFrame,
GTBlockTimerFrameList,
GTBlockTimerFrameCount
);
+ FreePool (GTBlockTimerFrameList);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: GTDT: Failed to add Generic Timer Frames. Status = %r\n",
- Status
- ));
return Status;
}
@@ -458,7 +419,6 @@ BuildGtdtTable (
UINT32 PlatformTimerCount;
UINT32 WatchdogCount;
UINT32 BlockTimerCount;
- CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList;
CM_ARM_GTBLOCK_INFO * GTBlockInfo;
EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * Gtdt;
UINT32 Idx;
@@ -467,7 +427,6 @@ BuildGtdtTable (
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
- ASSERT (CfgMgrProtocol != NULL);
ASSERT (Table != NULL);
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
@@ -485,46 +444,15 @@ BuildGtdtTable (
return EFI_INVALID_PARAMETER;
}
- *Table = NULL;
- Status = GetEArmObjPlatformGTBlockInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- >BlockInfo,
- &BlockTimerCount
- );
- if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: GTDT: Failed to Get Platform GT Block Information." \
- " Status = %r\n",
- Status
- ));
- goto error_handler;
- }
-
- Status = GetEArmObjPlatformGenericWatchdogInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &WatchdogInfoList,
- &WatchdogCount
- );
+ Status = CfgMgrGetObjects (
+ EArmObjPlatformGTBlockInfo,
+ CM_NULL_TOKEN,
+ (VOID **)>BlockInfo,
+ &BlockTimerCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: GTDT: Failed to Get Platform Generic Watchdog Information." \
- " Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
- DEBUG ((
- DEBUG_INFO,
- "GTDT: BlockTimerCount = %d, WatchdogCount = %d\n",
- BlockTimerCount,
- WatchdogCount
- ));
-
// Calculate the GTDT Table Size
PlatformTimerCount = 0;
TableSize = sizeof (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE);
@@ -558,6 +486,20 @@ BuildGtdtTable (
));
}
+ WatchdogCount = 0;
+ Status = CfgMgrCountObjects (
+ EArmObjPlatformGenericWatchdogInfo, &WatchdogCount);
+ if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
+ goto error_handler;
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "GTDT: BlockTimerCount = %d, WatchdogCount = %d\n",
+ BlockTimerCount,
+ WatchdogCount
+ ));
+
WatchdogOffset = 0;
if (WatchdogCount != 0) {
WatchdogOffset = TableSize;
@@ -572,20 +514,12 @@ BuildGtdtTable (
));
}
- *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
- if (*Table == NULL) {
+ Gtdt = AllocateZeroPool (TableSize);
+ if (Gtdt == NULL) {
Status = EFI_OUT_OF_RESOURCES;
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: GTDT: Failed to allocate memory for GTDT Table, Size = %d," \
- " Status = %r\n",
- TableSize,
- Status
- ));
goto error_handler;
}
- Gtdt = (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table;
DEBUG ((
DEBUG_INFO,
"GTDT: Gtdt = 0x%p TableSize = 0x%x\n",
@@ -595,20 +529,11 @@ BuildGtdtTable (
Status = AddAcpiHeader (This, &Gtdt->Header, AcpiTableInfo, TableSize);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: GTDT: Failed to add ACPI header. Status = %r\n",
- Status
- ));
goto error_handler;
}
Status = AddGenericTimerInfo (
- CfgMgrProtocol,
- Gtdt,
- PlatformTimerCount,
- AcpiTableInfo->AcpiTableRevision
- );
+ Gtdt, PlatformTimerCount, AcpiTableInfo->AcpiTableRevision);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -619,13 +544,7 @@ BuildGtdtTable (
}
if (BlockTimerCount != 0) {
- Status = AddGTBlockList (
- CfgMgrProtocol,
- Gtdt,
- GTBlockOffset,
- GTBlockInfo,
- BlockTimerCount
- );
+ Status = AddGTBlockList (Gtdt, GTBlockOffset, GTBlockInfo, BlockTimerCount);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -637,21 +556,19 @@ BuildGtdtTable (
}
if (WatchdogCount != 0) {
- AddGenericWatchdogList (
- Gtdt,
- WatchdogOffset,
- WatchdogInfoList,
- WatchdogCount
- );
+ AddGenericWatchdogList (Gtdt, WatchdogOffset);
}
+ FreePool (GTBlockInfo);
+
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER *)Gtdt;
return Status;
error_handler:
- if (*Table != NULL) {
- FreePool (*Table);
- *Table = NULL;
+ if (Gtdt != NULL) {
+ FreePool (Gtdt);
}
+ FreePool (GTBlockInfo);
return Status;
}
@@ -677,7 +594,6 @@ FreeGtdtTableResources (
{
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
- ASSERT (CfgMgrProtocol != NULL);
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
index 97f86ddb30..dc518238c7 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
@@ -20,7 +20,6 @@
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
-#include <ConfigurationManagerHelper.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
@@ -42,244 +41,82 @@ Requirements:
- EArmObjGicItsIdentifierArray
*/
-/** This macro expands to a function that retrieves the ITS
- Group node information from the Configuration Manager.
+/*
+ Function type that evaluates the size of a node and sets
+ the node pointer to the next node. Used in iteration over
+ node lists.
*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjItsGroup,
- CM_ARM_ITS_GROUP_NODE
- );
-
-/** This macro expands to a function that retrieves the
- Named Component node information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjNamedComponent,
- CM_ARM_NAMED_COMPONENT_NODE
- );
-
-/** This macro expands to a function that retrieves the
- Root Complex node information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjRootComplex,
- CM_ARM_ROOT_COMPLEX_NODE
- );
-
-/** This macro expands to a function that retrieves the
- SMMU v1/v2 node information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjSmmuV1SmmuV2,
- CM_ARM_SMMUV1_SMMUV2_NODE
- );
-
-/** This macro expands to a function that retrieves the
- SMMU v3 node information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjSmmuV3,
- CM_ARM_SMMUV3_NODE
- );
-
-/** This macro expands to a function that retrieves the
- PMCG node information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPmcg,
- CM_ARM_PMCG_NODE
- );
-
-/** This macro expands to a function that retrieves the
- ITS Identifier Array information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGicItsIdentifierArray,
- CM_ARM_ITS_IDENTIFIER
- );
-
-/** This macro expands to a function that retrieves the
- Id Mapping Array information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjIdMappingArray,
- CM_ARM_ID_MAPPING
- );
-
-/** This macro expands to a function that retrieves the
- SMMU Interrupt Array information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjSmmuInterruptArray,
- CM_ARM_SMMU_INTERRUPT
- );
+typedef UINT32 (EFIAPI *INDEX_NODE)(VOID ** Node);
-/** Returns the size of the ITS Group node.
-
- @param [in] Node Pointer to ITS Group node.
+/** Returns the size of the ITS Group node, increments
+ to the next node.
+ @param [in,out] Ptr Pointer to ITS Group node.
@retval Size of the ITS Group Node.
**/
STATIC
UINT32
GetItsGroupNodeSize (
- IN CONST CM_ARM_ITS_GROUP_NODE * Node
+ IN OUT VOID ** Ptr
)
{
- ASSERT (Node != NULL);
+ ASSERT (Ptr != NULL && *Ptr != NULL);
+
+ CM_ARM_ITS_GROUP_NODE *Node = *Ptr;
+ *Ptr = Node + 1;
/* Size of ITS Group Node +
Size of ITS Identifier array
*/
- return (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE) +
- (Node->ItsIdCount * sizeof (UINT32)));
-}
-
-/** Returns the total size required for the ITS Group nodes and
- updates the Node Indexer.
-
- This function calculates the size required for the node group
- and also populates the Node Indexer array with offsets for the
- individual nodes.
-
- @param [in] NodeStartOffset Offset from the start of the
- IORT where this node group starts.
- @param [in] NodeList Pointer to ITS Group node list.
- @param [in] NodeCount Count of the ITS Group nodes.
- @param [in, out] NodeIndexer Pointer to the next Node Indexer.
-
- @retval Total size of the ITS Group Nodes.
-**/
-STATIC
-UINT64
-GetSizeofItsGroupNodes (
- IN CONST UINT32 NodeStartOffset,
- IN CONST CM_ARM_ITS_GROUP_NODE * NodeList,
- IN UINT32 NodeCount,
- IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer
- )
-{
- UINT64 Size;
-
- ASSERT (NodeList != NULL);
-
- Size = 0;
- while (NodeCount-- != 0) {
- (*NodeIndexer)->Token = NodeList->Token;
- (*NodeIndexer)->Object = (VOID*)NodeList;
- (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
- DEBUG ((
- DEBUG_INFO,
- "IORT: Node Indexer = %p, Token = %p, Object = %p, Offset = 0x%x\n",
- *NodeIndexer,
- (*NodeIndexer)->Token,
- (*NodeIndexer)->Object,
- (*NodeIndexer)->Offset
- ));
-
- Size += GetItsGroupNodeSize (NodeList);
- (*NodeIndexer)++;
- NodeList++;
- }
- return Size;
+ return (UINT32) (
+ sizeof (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE) +
+ (Node->ItsIdCount) * sizeof (UINT32));
}
-/** Returns the size of the Named Component node.
-
- @param [in] Node Pointer to Named Component node.
+/** Returns the size of the Named Component node and
+ point to the next node
+ @param [in,out] Ptr Pointer to Named Component node.
@retval Size of the Named Component node.
**/
STATIC
UINT32
GetNamedComponentNodeSize (
- IN CONST CM_ARM_NAMED_COMPONENT_NODE * Node
+ IN OUT VOID ** Ptr
)
{
- ASSERT (Node != NULL);
+ ASSERT (Ptr != NULL && *Ptr != NULL);
+
+ CM_ARM_NAMED_COMPONENT_NODE * Node = *Ptr;
+ *Ptr = Node + 1;
/* Size of Named Component node +
Size of ID mapping array +
Size of ASCII string + 'padding to 32-bit word aligned'.
*/
+
return (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE) +
- (Node->IdMappingCount *
+ ((Node->IdMappingCount *
sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)) +
- ALIGN_VALUE (AsciiStrSize (Node->ObjectName), 4));
-}
-
-/** Returns the total size required for the Named Component nodes and
- updates the Node Indexer.
-
- This function calculates the size required for the node group
- and also populates the Node Indexer array with offsets for the
- individual nodes.
-
- @param [in] NodeStartOffset Offset from the start of the
- IORT where this node group starts.
- @param [in] NodeList Pointer to Named Component node list.
- @param [in] NodeCount Count of the Named Component nodes.
- @param [in, out] NodeIndexer Pointer to the next Node Indexer.
-
- @retval Total size of the Named Component nodes.
-**/
-STATIC
-UINT64
-GetSizeofNamedComponentNodes (
- IN CONST UINT32 NodeStartOffset,
- IN CONST CM_ARM_NAMED_COMPONENT_NODE * NodeList,
- IN UINT32 NodeCount,
- IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer
- )
-{
- UINT64 Size;
-
- ASSERT (NodeList != NULL);
-
- Size = 0;
- while (NodeCount-- != 0) {
- (*NodeIndexer)->Token = NodeList->Token;
- (*NodeIndexer)->Object = (VOID*)NodeList;
- (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
- DEBUG ((
- DEBUG_INFO,
- "IORT: Node Indexer = %p, Token = %p, Object = %p, Offset = 0x%x\n",
- *NodeIndexer,
- (*NodeIndexer)->Token,
- (*NodeIndexer)->Object,
- (*NodeIndexer)->Offset
- ));
-
- Size += GetNamedComponentNodeSize (NodeList);
- (*NodeIndexer)++;
- NodeList++;
- }
-
- return Size;
+ ALIGN_VALUE (AsciiStrSize (Node->ObjectName), 4)));
}
-/** Returns the size of the Root Complex node.
-
- @param [in] Node Pointer to Root Complex node.
+/** Returns the size of the Root Complex node and point
+ to the next node.
+ @param [in,out] Ptr Pointer to Root Complex node.
@retval Size of the Root Complex node.
**/
STATIC
UINT32
GetRootComplexNodeSize (
- IN CONST CM_ARM_ROOT_COMPLEX_NODE * Node
+ IN OUT VOID ** Ptr
)
{
- ASSERT (Node != NULL);
+ ASSERT (Ptr != NULL && *Ptr != NULL);
+
+ CM_ARM_ROOT_COMPLEX_NODE *Node = *Ptr;
+ *Ptr = Node + 1;
/* Size of Root Complex node +
Size of ID mapping array
@@ -289,69 +126,22 @@ GetRootComplexNodeSize (
sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)));
}
-/** Returns the total size required for the Root Complex nodes and
- updates the Node Indexer.
-
- This function calculates the size required for the node group
- and also populates the Node Indexer array with offsets for the
- individual nodes.
-
- @param [in] NodeStartOffset Offset from the start of the
- IORT where this node group starts.
- @param [in] NodeList Pointer to Root Complex node list.
- @param [in] NodeCount Count of the Root Complex nodes.
- @param [in, out] NodeIndexer Pointer to the next Node Indexer.
-
- @retval Total size of the Root Complex nodes.
-**/
-STATIC
-UINT64
-GetSizeofRootComplexNodes (
- IN CONST UINT32 NodeStartOffset,
- IN CONST CM_ARM_ROOT_COMPLEX_NODE * NodeList,
- IN UINT32 NodeCount,
- IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer
- )
-{
- UINT64 Size;
-
- ASSERT (NodeList != NULL);
-
- Size = 0;
- while (NodeCount-- != 0) {
- (*NodeIndexer)->Token = NodeList->Token;
- (*NodeIndexer)->Object = (VOID*)NodeList;
- (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
- DEBUG ((
- DEBUG_INFO,
- "IORT: Node Indexer = %p, Token = %p, Object = %p, Offset = 0x%x\n",
- *NodeIndexer,
- (*NodeIndexer)->Token,
- (*NodeIndexer)->Object,
- (*NodeIndexer)->Offset
- ));
-
- Size += GetRootComplexNodeSize (NodeList);
- (*NodeIndexer)++;
- NodeList++;
- }
-
- return Size;
-}
-
-/** Returns the size of the SMMUv1/SMMUv2 node.
-
- @param [in] Node Pointer to SMMUv1/SMMUv2 node list.
+/** Returns the size of the SMMUv1/SMMUv2 node and point
+ to the next node.
+ @param [in,out] Ptr Pointer to SMMUv1/SMMUv2 node list.
@retval Size of the SMMUv1/SMMUv2 node.
**/
STATIC
UINT32
GetSmmuV1V2NodeSize (
- IN CONST CM_ARM_SMMUV1_SMMUV2_NODE * Node
+ IN OUT VOID **Ptr
)
{
- ASSERT (Node != NULL);
+ ASSERT (Ptr != NULL && *Ptr != NULL);
+
+ CM_ARM_SMMUV1_SMMUV2_NODE * Node = *Ptr;
+ *Ptr = Node + 1;
/* Size of SMMU v1/SMMU v2 node +
Size of ID mapping array +
@@ -367,68 +157,22 @@ GetSmmuV1V2NodeSize (
sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)));
}
-/** Returns the total size required for the SMMUv1/SMMUv2 nodes and
- updates the Node Indexer.
-
- This function calculates the size required for the node group
- and also populates the Node Indexer array with offsets for the
- individual nodes.
-
- @param [in] NodeStartOffset Offset from the start of the
- IORT where this node group starts.
- @param [in] NodeList Pointer to SMMUv1/SMMUv2 node list.
- @param [in] NodeCount Count of the SMMUv1/SMMUv2 nodes.
- @param [in, out] NodeIndexer Pointer to the next Node Indexer.
-
- @retval Total size of the SMMUv1/SMMUv2 nodes.
-**/
-STATIC
-UINT64
-GetSizeofSmmuV1V2Nodes (
- IN CONST UINT32 NodeStartOffset,
- IN CONST CM_ARM_SMMUV1_SMMUV2_NODE * NodeList,
- IN UINT32 NodeCount,
- IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer
- )
-{
- UINT64 Size;
-
- ASSERT (NodeList != NULL);
-
- Size = 0;
- while (NodeCount-- != 0) {
- (*NodeIndexer)->Token = NodeList->Token;
- (*NodeIndexer)->Object = (VOID*)NodeList;
- (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
- DEBUG ((
- DEBUG_INFO,
- "IORT: Node Indexer = %p, Token = %p, Object = %p, Offset = 0x%x\n",
- *NodeIndexer,
- (*NodeIndexer)->Token,
- (*NodeIndexer)->Object,
- (*NodeIndexer)->Offset
- ));
-
- Size += GetSmmuV1V2NodeSize (NodeList);
- (*NodeIndexer)++;
- NodeList++;
- }
- return Size;
-}
-
-/** Returns the size of the SMMUv3 node.
-
- @param [in] Node Pointer to SMMUv3 node list.
+/** Returns the size of the SMMUv3 node and point to the next
+ node.
+ @param [in,out] Ptr Pointer to SMMUv3 node list.
@retval Total size of the SMMUv3 nodes.
**/
STATIC
UINT32
GetSmmuV3NodeSize (
- IN CONST CM_ARM_SMMUV3_NODE * Node
+ IN OUT VOID ** Ptr
)
{
- ASSERT (Node != NULL);
+ ASSERT (Ptr != NULL && *Ptr != NULL);
+
+ CM_ARM_SMMUV3_NODE *Node = *Ptr;
+ *Ptr = Node + 1;
/* Size of SMMU v1/SMMU v2 node +
Size of ID mapping array
@@ -438,68 +182,22 @@ GetSmmuV3NodeSize (
sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)));
}
-/** Returns the total size required for the SMMUv3 nodes and
- updates the Node Indexer.
-
- This function calculates the size required for the node group
- and also populates the Node Indexer array with offsets for the
- individual nodes.
-
- @param [in] NodeStartOffset Offset from the start of the
- IORT where this node group starts.
- @param [in] NodeList Pointer to SMMUv3 node list.
- @param [in] NodeCount Count of the SMMUv3 nodes.
- @param [in, out] NodeIndexer Pointer to the next Node Indexer.
-
- @retval Total size of the SMMUv3 nodes.
-**/
-STATIC
-UINT64
-GetSizeofSmmuV3Nodes (
- IN CONST UINT32 NodeStartOffset,
- IN CONST CM_ARM_SMMUV3_NODE * NodeList,
- IN UINT32 NodeCount,
- IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer
- )
-{
- UINT64 Size;
-
- ASSERT (NodeList != NULL);
-
- Size = 0;
- while (NodeCount-- != 0) {
- (*NodeIndexer)->Token = NodeList->Token;
- (*NodeIndexer)->Object = (VOID*)NodeList;
- (*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
- DEBUG ((
- DEBUG_INFO,
- "IORT: Node Indexer = %p, Token = %p, Object = %p, Offset = 0x%x\n",
- *NodeIndexer,
- (*NodeIndexer)->Token,
- (*NodeIndexer)->Object,
- (*NodeIndexer)->Offset
- ));
-
- Size += GetSmmuV3NodeSize (NodeList);
- (*NodeIndexer)++;
- NodeList++;
- }
- return Size;
-}
-
-/** Returns the size of the PMCG node.
-
- @param [in] Node Pointer to PMCG node.
+/** Returns the size of the PMCG node and point to the next
+ node.
+ @param [in,out] Ptr Pointer to PMCG node.
@retval Size of the PMCG node.
**/
STATIC
UINT32
GetPmcgNodeSize (
- IN CONST CM_ARM_PMCG_NODE * Node
+ IN OUT VOID ** Ptr
)
{
- ASSERT (Node != NULL);
+ ASSERT (Ptr != NULL && *Ptr != NULL);
+
+ CM_ARM_PMCG_NODE * Node = *Ptr;
+ *Ptr = Node + 1;
/* Size of PMCG node +
Size of ID mapping array
@@ -509,38 +207,49 @@ GetPmcgNodeSize (
sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)));
}
-/** Returns the total size required for the PMCG nodes and
- updates the Node Indexer.
+/** Returns the total size required for a group of IORT nodes. The configuration
+ manager objects specified by object id must contain CM_OBJECT_TOKEN as
+ their first field.
This function calculates the size required for the node group
and also populates the Node Indexer array with offsets for the
individual nodes.
+ @param [in] ObjectId The configuration manager object id of
+ nodes that are to be summed.
@param [in] NodeStartOffset Offset from the start of the
IORT where this node group starts.
- @param [in] NodeList Pointer to PMCG node list.
- @param [in] NodeCount Count of the PMCG nodes.
@param [in, out] NodeIndexer Pointer to the next Node Indexer.
+ @param [in] GetNodeSize The function to determine the size of a single node
+ of the appropriate type determined by object id.
- @retval Total size of the PMCG nodes.
+ @retval Total size of the group of nodes
**/
STATIC
UINT64
-GetSizeofPmcgNodes (
- IN CONST UINT32 NodeStartOffset,
- IN CONST CM_ARM_PMCG_NODE * NodeList,
- IN UINT32 NodeCount,
- IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer
+GetSizeOfNodes (
+ IN CONST CM_OBJECT_ID ObjectId,
+ IN CONST UINT32 NodeStartOffset,
+ IN OUT IORT_NODE_INDEXER ** CONST NodeIndexer,
+ IN CONST INDEX_NODE IndexNode
)
{
- UINT64 Size;
-
- ASSERT (NodeList != NULL);
+ UINT64 Size;
+ EFI_STATUS Status;
+ VOID *NodeList;
+ UINT32 NodeCount;
+ VOID *Cursor;
+
+ Status = CfgMgrGetObjects (ObjectId, CM_NULL_TOKEN, &NodeList, &NodeCount);
+ if (EFI_ERROR(Status)) {
+ return 0;
+ }
+ Cursor = NodeList;
Size = 0;
while (NodeCount-- != 0) {
- (*NodeIndexer)->Token = NodeList->Token;
- (*NodeIndexer)->Object = (VOID*)NodeList;
+ (*NodeIndexer)->Token = *(CM_OBJECT_TOKEN *) Cursor; // CM_OBJECT_TOKEN is always the first element of a node
+ (*NodeIndexer)->Object = Cursor;
(*NodeIndexer)->Offset = (UINT32)(Size + NodeStartOffset);
DEBUG ((
DEBUG_INFO,
@@ -551,10 +260,11 @@ GetSizeofPmcgNodes (
(*NodeIndexer)->Offset
));
- Size += GetPmcgNodeSize (NodeList);
+ Size += IndexNode (&Cursor);
(*NodeIndexer)++;
- NodeList++;
}
+
+ FreePool (NodeList);
return Size;
}
@@ -631,14 +341,14 @@ STATIC
EFI_STATUS
AddIdMappingArray (
IN CONST ACPI_TABLE_GENERATOR * CONST This,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray,
IN UINT32 IdCount,
IN CONST CM_OBJECT_TOKEN IdMappingToken
)
{
EFI_STATUS Status;
- CM_ARM_ID_MAPPING * IdMappings;
+ VOID * IdMappings;
+ CM_ARM_ID_MAPPING * Cursor;
UINT32 IdMappingCount;
ACPI_IORT_GENERATOR * Generator;
@@ -647,18 +357,12 @@ AddIdMappingArray (
Generator = (ACPI_IORT_GENERATOR*)This;
// Get the Id Mapping Array
- Status = GetEArmObjIdMappingArray (
- CfgMgrProtocol,
- IdMappingToken,
- &IdMappings,
- &IdMappingCount
- );
+ Status = CfgMgrGetObjects (
+ EArmObjIdMappingArray,
+ IdMappingToken,
+ &IdMappings,
+ &IdMappingCount);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: IORT: Failed to get Id Mapping array. Status = %r\n",
- Status
- ));
return Status;
}
@@ -667,15 +371,17 @@ AddIdMappingArray (
DEBUG_ERROR,
"ERROR: IORT: Failed to get the required number of Id Mappings.\n"
));
- return EFI_NOT_FOUND;
+ Status = EFI_NOT_FOUND;
+ goto EXIT;
}
+ Cursor = IdMappings;
// Populate the Id Mapping array
while (IdCount-- != 0) {
Status = GetNodeOffsetReferencedByToken (
Generator->NodeIndexer,
Generator->IortNodeCount,
- IdMappings->OutputReferenceToken,
+ Cursor->OutputReferenceToken,
&IdMapArray->OutputReference
);
if (EFI_ERROR (Status)) {
@@ -684,22 +390,24 @@ AddIdMappingArray (
"ERROR: IORT: Failed to get Output Reference for ITS Identifier array."
"Reference Token = %p"
" Status = %r\n",
- IdMappings->OutputReferenceToken,
+ Cursor->OutputReferenceToken,
Status
));
- return Status;
+ goto EXIT;
}
- IdMapArray->InputBase = IdMappings->InputBase;
- IdMapArray->NumIds = IdMappings->NumIds;
- IdMapArray->OutputBase = IdMappings->OutputBase;
- IdMapArray->Flags = IdMappings->Flags;
+ IdMapArray->InputBase = Cursor->InputBase;
+ IdMapArray->NumIds = Cursor->NumIds;
+ IdMapArray->OutputBase = Cursor->OutputBase;
+ IdMapArray->Flags = Cursor->Flags;
IdMapArray++;
- IdMappings++;
+ Cursor++;
} // Id Mapping array
- return EFI_SUCCESS;
+EXIT:
+ FreePool (IdMappings);
+ return Status;
}
/** Update the ITS Group Node Information.
@@ -722,10 +430,9 @@ STATIC
EFI_STATUS
AddItsGroupNodes (
IN CONST ACPI_TABLE_GENERATOR * CONST This,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort,
IN CONST UINT32 NodesStartOffset,
- IN CONST CM_ARM_ITS_GROUP_NODE * NodeList,
+ IN VOID * NodeList,
IN UINT32 NodeCount
)
{
@@ -736,6 +443,7 @@ AddItsGroupNodes (
UINT32 ItsIdentifierCount;
UINT32 IdIndex;
UINT64 NodeLength;
+ CM_ARM_ITS_GROUP_NODE *Node;
ASSERT (Iort != NULL);
@@ -743,7 +451,8 @@ AddItsGroupNodes (
NodesStartOffset);
while (NodeCount-- != 0) {
- NodeLength = GetItsGroupNodeSize (NodeList);
+ Node = (CM_ARM_ITS_GROUP_NODE *) NodeList;
+ NodeLength = GetItsGroupNodeSize (&NodeList); // Advances NodeList
if (NodeLength > MAX_UINT16) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
@@ -765,22 +474,16 @@ AddItsGroupNodes (
ItsGroupNode->Node.IdReference = 0;
// IORT specific data
- ItsGroupNode->NumItsIdentifiers = NodeList->ItsIdCount;
+ ItsGroupNode->NumItsIdentifiers = Node->ItsIdCount;
ItsIds = (UINT32*)((UINT8*)ItsGroupNode +
sizeof (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE));
- Status = GetEArmObjGicItsIdentifierArray (
- CfgMgrProtocol,
- NodeList->ItsIdToken,
- &ItsIdentifier,
- &ItsIdentifierCount
- );
+ Status = CfgMgrGetObjects (
+ EArmObjGicItsIdentifierArray,
+ Node->ItsIdToken,
+ (VOID **)&ItsIdentifier,
+ &ItsIdentifierCount);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: IORT: Failed to get ITS Identifier array. Status = %r\n",
- Status
- ));
return Status;
}
@@ -789,7 +492,8 @@ AddItsGroupNodes (
DEBUG_ERROR,
"ERROR: IORT: Failed to get the required number of ITS Identifiers.\n"
));
- return EFI_NOT_FOUND;
+ Status = EFI_NOT_FOUND;
+ goto EXIT;
}
// Populate the ITS identifier array
@@ -800,10 +504,11 @@ AddItsGroupNodes (
// Next IORT Group Node
ItsGroupNode = (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE*)((UINT8*)ItsGroupNode +
ItsGroupNode->Node.Length);
- NodeList++;
} // IORT Group Node
- return EFI_SUCCESS;
+EXIT:
+ FreePool (ItsIdentifier);
+ return Status;
}
/** Update the Named Component Node Information.
@@ -812,8 +517,6 @@ AddItsGroupNodes (
table.
@param [in] This Pointer to the table Generator.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] Iort Pointer to IORT table structure.
@param [in] NodesStartOffset Offset for the start of the Named
Component Nodes.
@@ -829,10 +532,9 @@ STATIC
EFI_STATUS
AddNamedComponentNodes (
IN CONST ACPI_TABLE_GENERATOR * CONST This,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort,
IN CONST UINT32 NodesStartOffset,
- IN CONST CM_ARM_NAMED_COMPONENT_NODE * NodeList,
+ IN VOID * NodeList,
IN UINT32 NodeCount
)
{
@@ -842,6 +544,7 @@ AddNamedComponentNodes (
CHAR8 * ObjectName;
UINTN ObjectNameLength;
UINT64 NodeLength;
+ CM_ARM_NAMED_COMPONENT_NODE * Node;
ASSERT (Iort != NULL);
@@ -849,7 +552,8 @@ AddNamedComponentNodes (
NodesStartOffset);
while (NodeCount-- != 0) {
- NodeLength = GetNamedComponentNodeSize (NodeList);
+ Node = (CM_ARM_NAMED_COMPONENT_NODE*) NodeList;
+ NodeLength = GetNamedComponentNodeSize (&NodeList); // Advances NodeList
if (NodeLength > MAX_UINT16) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
@@ -867,20 +571,20 @@ AddNamedComponentNodes (
NcNode->Node.Length = (UINT16)NodeLength;
NcNode->Node.Revision = 2;
NcNode->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
- NcNode->Node.NumIdMappings = NodeList->IdMappingCount;
+ NcNode->Node.NumIdMappings = Node->IdMappingCount;
- ObjectNameLength = AsciiStrLen (NodeList->ObjectName) + 1;
+ ObjectNameLength = AsciiStrLen (Node->ObjectName) + 1;
NcNode->Node.IdReference =
(UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE) +
(ALIGN_VALUE (ObjectNameLength, 4)));
// Named Component specific data
- NcNode->Flags = NodeList->Flags;
- NcNode->CacheCoherent = NodeList->CacheCoherent;
- NcNode->AllocationHints = NodeList->AllocationHints;
+ NcNode->Flags = Node->Flags;
+ NcNode->CacheCoherent = Node->CacheCoherent;
+ NcNode->AllocationHints = Node->AllocationHints;
NcNode->Reserved = EFI_ACPI_RESERVED_WORD;
- NcNode->MemoryAccessFlags = NodeList->MemoryAccessFlags;
- NcNode->AddressSizeLimit = NodeList->AddressSizeLimit;
+ NcNode->MemoryAccessFlags = Node->MemoryAccessFlags;
+ NcNode->AddressSizeLimit = Node->AddressSizeLimit;
// Copy the object name
ObjectName = (CHAR8*)((UINT8*)NcNode +
@@ -888,7 +592,7 @@ AddNamedComponentNodes (
Status = AsciiStrCpyS (
ObjectName,
ObjectNameLength,
- NodeList->ObjectName
+ Node->ObjectName
);
if (EFI_ERROR (Status)) {
DEBUG ((
@@ -899,19 +603,14 @@ AddNamedComponentNodes (
return Status;
}
- if ((NodeList->IdMappingCount > 0) &&
- (NodeList->IdMappingToken != CM_NULL_TOKEN)) {
+ if ((Node->IdMappingCount > 0) &&
+ (Node->IdMappingToken != CM_NULL_TOKEN)) {
// Ids for Named Component
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE*)((UINT8*)NcNode +
NcNode->Node.IdReference);
Status = AddIdMappingArray (
- This,
- CfgMgrProtocol,
- IdMapArray,
- NodeList->IdMappingCount,
- NodeList->IdMappingToken
- );
+ This, IdMapArray, Node->IdMappingCount, Node->IdMappingToken);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -925,7 +624,6 @@ AddNamedComponentNodes (
// Next Named Component Node
NcNode = (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE*)((UINT8*)NcNode +
NcNode->Node.Length);
- NodeList++;
} // Named Component Node
return EFI_SUCCESS;
@@ -936,8 +634,6 @@ AddNamedComponentNodes (
This function updates the Root Complex node information in the IORT table.
@param [in] This Pointer to the table Generator.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] Iort Pointer to IORT table structure.
@param [in] NodesStartOffset Offset for the start of the Root Complex
Nodes.
@@ -953,10 +649,9 @@ STATIC
EFI_STATUS
AddRootComplexNodes (
IN CONST ACPI_TABLE_GENERATOR * CONST This,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort,
IN CONST UINT32 NodesStartOffset,
- IN CONST CM_ARM_ROOT_COMPLEX_NODE * NodeList,
+ IN VOID * NodeList,
IN UINT32 NodeCount
)
{
@@ -964,6 +659,7 @@ AddRootComplexNodes (
EFI_ACPI_6_0_IO_REMAPPING_RC_NODE * RcNode;
EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray;
UINT64 NodeLength;
+ CM_ARM_ROOT_COMPLEX_NODE * Node;
ASSERT (Iort != NULL);
@@ -971,7 +667,8 @@ AddRootComplexNodes (
NodesStartOffset);
while (NodeCount-- != 0) {
- NodeLength = GetRootComplexNodeSize (NodeList);
+ Node = (CM_ARM_ROOT_COMPLEX_NODE *) NodeList;
+ NodeLength = GetRootComplexNodeSize (&NodeList); // Advances NodeList
if (NodeLength > MAX_UINT16) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
@@ -989,33 +686,28 @@ AddRootComplexNodes (
RcNode->Node.Length = (UINT16)NodeLength;
RcNode->Node.Revision = 1;
RcNode->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
- RcNode->Node.NumIdMappings = NodeList->IdMappingCount;
+ RcNode->Node.NumIdMappings = Node->IdMappingCount;
RcNode->Node.IdReference = sizeof (EFI_ACPI_6_0_IO_REMAPPING_RC_NODE);
// Root Complex specific data
- RcNode->CacheCoherent = NodeList->CacheCoherent;
- RcNode->AllocationHints = NodeList->AllocationHints;
+ RcNode->CacheCoherent = Node->CacheCoherent;
+ RcNode->AllocationHints = Node->AllocationHints;
RcNode->Reserved = EFI_ACPI_RESERVED_WORD;
- RcNode->MemoryAccessFlags = NodeList->MemoryAccessFlags;
- RcNode->AtsAttribute = NodeList->AtsAttribute;
- RcNode->PciSegmentNumber = NodeList->PciSegmentNumber;
- RcNode->MemoryAddressSize = NodeList->MemoryAddressSize;
+ RcNode->MemoryAccessFlags = Node->MemoryAccessFlags;
+ RcNode->AtsAttribute = Node->AtsAttribute;
+ RcNode->PciSegmentNumber = Node->PciSegmentNumber;
+ RcNode->MemoryAddressSize = Node->MemoryAddressSize;
RcNode->Reserved1[0] = EFI_ACPI_RESERVED_BYTE;
RcNode->Reserved1[1] = EFI_ACPI_RESERVED_BYTE;
RcNode->Reserved1[2] = EFI_ACPI_RESERVED_BYTE;
- if ((NodeList->IdMappingCount > 0) &&
- (NodeList->IdMappingToken != CM_NULL_TOKEN)) {
+ if ((Node->IdMappingCount > 0) &&
+ (Node->IdMappingToken != CM_NULL_TOKEN)) {
// Ids for Root Complex
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE*)((UINT8*)RcNode +
RcNode->Node.IdReference);
Status = AddIdMappingArray (
- This,
- CfgMgrProtocol,
- IdMapArray,
- NodeList->IdMappingCount,
- NodeList->IdMappingToken
- );
+ This, IdMapArray, Node->IdMappingCount, Node->IdMappingToken);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -1029,7 +721,6 @@ AddRootComplexNodes (
// Next Root Complex Node
RcNode = (EFI_ACPI_6_0_IO_REMAPPING_RC_NODE*)((UINT8*)RcNode +
RcNode->Node.Length);
- NodeList++;
} // Root Complex Node
return EFI_SUCCESS;
@@ -1040,8 +731,6 @@ AddRootComplexNodes (
This function retrieves the InterruptArray object referenced by the
InterruptToken and updates the SMMU InterruptArray.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in, out] InterruptArray Pointer to an array of Interrupts.
@param [in] InterruptCount Number of entries in the InterruptArray.
@param [in] InterruptToken Reference Token for retrieving the SMMU
@@ -1054,31 +743,25 @@ AddRootComplexNodes (
STATIC
EFI_STATUS
AddSmmuInterrruptArray (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN OUT EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT * InterruptArray,
IN UINT32 InterruptCount,
IN CONST CM_OBJECT_TOKEN InterruptToken
)
{
EFI_STATUS Status;
- CM_ARM_SMMU_INTERRUPT * SmmuInterrupt;
+ CM_ARM_SMMU_INTERRUPT * Cursor;
+ VOID * SmmuInterrupt;
UINT32 SmmuInterruptCount;
ASSERT (InterruptArray != NULL);
// Get the SMMU Interrupt Array
- Status = GetEArmObjSmmuInterruptArray (
- CfgMgrProtocol,
- InterruptToken,
- &SmmuInterrupt,
- &SmmuInterruptCount
- );
+ Status = CfgMgrGetObjects (
+ EArmObjSmmuInterruptArray,
+ InterruptToken,
+ &SmmuInterrupt,
+ &SmmuInterruptCount);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: IORT: Failed to get SMMU Interrupt array. Status = %r\n",
- Status
- ));
return Status;
}
@@ -1087,25 +770,27 @@ AddSmmuInterrruptArray (
DEBUG_ERROR,
"ERROR: IORT: Failed to get the required number of SMMU Interrupts.\n"
));
- return EFI_NOT_FOUND;
+ Status = EFI_NOT_FOUND;
+ goto EXIT;
}
+ Cursor = SmmuInterrupt;
// Populate the Id Mapping array
while (InterruptCount-- != 0) {
- InterruptArray->Interrupt = SmmuInterrupt->Interrupt;
- InterruptArray->InterruptFlags = SmmuInterrupt->Flags;
+ InterruptArray->Interrupt = Cursor->Interrupt;
+ InterruptArray->InterruptFlags = Cursor->Flags;
InterruptArray++;
- SmmuInterrupt++;
+ Cursor++;
} // Id Mapping array
+EXIT:
+ FreePool (SmmuInterrupt);
return EFI_SUCCESS;
}
/** Update the SMMU v1/v2 Node Information.
@param [in] This Pointer to the table Generator.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] Iort Pointer to IORT table structure.
@param [in] NodesStartOffset Offset for the start of the SMMU v1/v2
Nodes.
@@ -1121,10 +806,9 @@ STATIC
EFI_STATUS
AddSmmuV1V2Nodes (
IN CONST ACPI_TABLE_GENERATOR * CONST This,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort,
IN CONST UINT32 NodesStartOffset,
- IN CONST CM_ARM_SMMUV1_SMMUV2_NODE * NodeList,
+ IN VOID * NodeList,
IN UINT32 NodeCount
)
{
@@ -1135,6 +819,7 @@ AddSmmuV1V2Nodes (
EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT * ContextInterruptArray;
EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT * PmuInterruptArray;
UINT64 NodeLength;
+ CM_ARM_SMMUV1_SMMUV2_NODE * Node;
ASSERT (Iort != NULL);
@@ -1142,7 +827,8 @@ AddSmmuV1V2Nodes (
NodesStartOffset);
while (NodeCount-- != 0) {
- NodeLength = GetSmmuV1V2NodeSize (NodeList);
+ Node = (CM_ARM_SMMUV1_SMMUV2_NODE*) NodeList;
+ NodeLength = GetSmmuV1V2NodeSize (&NodeList); // Advances NodeList
if (NodeLength > MAX_UINT16) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
@@ -1159,25 +845,25 @@ AddSmmuV1V2Nodes (
SmmuNode->Node.Length = (UINT16)NodeLength;
SmmuNode->Node.Revision = 0;
SmmuNode->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
- SmmuNode->Node.NumIdMappings = NodeList->IdMappingCount;
+ SmmuNode->Node.NumIdMappings = Node->IdMappingCount;
SmmuNode->Node.IdReference = sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE) +
- (NodeList->ContextInterruptCount *
+ (Node->ContextInterruptCount *
sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)) +
- (NodeList->PmuInterruptCount *
+ (Node->PmuInterruptCount *
sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT));
// SMMU v1/v2 specific data
- SmmuNode->Base = NodeList->BaseAddress;
- SmmuNode->Span = NodeList->Span;
- SmmuNode->Model = NodeList->Model;
- SmmuNode->Flags = NodeList->Flags;
+ SmmuNode->Base = Node->BaseAddress;
+ SmmuNode->Span = Node->Span;
+ SmmuNode->Model = Node->Model;
+ SmmuNode->Flags = Node->Flags;
// Reference to Global Interrupt Array
SmmuNode->GlobalInterruptArrayRef =
OFFSET_OF (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE, SMMU_NSgIrpt);
// Context Interrupt
- SmmuNode->NumContextInterrupts = NodeList->ContextInterruptCount;
+ SmmuNode->NumContextInterrupts = Node->ContextInterruptCount;
SmmuNode->ContextInterruptArrayRef =
sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE);
ContextInterruptArray =
@@ -1185,26 +871,24 @@ AddSmmuV1V2Nodes (
sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE));
// PMU Interrupt
- SmmuNode->NumPmuInterrupts = NodeList->PmuInterruptCount;
+ SmmuNode->NumPmuInterrupts = Node->PmuInterruptCount;
SmmuNode->PmuInterruptArrayRef = SmmuNode->ContextInterruptArrayRef +
- (NodeList->ContextInterruptCount *
+ (Node->ContextInterruptCount *
sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT));
PmuInterruptArray =
(EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT*)((UINT8*)SmmuNode +
SmmuNode->PmuInterruptArrayRef);
- SmmuNode->SMMU_NSgIrpt = NodeList->SMMU_NSgIrpt;
- SmmuNode->SMMU_NSgIrptFlags = NodeList->SMMU_NSgIrptFlags;
- SmmuNode->SMMU_NSgCfgIrpt = NodeList->SMMU_NSgCfgIrpt;
- SmmuNode->SMMU_NSgCfgIrptFlags = NodeList->SMMU_NSgCfgIrptFlags;
+ SmmuNode->SMMU_NSgIrpt = Node->SMMU_NSgIrpt;
+ SmmuNode->SMMU_NSgIrptFlags = Node->SMMU_NSgIrptFlags;
+ SmmuNode->SMMU_NSgCfgIrpt = Node->SMMU_NSgCfgIrpt;
+ SmmuNode->SMMU_NSgCfgIrptFlags = Node->SMMU_NSgCfgIrptFlags;
// Add Context Interrupt Array
Status = AddSmmuInterrruptArray (
- CfgMgrProtocol,
- ContextInterruptArray,
- SmmuNode->NumContextInterrupts,
- NodeList->ContextInterruptToken
- );
+ ContextInterruptArray,
+ SmmuNode->NumContextInterrupts,
+ Node->ContextInterruptToken);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -1216,13 +900,11 @@ AddSmmuV1V2Nodes (
// Add PMU Interrupt Array
if ((SmmuNode->NumPmuInterrupts > 0) &&
- (NodeList->PmuInterruptToken != CM_NULL_TOKEN)) {
+ (Node->PmuInterruptToken != CM_NULL_TOKEN)) {
Status = AddSmmuInterrruptArray (
- CfgMgrProtocol,
- PmuInterruptArray,
- SmmuNode->NumPmuInterrupts,
- NodeList->PmuInterruptToken
- );
+ PmuInterruptArray,
+ SmmuNode->NumPmuInterrupts,
+ Node->PmuInterruptToken);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -1233,18 +915,13 @@ AddSmmuV1V2Nodes (
}
}
- if ((NodeList->IdMappingCount > 0) &&
- (NodeList->IdMappingToken != CM_NULL_TOKEN)) {
+ if ((Node->IdMappingCount > 0) &&
+ (Node->IdMappingToken != CM_NULL_TOKEN)) {
// Ids for SMMU v1/v2 Node
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE*)((UINT8*)SmmuNode +
SmmuNode->Node.IdReference);
Status = AddIdMappingArray (
- This,
- CfgMgrProtocol,
- IdMapArray,
- NodeList->IdMappingCount,
- NodeList->IdMappingToken
- );
+ This, IdMapArray, Node->IdMappingCount, Node->IdMappingToken);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -1257,7 +934,6 @@ AddSmmuV1V2Nodes (
// Next SMMU v1/v2 Node
SmmuNode = (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE*)((UINT8*)SmmuNode +
SmmuNode->Node.Length);
- NodeList++;
} // SMMU v1/v2 Node
return EFI_SUCCESS;
@@ -1268,8 +944,6 @@ AddSmmuV1V2Nodes (
This function updates the SMMUv3 node information in the IORT table.
@param [in] This Pointer to the table Generator.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] Iort Pointer to IORT table structure.
@param [in] NodesStartOffset Offset for the start of the SMMUv3 Nodes.
@param [in] NodeList Pointer to an array of SMMUv3 Node Objects.
@@ -1283,10 +957,9 @@ STATIC
EFI_STATUS
AddSmmuV3Nodes (
IN CONST ACPI_TABLE_GENERATOR * CONST This,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort,
IN CONST UINT32 NodesStartOffset,
- IN CONST CM_ARM_SMMUV3_NODE * NodeList,
+ IN VOID * NodeList,
IN UINT32 NodeCount
)
{
@@ -1294,6 +967,7 @@ AddSmmuV3Nodes (
EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE * SmmuV3Node;
EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray;
UINT64 NodeLength;
+ CM_ARM_SMMUV3_NODE * Node;
ASSERT (Iort != NULL);
@@ -1301,7 +975,8 @@ AddSmmuV3Nodes (
NodesStartOffset);
while (NodeCount-- != 0) {
- NodeLength = GetSmmuV3NodeSize (NodeList);
+ Node = (CM_ARM_SMMUV3_NODE*) NodeList;
+ NodeLength = GetSmmuV3NodeSize (&NodeList); // Advances NodeList
if (NodeLength > MAX_UINT16) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
@@ -1318,24 +993,24 @@ AddSmmuV3Nodes (
SmmuV3Node->Node.Length = (UINT16)NodeLength;
SmmuV3Node->Node.Revision = 2;
SmmuV3Node->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
- SmmuV3Node->Node.NumIdMappings = NodeList->IdMappingCount;
+ SmmuV3Node->Node.NumIdMappings = Node->IdMappingCount;
SmmuV3Node->Node.IdReference =
sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE);
// SMMUv3 specific data
- SmmuV3Node->Base = NodeList->BaseAddress;
- SmmuV3Node->Flags = NodeList->Flags;
+ SmmuV3Node->Base = Node->BaseAddress;
+ SmmuV3Node->Flags = Node->Flags;
SmmuV3Node->Reserved = EFI_ACPI_RESERVED_WORD;
- SmmuV3Node->VatosAddress = NodeList->VatosAddress;
- SmmuV3Node->Model = NodeList->Model;
- SmmuV3Node->Event = NodeList->EventInterrupt;
- SmmuV3Node->Pri = NodeList->PriInterrupt;
- SmmuV3Node->Gerr = NodeList->GerrInterrupt;
- SmmuV3Node->Sync = NodeList->SyncInterrupt;
+ SmmuV3Node->VatosAddress = Node->VatosAddress;
+ SmmuV3Node->Model = Node->Model;
+ SmmuV3Node->Event = Node->EventInterrupt;
+ SmmuV3Node->Pri = Node->PriInterrupt;
+ SmmuV3Node->Gerr = Node->GerrInterrupt;
+ SmmuV3Node->Sync = Node->SyncInterrupt;
if ((SmmuV3Node->Flags & EFI_ACPI_IORT_SMMUv3_FLAG_PROXIMITY_DOMAIN) != 0) {
// The Proximity Domain Valid flag is set to 1
- SmmuV3Node->ProximityDomain = NodeList->ProximityDomain;
+ SmmuV3Node->ProximityDomain = Node->ProximityDomain;
} else {
SmmuV3Node->ProximityDomain = 0;
}
@@ -1346,21 +1021,16 @@ AddSmmuV3Nodes (
// the DeviceID mapping index field is ignored.
SmmuV3Node->DeviceIdMappingIndex = 0;
} else {
- SmmuV3Node->DeviceIdMappingIndex = NodeList->DeviceIdMappingIndex;
+ SmmuV3Node->DeviceIdMappingIndex = Node->DeviceIdMappingIndex;
}
- if ((NodeList->IdMappingCount > 0) &&
- (NodeList->IdMappingToken != CM_NULL_TOKEN)) {
+ if ((Node->IdMappingCount > 0) &&
+ (Node->IdMappingToken != CM_NULL_TOKEN)) {
// Ids for SMMUv3 node
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE*)((UINT8*)SmmuV3Node +
SmmuV3Node->Node.IdReference);
Status = AddIdMappingArray (
- This,
- CfgMgrProtocol,
- IdMapArray,
- NodeList->IdMappingCount,
- NodeList->IdMappingToken
- );
+ This, IdMapArray, Node->IdMappingCount, Node->IdMappingToken);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -1374,7 +1044,6 @@ AddSmmuV3Nodes (
// Next SMMUv3 Node
SmmuV3Node = (EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE*)((UINT8*)SmmuV3Node +
SmmuV3Node->Node.Length);
- NodeList++;
} // SMMUv3 Node
return EFI_SUCCESS;
@@ -1385,8 +1054,6 @@ AddSmmuV3Nodes (
This function updates the PMCG node information in the IORT table.
@param [in] This Pointer to the table Generator.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] Iort Pointer to IORT table structure.
@param [in] NodesStartOffset Offset for the start of the PMCG Nodes.
@param [in] NodeList Pointer to an array of PMCG Node Objects.
@@ -1400,10 +1067,9 @@ STATIC
EFI_STATUS
AddPmcgNodes (
IN CONST ACPI_TABLE_GENERATOR * CONST This,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort,
IN CONST UINT32 NodesStartOffset,
- IN CONST CM_ARM_PMCG_NODE * NodeList,
+ IN VOID * NodeList,
IN UINT32 NodeCount
)
{
@@ -1412,6 +1078,7 @@ AddPmcgNodes (
EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE * IdMapArray;
ACPI_IORT_GENERATOR * Generator;
UINT64 NodeLength;
+ CM_ARM_PMCG_NODE * Node;
ASSERT (Iort != NULL);
@@ -1420,7 +1087,8 @@ AddPmcgNodes (
NodesStartOffset);
while (NodeCount-- != 0) {
- NodeLength = GetPmcgNodeSize (NodeList);
+ Node = (CM_ARM_PMCG_NODE*) NodeList;
+ NodeLength = GetPmcgNodeSize (&NodeList); // Advances NodeList
if (NodeLength > MAX_UINT16) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
@@ -1437,18 +1105,18 @@ AddPmcgNodes (
PmcgNode->Node.Length = (UINT16)NodeLength;
PmcgNode->Node.Revision = 1;
PmcgNode->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
- PmcgNode->Node.NumIdMappings = NodeList->IdMappingCount;
+ PmcgNode->Node.NumIdMappings = Node->IdMappingCount;
PmcgNode->Node.IdReference = sizeof (EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE);
// PMCG specific data
- PmcgNode->Base = NodeList->BaseAddress;
- PmcgNode->OverflowInterruptGsiv = NodeList->OverflowInterrupt;
- PmcgNode->Page1Base = NodeList->Page1BaseAddress;
+ PmcgNode->Base = Node->BaseAddress;
+ PmcgNode->OverflowInterruptGsiv = Node->OverflowInterrupt;
+ PmcgNode->Page1Base = Node->Page1BaseAddress;
Status = GetNodeOffsetReferencedByToken (
Generator->NodeIndexer,
Generator->IortNodeCount,
- NodeList->ReferenceToken,
+ Node->ReferenceToken,
&PmcgNode->NodeReference
);
if (EFI_ERROR (Status)) {
@@ -1457,25 +1125,20 @@ AddPmcgNodes (
"ERROR: IORT: Failed to get Output Reference for PMCG Node."
"Reference Token = %p"
" Status = %r\n",
- NodeList->ReferenceToken,
+ Node->ReferenceToken,
Status
));
return Status;
}
- if ((NodeList->IdMappingCount > 0) &&
- (NodeList->IdMappingToken != CM_NULL_TOKEN)) {
+ if ((Node->IdMappingCount > 0) &&
+ (Node->IdMappingToken != CM_NULL_TOKEN)) {
// Ids for PMCG node
IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE*)((UINT8*)PmcgNode +
PmcgNode->Node.IdReference);
Status = AddIdMappingArray (
- This,
- CfgMgrProtocol,
- IdMapArray,
- NodeList->IdMappingCount,
- NodeList->IdMappingToken
- );
+ This, IdMapArray, Node->IdMappingCount, Node->IdMappingToken);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -1489,7 +1152,6 @@ AddPmcgNodes (
// Next PMCG Node
PmcgNode = (EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE*)((UINT8*)PmcgNode +
PmcgNode->Node.Length);
- NodeList++;
} // PMCG Node
return EFI_SUCCESS;
@@ -1547,20 +1209,13 @@ BuildIortTable (
UINT32 SmmuV3Offset;
UINT32 PmcgOffset;
- CM_ARM_ITS_GROUP_NODE * ItsGroupNodeList;
- CM_ARM_NAMED_COMPONENT_NODE * NamedComponentNodeList;
- CM_ARM_ROOT_COMPLEX_NODE * RootComplexNodeList;
- CM_ARM_SMMUV1_SMMUV2_NODE * SmmuV1V2NodeList;
- CM_ARM_SMMUV3_NODE * SmmuV3NodeList;
- CM_ARM_PMCG_NODE * PmcgNodeList;
-
+ VOID * NodeList;
EFI_ACPI_6_0_IO_REMAPPING_TABLE * Iort;
IORT_NODE_INDEXER * NodeIndexer;
ACPI_IORT_GENERATOR * Generator;
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
- ASSERT (CfgMgrProtocol != NULL);
ASSERT (Table != NULL);
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
@@ -1579,136 +1234,68 @@ BuildIortTable (
}
Generator = (ACPI_IORT_GENERATOR*)This;
+
+ // Pointers to allocated memory
*Table = NULL;
// Get the ITS group node info
- Status = GetEArmObjItsGroup (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &ItsGroupNodeList,
- &ItsGroupNodeCount
- );
+ Status = CfgMgrCountObjects (EArmObjItsGroup, &ItsGroupNodeCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: IORT: Failed to get ITS Group Node Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
// Add the ITS group node count
IortNodeCount = ItsGroupNodeCount;
// Get the Named component node info
- Status = GetEArmObjNamedComponent (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &NamedComponentNodeList,
- &NamedComponentNodeCount
- );
+ Status = CfgMgrCountObjects (EArmObjNamedComponent, &NamedComponentNodeCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: IORT: Failed to get Named Component Node Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
// Add the Named Component group count
IortNodeCount += NamedComponentNodeCount;
// Get the Root complex node info
- Status = GetEArmObjRootComplex (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &RootComplexNodeList,
- &RootComplexNodeCount
- );
+ Status = CfgMgrCountObjects (EArmObjRootComplex, &RootComplexNodeCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: IORT: Failed to get Root Complex Node Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
// Add the Root Complex node count
IortNodeCount += RootComplexNodeCount;
// Get the SMMU v1/v2 node info
- Status = GetEArmObjSmmuV1SmmuV2 (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &SmmuV1V2NodeList,
- &SmmuV1V2NodeCount
- );
+ Status = CfgMgrCountObjects (EArmObjSmmuV1SmmuV2, &SmmuV1V2NodeCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: IORT: Failed to get SMMUv1/SMMUv2 Node Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
// Add the SMMU v1/v2 node count
IortNodeCount += SmmuV1V2NodeCount;
// Get the SMMUv3 node info
- Status = GetEArmObjSmmuV3 (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &SmmuV3NodeList,
- &SmmuV3NodeCount
- );
+ Status = CfgMgrCountObjects (EArmObjSmmuV3, &SmmuV3NodeCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: IORT: Failed to get SMMUv3 Node Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
// Add the SMMUv3 node count
IortNodeCount += SmmuV3NodeCount;
// Get the PMCG node info
- Status = GetEArmObjPmcg (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &PmcgNodeList,
- &PmcgNodeCount
- );
+ Status = CfgMgrCountObjects (EArmObjPmcg, &PmcgNodeCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: IORT: Failed to get PMCG Node Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
// Add the PMCG node count
IortNodeCount += PmcgNodeCount;
// Allocate Node Indexer array
- NodeIndexer = (IORT_NODE_INDEXER*)AllocateZeroPool (
- (sizeof (IORT_NODE_INDEXER) *
- IortNodeCount)
- );
+ NodeIndexer = AllocateZeroPool ((sizeof (IORT_NODE_INDEXER) * IortNodeCount));
if (NodeIndexer == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: IORT: Failed to allocate memory for Node Indexer" \
- " Status = %r\n",
- Status
- ));
- goto error_handler;
+ return EFI_OUT_OF_RESOURCES;
}
DEBUG ((DEBUG_INFO, "INFO: NodeIndexer = %p\n", NodeIndexer));
@@ -1721,13 +1308,10 @@ BuildIortTable (
// ITS Group Nodes
if (ItsGroupNodeCount > 0) {
ItsGroupOffset = (UINT32)TableSize;
- // Size of ITS Group node list.
- NodeSize = GetSizeofItsGroupNodes (
- ItsGroupOffset,
- ItsGroupNodeList,
- ItsGroupNodeCount,
- &NodeIndexer
- );
+
+ NodeSize = GetSizeOfNodes (
+ EArmObjItsGroup, ItsGroupOffset, &NodeIndexer, GetItsGroupNodeSize);
+
if (NodeSize > MAX_UINT32) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
@@ -1751,13 +1335,13 @@ BuildIortTable (
// Named Component Nodes
if (NamedComponentNodeCount > 0) {
NamedComponentOffset = (UINT32)TableSize;
- // Size of Named Component node list.
- NodeSize = GetSizeofNamedComponentNodes (
- NamedComponentOffset,
- NamedComponentNodeList,
- NamedComponentNodeCount,
- &NodeIndexer
- );
+
+ NodeSize = GetSizeOfNodes (
+ EArmObjNamedComponent,
+ NamedComponentOffset,
+ &NodeIndexer,
+ GetNamedComponentNodeSize);
+
if (NodeSize > MAX_UINT32) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
@@ -1781,13 +1365,13 @@ BuildIortTable (
// Root Complex Nodes
if (RootComplexNodeCount > 0) {
RootComplexOffset = (UINT32)TableSize;
- // Size of Root Complex node list.
- NodeSize = GetSizeofRootComplexNodes (
- RootComplexOffset,
- RootComplexNodeList,
- RootComplexNodeCount,
- &NodeIndexer
- );
+
+ NodeSize = GetSizeOfNodes (
+ EArmObjRootComplex,
+ RootComplexOffset,
+ &NodeIndexer,
+ GetRootComplexNodeSize);
+
if (NodeSize > MAX_UINT32) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
@@ -1811,13 +1395,9 @@ BuildIortTable (
// SMMUv1/SMMUv2 Nodes
if (SmmuV1V2NodeCount > 0) {
SmmuV1V2Offset = (UINT32)TableSize;
- // Size of SMMUv1/SMMUv2 node list.
- NodeSize = GetSizeofSmmuV1V2Nodes (
- SmmuV1V2Offset,
- SmmuV1V2NodeList,
- SmmuV1V2NodeCount,
- &NodeIndexer
- );
+
+ NodeSize = GetSizeOfNodes (
+ EArmObjSmmuV1SmmuV2, SmmuV1V2Offset, &NodeIndexer, GetSmmuV1V2NodeSize);
if (NodeSize > MAX_UINT32) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
@@ -1841,13 +1421,9 @@ BuildIortTable (
// SMMUv3 Nodes
if (SmmuV3NodeCount > 0) {
SmmuV3Offset = (UINT32)TableSize;
- // Size of SMMUv3 node list.
- NodeSize = GetSizeofSmmuV3Nodes (
- SmmuV3Offset,
- SmmuV3NodeList,
- SmmuV3NodeCount,
- &NodeIndexer
- );
+
+ NodeSize = GetSizeOfNodes (
+ EArmObjSmmuV3, SmmuV3Offset, &NodeIndexer, GetSmmuV3NodeSize);
if (NodeSize > MAX_UINT32) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
@@ -1871,13 +1447,9 @@ BuildIortTable (
// PMCG Nodes
if (PmcgNodeCount > 0) {
PmcgOffset = (UINT32)TableSize;
- // Size of PMCG node list.
- NodeSize = GetSizeofPmcgNodes (
- PmcgOffset,
- PmcgNodeList,
- PmcgNodeCount,
- &NodeIndexer
- );
+
+ NodeSize = GetSizeOfNodes (
+ EArmObjPmcg, PmcgOffset, &NodeIndexer, GetPmcgNodeSize);
if (NodeSize > MAX_UINT32) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
@@ -1920,21 +1492,12 @@ BuildIortTable (
}
// Allocate the Buffer for IORT table
- *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
- if (*Table == NULL) {
+ Iort = AllocateZeroPool (TableSize);
+ if (Iort == NULL) {
Status = EFI_OUT_OF_RESOURCES;
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: IORT: Failed to allocate memory for IORT Table, Size = %d," \
- " Status = %r\n",
- TableSize,
- Status
- ));
goto error_handler;
}
- Iort = (EFI_ACPI_6_0_IO_REMAPPING_TABLE*)*Table;
-
DEBUG ((
DEBUG_INFO,
"IORT: Iort = 0x%p TableSize = 0x%lx\n",
@@ -1944,11 +1507,6 @@ BuildIortTable (
Status = AddAcpiHeader (This, &Iort->Header, AcpiTableInfo, (UINT32) TableSize);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: IORT: Failed to add ACPI header. Status = %r\n",
- Status
- ));
goto error_handler;
}
@@ -1958,14 +1516,10 @@ BuildIortTable (
Iort->Reserved = EFI_ACPI_RESERVED_DWORD;
if (ItsGroupNodeCount > 0) {
+ CfgMgrGetSimpleObject(EArmObjItsGroup, &NodeList);
Status = AddItsGroupNodes (
- This,
- CfgMgrProtocol,
- Iort,
- ItsGroupOffset,
- ItsGroupNodeList,
- ItsGroupNodeCount
- );
+ This, Iort, ItsGroupOffset, NodeList, ItsGroupNodeCount);
+ FreePool (NodeList);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -1977,14 +1531,10 @@ BuildIortTable (
}
if (NamedComponentNodeCount > 0) {
+ CfgMgrGetSimpleObject(EArmObjNamedComponent, &NodeList);
Status = AddNamedComponentNodes (
- This,
- CfgMgrProtocol,
- Iort,
- NamedComponentOffset,
- NamedComponentNodeList,
- NamedComponentNodeCount
- );
+ This, Iort, NamedComponentOffset, NodeList, NamedComponentNodeCount);
+ FreePool (NodeList);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -1996,14 +1546,10 @@ BuildIortTable (
}
if (RootComplexNodeCount > 0) {
+ CfgMgrGetSimpleObject(EArmObjRootComplex, &NodeList);
Status = AddRootComplexNodes (
- This,
- CfgMgrProtocol,
- Iort,
- RootComplexOffset,
- RootComplexNodeList,
- RootComplexNodeCount
- );
+ This, Iort, RootComplexOffset, NodeList, RootComplexNodeCount);
+ FreePool (NodeList);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -2015,14 +1561,10 @@ BuildIortTable (
}
if (SmmuV1V2NodeCount > 0) {
+ CfgMgrGetSimpleObject(EArmObjSmmuV1SmmuV2, &NodeList);
Status = AddSmmuV1V2Nodes (
- This,
- CfgMgrProtocol,
- Iort,
- SmmuV1V2Offset,
- SmmuV1V2NodeList,
- SmmuV1V2NodeCount
- );
+ This, Iort, SmmuV1V2Offset, NodeList, SmmuV1V2NodeCount);
+ FreePool (NodeList);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -2034,14 +1576,10 @@ BuildIortTable (
}
if (SmmuV3NodeCount > 0) {
+ CfgMgrGetSimpleObject(EArmObjSmmuV3, &NodeList);
Status = AddSmmuV3Nodes (
- This,
- CfgMgrProtocol,
- Iort,
- SmmuV3Offset,
- SmmuV3NodeList,
- SmmuV3NodeCount
- );
+ This, Iort, SmmuV3Offset, NodeList, SmmuV3NodeCount);
+ FreePool (NodeList);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -2053,14 +1591,9 @@ BuildIortTable (
}
if (PmcgNodeCount > 0) {
- Status = AddPmcgNodes (
- This,
- CfgMgrProtocol,
- Iort,
- PmcgOffset,
- PmcgNodeList,
- PmcgNodeCount
- );
+ CfgMgrGetSimpleObject(EArmObjPmcg, &NodeList);
+ Status = AddPmcgNodes (This, Iort, PmcgOffset, NodeList, PmcgNodeCount);
+ FreePool (NodeList);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -2071,6 +1604,8 @@ BuildIortTable (
}
}
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER*) Iort;
+
return EFI_SUCCESS;
error_handler:
@@ -2078,11 +1613,10 @@ error_handler:
FreePool (Generator->NodeIndexer);
Generator->NodeIndexer = NULL;
}
-
- if (*Table != NULL) {
- FreePool (*Table);
- *Table = NULL;
+ if (Iort != NULL) {
+ FreePool (Iort);
}
+
return Status;
}
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
index ab42c96b06..0d75a24724 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
@@ -17,7 +17,6 @@
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
-#include <ConfigurationManagerHelper.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
@@ -33,54 +32,6 @@ Requirements:
- EArmObjGicItsInfo (OPTIONAL)
*/
-/** This macro expands to a function that retrieves the GIC
- CPU interface Information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGicCInfo,
- CM_ARM_GICC_INFO
- );
-
-/** This macro expands to a function that retrieves the GIC
- Distributor Information from the Configuration Manager.
-*/
-
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGicDInfo,
- CM_ARM_GICD_INFO
- );
-
-/** This macro expands to a function that retrieves the GIC
- MSI Frame Information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGicMsiFrameInfo,
- CM_ARM_GIC_MSI_FRAME_INFO
- );
-
-/** This macro expands to a function that retrieves the GIC
- Redistributor Information from the Configuration Manager.
-*/
-
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGicRedistributorInfo,
- CM_ARM_GIC_REDIST_INFO
- );
-
-/** This macro expands to a function that retrieves the GIC
- Interrupt Translation Service Information from the
- Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGicItsInfo,
- CM_ARM_GIC_ITS_INFO
- );
-
/** This function updates the GIC CPU Interface Information in the
EFI_ACPI_6_3_GIC_STRUCTURE structure.
@@ -215,15 +166,21 @@ STATIC
EFI_STATUS
AddGICCList (
IN EFI_ACPI_6_3_GIC_STRUCTURE * Gicc,
- IN CONST CM_ARM_GICC_INFO * GicCInfo,
- IN UINT32 GicCCount,
IN CONST UINT8 MadtRev
)
{
BOOLEAN IsAcpiProcUidDuplicated;
+ CM_ARM_GICC_INFO *Cursor;
+ VOID *GicCInfo;
+ UINT32 GicCCount;
ASSERT (Gicc != NULL);
- ASSERT (GicCInfo != NULL);
+
+ EFI_STATUS Status =
+ CfgMgrGetObjects (EArmObjGicCInfo, CM_NULL_TOKEN, &GicCInfo, &GicCCount);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
IsAcpiProcUidDuplicated = FindDuplicateValue (
GicCInfo,
@@ -234,31 +191,40 @@ AddGICCList (
// Duplicate ACPI Processor UID was found so the GICC info provided
// is invalid
if (IsAcpiProcUidDuplicated) {
+ FreePool (GicCInfo);
return EFI_INVALID_PARAMETER;
}
+ Cursor = GicCInfo;
while (GicCCount-- != 0) {
- AddGICC (Gicc++, GicCInfo++, MadtRev);
+ AddGICC (Gicc++, Cursor++, MadtRev);
}
+ FreePool (GicCInfo);
return EFI_SUCCESS;
}
/** Update the GIC Distributor Information in the MADT Table.
@param [in] Gicd Pointer to GIC Distributor structure.
- @param [in] GicDInfo Pointer to the GIC Distributor Information.
**/
STATIC
VOID
AddGICD (
- EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE * CONST Gicd,
- CONST CM_ARM_GICD_INFO * CONST GicDInfo
-)
+ EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE * CONST Gicd
+ )
{
+ EFI_STATUS Status;
+ CM_ARM_GICD_INFO *GicDInfo;
+
ASSERT (Gicd != NULL);
ASSERT (GicDInfo != NULL);
+ Status = CfgMgrGetSimpleObject (EArmObjGicDInfo, (VOID **)&GicDInfo);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
// UINT8 Type
Gicd->Type = EFI_ACPI_6_3_GICD;
// UINT8 Length
@@ -279,6 +245,8 @@ AddGICD (
Gicd->Reserved2[0] = EFI_ACPI_RESERVED_BYTE;
Gicd->Reserved2[1] = EFI_ACPI_RESERVED_BYTE;
Gicd->Reserved2[2] = EFI_ACPI_RESERVED_BYTE;
+
+ FreePool (GicDInfo);
}
/** Update the GIC MSI Frame Information.
@@ -310,23 +278,32 @@ AddGICMsiFrame (
/** Add the GIC MSI Frame Information to the MADT Table.
@param [in] GicMsiFrame Pointer to GIC MSI Frame structure list.
- @param [in] GicMsiFrameInfo Pointer to the GIC MSI Frame info list.
- @param [in] GicMsiFrameCount Count of GIC MSI Frames.
**/
STATIC
VOID
AddGICMsiFrameInfoList (
- IN EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE * GicMsiFrame,
- IN CONST CM_ARM_GIC_MSI_FRAME_INFO * GicMsiFrameInfo,
- IN UINT32 GicMsiFrameCount
-)
+ IN EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE * GicMsiFrame
+ )
{
+ EFI_STATUS Status;
+ VOID *GicMsiInfo;
+ CM_ARM_GIC_MSI_FRAME_INFO *Cursor;
+ UINT32 GicMsiCount;
+
ASSERT (GicMsiFrame != NULL);
- ASSERT (GicMsiFrameInfo != NULL);
- while (GicMsiFrameCount-- != 0) {
- AddGICMsiFrame (GicMsiFrame++, GicMsiFrameInfo++);
+ Status = CfgMgrGetObjects (
+ EArmObjGicMsiFrameInfo, CM_NULL_TOKEN, &GicMsiInfo, &GicMsiCount);
+ if (EFI_ERROR(Status)) {
+ return;
+ }
+
+ Cursor = GicMsiInfo;
+ while (GicMsiCount-- != 0) {
+ AddGICMsiFrame (GicMsiFrame++, Cursor++);
}
+
+ FreePool (GicMsiInfo);
}
/** Update the GIC Redistributor Information.
@@ -355,23 +332,32 @@ AddGICRedistributor (
/** Add the GIC Redistributor Information to the MADT Table.
@param [in] Gicr Pointer to GIC Redistributor structure list.
- @param [in] GicRInfo Pointer to the GIC Distributor info list.
- @param [in] GicRCount Count of GIC Distributors.
**/
STATIC
VOID
AddGICRedistributorList (
- IN EFI_ACPI_6_3_GICR_STRUCTURE * Gicr,
- IN CONST CM_ARM_GIC_REDIST_INFO * GicRInfo,
- IN UINT32 GicRCount
+ IN EFI_ACPI_6_3_GICR_STRUCTURE * Gicr
)
{
+ CM_ARM_GIC_REDIST_INFO *Cursor;
+ VOID *GicRInfo;
+ UINT32 GicRCount;
+ EFI_STATUS Status;
+
ASSERT (Gicr != NULL);
- ASSERT (GicRInfo != NULL);
+ Status = CfgMgrGetObjects (
+ EArmObjGicRedistributorInfo, CM_NULL_TOKEN, &GicRInfo, &GicRCount);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ Cursor = GicRInfo;
while (GicRCount-- != 0) {
- AddGICRedistributor (Gicr++, GicRInfo++);
+ AddGICRedistributor (Gicr++, Cursor++);
}
+
+ FreePool (GicRInfo);
}
/** Update the GIC Interrupt Translation Service Information
@@ -401,23 +387,32 @@ AddGICInterruptTranslationService (
to the MADT Table.
@param [in] GicIts Pointer to GIC ITS structure list.
- @param [in] GicItsInfo Pointer to the GIC ITS list.
- @param [in] GicItsCount Count of GIC ITS.
**/
STATIC
VOID
AddGICItsList (
- IN EFI_ACPI_6_3_GIC_ITS_STRUCTURE * GicIts,
- IN CONST CM_ARM_GIC_ITS_INFO * GicItsInfo,
- IN UINT32 GicItsCount
+ IN EFI_ACPI_6_3_GIC_ITS_STRUCTURE * GicIts
)
{
+ CM_ARM_GIC_ITS_INFO *Cursor;
+ VOID *GicItsInfo;
+ UINT32 GicItsCount;
+ EFI_STATUS Status;
+
ASSERT (GicIts != NULL);
- ASSERT (GicItsInfo != NULL);
+ Status = CfgMgrGetObjects (
+ EArmObjGicItsInfo, CM_NULL_TOKEN, &GicItsInfo, &GicItsCount);
+ if (EFI_ERROR(Status)) {
+ return;
+ }
+
+ Cursor = GicItsInfo;
while (GicItsCount-- != 0) {
- AddGICInterruptTranslationService (GicIts++, GicItsInfo++);
+ AddGICInterruptTranslationService (GicIts++, Cursor++);
}
+
+ FreePool (GicItsInfo);
}
/** Construct the MADT ACPI table.
@@ -454,16 +449,13 @@ BuildMadtTable (
{
EFI_STATUS Status;
UINT32 TableSize;
+
UINT32 GicCCount;
UINT32 GicDCount;
UINT32 GicMSICount;
UINT32 GicRedistCount;
UINT32 GicItsCount;
- CM_ARM_GICC_INFO * GicCInfo;
- CM_ARM_GICD_INFO * GicDInfo;
- CM_ARM_GIC_MSI_FRAME_INFO * GicMSIInfo;
- CM_ARM_GIC_REDIST_INFO * GicRedistInfo;
- CM_ARM_GIC_ITS_INFO * GicItsInfo;
+
UINT32 GicCOffset;
UINT32 GicDOffset;
UINT32 GicMSIOffset;
@@ -474,7 +466,6 @@ BuildMadtTable (
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
- ASSERT (CfgMgrProtocol != NULL);
ASSERT (Table != NULL);
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
@@ -492,21 +483,12 @@ BuildMadtTable (
return EFI_INVALID_PARAMETER;
}
+ // Allocated memory pointers
*Table = NULL;
- Status = GetEArmObjGicCInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GicCInfo,
- &GicCCount
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: MADT: Failed to get GICC Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ Status = CfgMgrCountObjects (EArmObjGicCInfo, &GicCCount);
+ if (EFI_ERROR(Status)) {
+ return Status;
}
if (GicCCount == 0) {
@@ -515,23 +497,12 @@ BuildMadtTable (
"ERROR: MADT: GIC CPU Interface information not provided.\n"
));
ASSERT (GicCCount != 0);
- Status = EFI_INVALID_PARAMETER;
- goto error_handler;
+ return EFI_INVALID_PARAMETER;
}
- Status = GetEArmObjGicDInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GicDInfo,
- &GicDCount
- );
+ Status = CfgMgrCountObjects (EArmObjGicDInfo, &GicDCount);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: MADT: Failed to get GICD Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
if (GicDCount == 0) {
@@ -540,8 +511,7 @@ BuildMadtTable (
"ERROR: MADT: GIC Distributor information not provided.\n"
));
ASSERT (GicDCount != 0);
- Status = EFI_INVALID_PARAMETER;
- goto error_handler;
+ return EFI_INVALID_PARAMETER;
}
if (GicDCount > 1) {
@@ -552,53 +522,22 @@ BuildMadtTable (
GicDCount
));
ASSERT (GicDCount <= 1);
- Status = EFI_INVALID_PARAMETER;
- goto error_handler;
+ return EFI_INVALID_PARAMETER;
}
- Status = GetEArmObjGicMsiFrameInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GicMSIInfo,
- &GicMSICount
- );
+ Status = CfgMgrCountObjects (EArmObjGicMsiFrameInfo, &GicMSICount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: MADT: Failed to get GIC MSI Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
- Status = GetEArmObjGicRedistributorInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GicRedistInfo,
- &GicRedistCount
- );
+ Status = CfgMgrCountObjects (EArmObjGicRedistributorInfo, &GicRedistCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: MADT: Failed to get GIC Redistributor Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
- Status = GetEArmObjGicItsInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GicItsInfo,
- &GicItsCount
- );
+ Status = CfgMgrCountObjects (EArmObjGicItsInfo, &GicItsCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: MADT: Failed to get GIC ITS Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
TableSize = sizeof (EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER);
@@ -619,21 +558,11 @@ BuildMadtTable (
TableSize += (sizeof (EFI_ACPI_6_3_GIC_ITS_STRUCTURE) * GicItsCount);
// Allocate the Buffer for MADT table
- *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
- if (*Table == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: MADT: Failed to allocate memory for MADT Table, Size = %d," \
- " Status = %r\n",
- TableSize,
- Status
- ));
- goto error_handler;
+ Madt = AllocateZeroPool (TableSize);
+ if (Madt == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
- Madt = (EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER*)*Table;
-
DEBUG ((
DEBUG_INFO,
"MADT: Madt = 0x%p TableSize = 0x%x\n",
@@ -643,20 +572,13 @@ BuildMadtTable (
Status = AddAcpiHeader (This, &Madt->Header, AcpiTableInfo, TableSize);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: MADT: Failed to add ACPI header. Status = %r\n",
- Status
- ));
goto error_handler;
}
Status = AddGICCList (
- (EFI_ACPI_6_3_GIC_STRUCTURE*)((UINT8*)Madt + GicCOffset),
- GicCInfo,
- GicCCount,
- Madt->Header.Revision
- );
+ (EFI_ACPI_6_3_GIC_STRUCTURE *)((UINT8 *)Madt + GicCOffset),
+ Madt->Header.Revision);
+
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -666,42 +588,25 @@ BuildMadtTable (
goto error_handler;
}
- AddGICD (
- (EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE*)((UINT8*)Madt + GicDOffset),
- GicDInfo
- );
+ AddGICD ((VOID *)((UINT8 *)Madt + GicDOffset));
if (GicMSICount != 0) {
- AddGICMsiFrameInfoList (
- (EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE*)((UINT8*)Madt + GicMSIOffset),
- GicMSIInfo,
- GicMSICount
- );
+ AddGICMsiFrameInfoList ((VOID *)((UINT8 *)Madt + GicMSIOffset));
}
if (GicRedistCount != 0) {
- AddGICRedistributorList (
- (EFI_ACPI_6_3_GICR_STRUCTURE*)((UINT8*)Madt + GicRedistOffset),
- GicRedistInfo,
- GicRedistCount
- );
+ AddGICRedistributorList ((VOID *)((UINT8 *)Madt + GicRedistOffset));
}
if (GicItsCount != 0) {
- AddGICItsList (
- (EFI_ACPI_6_3_GIC_ITS_STRUCTURE*)((UINT8*)Madt + GicItsOffset),
- GicItsInfo,
- GicItsCount
- );
+ AddGICItsList ((VOID *)((UINT8 *)Madt + GicItsOffset));
}
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER*)Madt;
return EFI_SUCCESS;
error_handler:
- if (*Table != NULL) {
- FreePool (*Table);
- *Table = NULL;
- }
+ FreePool (Madt);
return Status;
}
@@ -727,7 +632,6 @@ FreeMadtTableResources (
{
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
- ASSERT (CfgMgrProtocol != NULL);
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
index a486e2297a..0283ea11f5 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
@@ -18,7 +18,6 @@
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
-#include <ConfigurationManagerHelper.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
@@ -48,50 +47,52 @@ typedef
#pragma pack()
-/** Retrieve the PCI Configuration Space Information.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPciConfigSpaceInfo,
- CM_ARM_PCI_CONFIG_SPACE_INFO
- );
-
/** Add the PCI Enhanced Configuration Space Information to the MCFG Table.
@param [in] Mcfg Pointer to MCFG Table.
@param [in] PciCfgSpaceOffset Offset for the PCI Configuration Space
Info structure in the MCFG Table.
- @param [in] PciCfgSpaceInfoList Pointer to the PCI Configuration Space
- Info List.
- @param [in] PciCfgSpaceCount Count of PCI Configuration Space Info.
**/
STATIC
VOID
AddPciConfigurationSpaceList (
IN MCFG_TABLE * CONST Mcfg,
- IN CONST UINT32 PciCfgSpaceOffset,
- IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO * PciCfgSpaceInfoList,
- IN UINT32 PciCfgSpaceCount
+ IN CONST UINT32 PciCfgSpaceOffset
)
{
- MCFG_CFG_SPACE_ADDR * PciCfgSpace;
+ MCFG_CFG_SPACE_ADDR *PciCfgSpace;
+ CM_ARM_PCI_CONFIG_SPACE_INFO *Cursor;
+ VOID *PciCfgSpaceInfoList;
+ UINT32 PciCfgSpaceCount;
+ EFI_STATUS Status;
ASSERT (Mcfg != NULL);
- ASSERT (PciCfgSpaceInfoList != NULL);
+
+ Status = CfgMgrGetObjects (
+ EArmObjPciConfigSpaceInfo,
+ CM_NULL_TOKEN,
+ &PciCfgSpaceInfoList,
+ &PciCfgSpaceCount);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
PciCfgSpace = (MCFG_CFG_SPACE_ADDR *)((UINT8*)Mcfg + PciCfgSpaceOffset);
+ Cursor = PciCfgSpaceInfoList;
while (PciCfgSpaceCount-- != 0) {
// Add PCI Configuration Space entry
- PciCfgSpace->BaseAddress = PciCfgSpaceInfoList->BaseAddress;
+ PciCfgSpace->BaseAddress = Cursor->BaseAddress;
PciCfgSpace->PciSegmentGroupNumber =
- PciCfgSpaceInfoList->PciSegmentGroupNumber;
- PciCfgSpace->StartBusNumber = PciCfgSpaceInfoList->StartBusNumber;
- PciCfgSpace->EndBusNumber = PciCfgSpaceInfoList->EndBusNumber;
+ Cursor->PciSegmentGroupNumber;
+ PciCfgSpace->StartBusNumber = Cursor->StartBusNumber;
+ PciCfgSpace->EndBusNumber = Cursor->EndBusNumber;
PciCfgSpace->Reserved = EFI_ACPI_RESERVED_DWORD;
PciCfgSpace++;
- PciCfgSpaceInfoList++;
+ Cursor++;
}
+
+ FreePool (PciCfgSpaceInfoList);
}
/** Construct the MCFG ACPI table.
@@ -152,20 +153,14 @@ BuildMcfgTable (
return EFI_INVALID_PARAMETER;
}
+ // Pointers to allocated memory
*Table = NULL;
- Status = GetEArmObjPciConfigSpaceInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &PciConfigSpaceInfoList,
- &ConfigurationSpaceCount
- );
+ PciConfigSpaceInfoList = NULL;
+
+ Status =
+ CfgMgrCountObjects (EArmObjPciConfigSpaceInfo, &ConfigurationSpaceCount);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR,
- "ERROR: MCFG: Failed to get PCI Configuration Space Information." \
- " Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
if (ConfigurationSpaceCount == 0) {
@@ -174,9 +169,8 @@ BuildMcfgTable (
"ERROR: MCFG: Configuration Space Count = %d\n",
ConfigurationSpaceCount
));
- Status = EFI_INVALID_PARAMETER;
ASSERT (ConfigurationSpaceCount != 0);
- goto error_handler;
+ return EFI_INVALID_PARAMETER;
}
DEBUG ((
@@ -189,20 +183,11 @@ BuildMcfgTable (
TableSize = sizeof (MCFG_TABLE) +
((sizeof (MCFG_CFG_SPACE_ADDR) * ConfigurationSpaceCount));
- *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
- if (*Table == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: MCFG: Failed to allocate memory for MCFG Table, Size = %d," \
- " Status = %r\n",
- TableSize,
- Status
- ));
- goto error_handler;
+ Mcfg = AllocateZeroPool (TableSize);
+ if (Mcfg == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
- Mcfg = (MCFG_TABLE*)*Table;
DEBUG ((
DEBUG_INFO,
"MCFG: Mcfg = 0x%p TableSize = 0x%x\n",
@@ -212,30 +197,19 @@ BuildMcfgTable (
Status = AddAcpiHeader (This, &Mcfg->Header, AcpiTableInfo, TableSize);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: MCFG: Failed to add ACPI header. Status = %r\n",
- Status
- ));
goto error_handler;
}
Mcfg->Reserved = EFI_ACPI_RESERVED_QWORD;
- AddPciConfigurationSpaceList (
- Mcfg,
- sizeof (MCFG_TABLE),
- PciConfigSpaceInfoList,
- ConfigurationSpaceCount
- );
+ AddPciConfigurationSpaceList (Mcfg, sizeof (MCFG_TABLE));
+
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER*) Mcfg;
return EFI_SUCCESS;
error_handler:
- if (*Table != NULL) {
- FreePool (*Table);
- *Table = NULL;
- }
+ FreePool (Mcfg);
return Status;
}
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
index 99eb6e0929..0722b469f0 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
@@ -21,7 +21,6 @@
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
-#include <ConfigurationManagerHelper.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
@@ -39,56 +38,6 @@
- EArmObjGicCInfo (REQUIRED)
*/
-/**
- This macro expands to a function that retrieves the Processor Hierarchy
- information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjProcHierarchyInfo,
- CM_ARM_PROC_HIERARCHY_INFO
- );
-
-/**
- This macro expands to a function that retrieves the cache information
- from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjCacheInfo,
- CM_ARM_CACHE_INFO
- );
-
-/**
- This macro expands to a function that retrieves the ID information for
- Processor Hierarchy Nodes from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjProcNodeIdInfo,
- CM_ARM_PROC_NODE_ID_INFO
- );
-
-/**
- This macro expands to a function that retrieves the cross-CM-object-
- reference information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjCmRef,
- CM_ARM_OBJ_REF
- );
-
-/**
- This macro expands to a function that retrieves the GIC CPU interface
- information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGicCInfo,
- CM_ARM_GICC_INFO
- );
-
/**
Returns the size of the PPTT Processor Hierarchy Node (Type 0) given a
Processor Hierarchy Info CM object.
@@ -279,8 +228,6 @@ DetectCyclesInTopology (
Update the array of private resources for a given Processor Hierarchy Node.
@param [in] Generator Pointer to the PPTT Generator.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] PrivResArray Pointer to the array of private resources.
@param [in] PrivResCount Number of private resources.
@param [in] PrivResArrayToken Reference Token for the CM_ARM_OBJ_REF
@@ -294,20 +241,19 @@ STATIC
EFI_STATUS
AddPrivateResources (
IN CONST ACPI_PPTT_GENERATOR * CONST Generator,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN UINT32 * PrivResArray,
IN UINT32 PrivResCount,
IN CONST CM_OBJECT_TOKEN PrivResArrayToken
)
{
EFI_STATUS Status;
- CM_ARM_OBJ_REF * CmObjRefs;
+ CM_ARM_OBJ_REF * Cursor;
+ VOID * CmObjRefs;
UINT32 CmObjRefCount;
PPTT_NODE_INDEXER * PpttNodeFound;
ASSERT (
(Generator != NULL) &&
- (CfgMgrProtocol != NULL) &&
(PrivResArray != NULL) &&
(PrivResCount != 0)
);
@@ -327,12 +273,8 @@ AddPrivateResources (
CmObjRefCount = 0;
// Get the CM Object References
- Status = GetEArmObjCmRef (
- CfgMgrProtocol,
- PrivResArrayToken,
- &CmObjRefs,
- &CmObjRefCount
- );
+ Status = CfgMgrGetObjects (
+ EArmObjCmRef, PrivResArrayToken, (VOID **)&CmObjRefs, &CmObjRefCount);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -356,11 +298,12 @@ AddPrivateResources (
PrivResArrayToken,
Status
));
- return Status;
+ goto EXIT;
}
+ Cursor = CmObjRefs;
while (PrivResCount-- != 0) {
- if (CmObjRefs->ReferenceToken == CM_NULL_TOKEN) {
+ if (Cursor->ReferenceToken == CM_NULL_TOKEN) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
DEBUG_ERROR,
@@ -368,7 +311,7 @@ AddPrivateResources (
"private resource. Status = %r\n",
Status
));
- return Status;
+ goto EXIT;
}
// The Node indexer has the Processor hierarchy nodes at the begining
@@ -378,7 +321,7 @@ AddPrivateResources (
Generator->CacheStructIndexedList,
(Generator->ProcTopologyStructCount -
Generator->ProcHierarchyNodeCount),
- CmObjRefs->ReferenceToken,
+ Cursor->ReferenceToken,
&PpttNodeFound
);
if (EFI_ERROR (Status)) {
@@ -386,19 +329,21 @@ AddPrivateResources (
DEBUG_ERROR,
"ERROR: PPTT: Failed to get a private resource with Token = %p from " \
"Node Indexer. Status = %r\n",
- CmObjRefs->ReferenceToken,
+ Cursor->ReferenceToken,
Status
));
- return Status;
+ goto EXIT;
}
// Update the offset of the private resources in the Processor
// Hierarchy Node structure
*(PrivResArray++) = PpttNodeFound->Offset;
- CmObjRefs++;
+ Cursor++;
}
- return EFI_SUCCESS;
+EXIT:
+ FreePool (CmObjRefs);
+ return Status;
}
/**
@@ -485,7 +430,6 @@ STATIC
EFI_STATUS
AddProcHierarchyNodes (
IN CONST ACPI_PPTT_GENERATOR * CONST Generator,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER * Pptt,
IN CONST UINT32 NodesStartOffset
)
@@ -508,7 +452,6 @@ AddProcHierarchyNodes (
ASSERT (
(Generator != NULL) &&
- (CfgMgrProtocol != NULL) &&
(Pptt != NULL)
);
@@ -533,6 +476,9 @@ AddProcHierarchyNodes (
UniqueGicCRefCount = 0;
+ // Pointers to allocated memory
+ GicCInfoList = NULL;
+
while (NodeCount-- != 0) {
ProcInfoNode = (CM_ARM_PROC_HIERARCHY_INFO*)ProcNodeIterator->Object;
@@ -632,12 +578,11 @@ AddProcHierarchyNodes (
));
return Status;
} else {
- Status = GetEArmObjGicCInfo (
- CfgMgrProtocol,
- ProcInfoNode->GicCToken,
- &GicCInfoList,
- &GicCInfoCount
- );
+ Status = CfgMgrGetObjects (
+ EArmObjGicCInfo,
+ ProcInfoNode->GicCToken,
+ (VOID **)&GicCInfoList,
+ &GicCInfoCount);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -664,6 +609,7 @@ AddProcHierarchyNodes (
ProcInfoNode->Token,
Status
));
+ FreePool (GicCInfoList);
return Status;
}
@@ -673,6 +619,7 @@ AddProcHierarchyNodes (
// Increment the reference count for the number of
// Unique GICC objects that were retrieved.
UniqueGicCRefCount++;
+ FreePool (GicCInfoList);
}
ProcStruct->NumberOfPrivateResources = ProcInfoNode->NoOfPrivateResources;
@@ -683,7 +630,6 @@ AddProcHierarchyNodes (
// Populate the private resources array
Status = AddPrivateResources (
Generator,
- CfgMgrProtocol,
PrivateResources,
ProcStruct->NumberOfPrivateResources,
ProcInfoNode->PrivateResourcesArrayToken
@@ -707,18 +653,8 @@ AddProcHierarchyNodes (
// Knowing the total number of GICC references made and that all GICC Token
// references are unique, we can test if no GICC instances have been left out.
- Status = GetEArmObjGicCInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GicCInfoList,
- &GicCInfoCount
- );
+ Status = CfgMgrCountObjects (EArmObjGicCInfo, &GicCInfoCount);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: PPTT: Failed to get GICC Info. Status = %r\n",
- Status
- ));
return Status;
}
@@ -749,8 +685,6 @@ AddProcHierarchyNodes (
the Configuration Manager and adds this information to the PPTT table.
@param [in] Generator Pointer to the PPTT Generator.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] Pptt Pointer to PPTT table structure.
@param [in] NodesStartOffset Offset from the start of PPTT table to the
start of Cache Type Structures.
@@ -763,7 +697,6 @@ STATIC
EFI_STATUS
AddCacheTypeStructures (
IN CONST ACPI_PPTT_GENERATOR * CONST Generator,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER * Pptt,
IN CONST UINT32 NodesStartOffset
)
@@ -775,11 +708,8 @@ AddCacheTypeStructures (
PPTT_NODE_INDEXER * CacheNodeIterator;
UINT32 NodeCount;
- ASSERT (
- (Generator != NULL) &&
- (CfgMgrProtocol != NULL) &&
- (Pptt != NULL)
- );
+ ASSERT (Generator != NULL);
+ ASSERT (Pptt != NULL);
CacheStruct = (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE*)((UINT8*)Pptt +
NodesStartOffset);
@@ -971,8 +901,6 @@ AddCacheTypeStructures (
the Configuration Manager and and adds this information to the PPTT table.
@param [in] Generator Pointer to the PPTT Generator.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] Pptt Pointer to PPTT table structure.
@param [in] NodesStartOffset Offset from the start of PPTT table to the
start of ID Type Structures.
@@ -985,7 +913,6 @@ STATIC
EFI_STATUS
AddIdTypeStructures (
IN CONST ACPI_PPTT_GENERATOR * CONST Generator,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN CONST EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER * Pptt,
IN CONST UINT32 NodesStartOffset
)
@@ -998,7 +925,6 @@ AddIdTypeStructures (
ASSERT (
(Generator != NULL) &&
- (CfgMgrProtocol != NULL) &&
(Pptt != NULL)
);
@@ -1074,10 +1000,7 @@ BuildPpttTable (
UINT32 CacheStructOffset;
UINT32 IdStructOffset;
- CM_ARM_PROC_HIERARCHY_INFO * ProcHierarchyNodeList;
- CM_ARM_CACHE_INFO * CacheStructList;
- CM_ARM_PROC_NODE_ID_INFO * IdStructList;
-
+ VOID * NodeList;
ACPI_PPTT_GENERATOR * Generator;
// Pointer to the Node Indexer array
@@ -1088,7 +1011,6 @@ BuildPpttTable (
ASSERT (
(This != NULL) &&
(AcpiTableInfo != NULL) &&
- (CfgMgrProtocol != NULL) &&
(Table != NULL) &&
(AcpiTableInfo->TableGeneratorId == This->GeneratorID) &&
(AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature)
@@ -1108,23 +1030,12 @@ BuildPpttTable (
}
Generator = (ACPI_PPTT_GENERATOR*)This;
- *Table = NULL;
// Get the processor hierarchy info and update the processor topology
// structure count with Processor Hierarchy Nodes (Type 0)
- Status = GetEArmObjProcHierarchyInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &ProcHierarchyNodeList,
- &ProcHierarchyNodeCount
- );
+ Status = CfgMgrCountObjects (EArmObjProcHierarchyInfo, &ProcHierarchyNodeCount);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: PPTT: Failed to get processor hierarchy info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
ProcTopologyStructCount = ProcHierarchyNodeCount;
@@ -1132,19 +1043,9 @@ BuildPpttTable (
// Get the cache info and update the processor topology structure count with
// Cache Type Structures (Type 1)
- Status = GetEArmObjCacheInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &CacheStructList,
- &CacheStructCount
- );
+ Status = CfgMgrCountObjects (EArmObjCacheInfo, &CacheStructCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: PPTT: Failed to get cache info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
ProcTopologyStructCount += CacheStructCount;
@@ -1152,38 +1053,18 @@ BuildPpttTable (
// Get the processor hierarchy node ID info and update the processor topology
// structure count with ID Structures (Type 2)
- Status = GetEArmObjProcNodeIdInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &IdStructList,
- &IdStructCount
- );
+ Status = CfgMgrCountObjects (EArmObjProcNodeIdInfo, &IdStructCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: PPTT: Failed to get processor hierarchy node ID info. " \
- "Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
ProcTopologyStructCount += IdStructCount;
Generator->IdStructCount = IdStructCount;
// Allocate Node Indexer array
- NodeIndexer = (PPTT_NODE_INDEXER*)AllocateZeroPool (
- sizeof (PPTT_NODE_INDEXER) *
- ProcTopologyStructCount
- );
+ NodeIndexer = AllocateZeroPool (sizeof (PPTT_NODE_INDEXER) * ProcTopologyStructCount);
if (NodeIndexer == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: PPTT: Failed to allocate memory for Node Indexer. Status = %r\n ",
- Status
- ));
- goto error_handler;
+ return EFI_OUT_OF_RESOURCES;
}
DEBUG ((DEBUG_INFO, "INFO: NodeIndexer = %p\n", NodeIndexer));
@@ -1197,12 +1078,14 @@ BuildPpttTable (
if (Generator->ProcHierarchyNodeCount != 0) {
ProcHierarchyNodeOffset = TableSize;
Generator->ProcHierarchyNodeIndexedList = NodeIndexer;
+
+ CfgMgrGetSimpleObject(EArmObjProcHierarchyInfo, &NodeList);
TableSize += GetSizeofProcHierarchyNodes (
- ProcHierarchyNodeOffset,
- ProcHierarchyNodeList,
- Generator->ProcHierarchyNodeCount,
- &NodeIndexer
- );
+ ProcHierarchyNodeOffset,
+ NodeList,
+ Generator->ProcHierarchyNodeCount,
+ &NodeIndexer);
+ FreePool (NodeList);
DEBUG ((
DEBUG_INFO,
@@ -1220,33 +1103,32 @@ BuildPpttTable (
if (Generator->CacheStructCount != 0) {
CacheStructOffset = TableSize;
Generator->CacheStructIndexedList = NodeIndexer;
+
+ CfgMgrGetSimpleObject(EArmObjCacheInfo, &NodeList);
TableSize += GetSizeofCacheTypeStructs (
- CacheStructOffset,
- CacheStructList,
- Generator->CacheStructCount,
- &NodeIndexer
- );
- DEBUG ((
- DEBUG_INFO,
- " CacheStructCount = %d\n" \
- " CacheStructOffset = 0x%x\n" \
- " CacheStructIndexedList = 0x%p\n",
- Generator->CacheStructCount,
- CacheStructOffset,
- Generator->CacheStructIndexedList
- ));
+ CacheStructOffset, NodeList, Generator->CacheStructCount, &NodeIndexer);
+ FreePool (NodeList);
+
+ DEBUG (
+ (DEBUG_INFO,
+ " CacheStructCount = %d\n"
+ " CacheStructOffset = 0x%x\n"
+ " CacheStructIndexedList = 0x%p\n",
+ Generator->CacheStructCount,
+ CacheStructOffset,
+ Generator->CacheStructIndexedList));
}
// Include the size of ID Type Structures and index them
if (Generator->IdStructCount != 0) {
IdStructOffset = TableSize;
Generator->IdStructIndexedList = NodeIndexer;
+
+ CfgMgrGetSimpleObject (EArmObjProcNodeIdInfo, &NodeList);
TableSize += GetSizeofIdStructs (
- IdStructOffset,
- IdStructList,
- Generator->IdStructCount,
- &NodeIndexer
- );
+ IdStructOffset, NodeList, Generator->IdStructCount, &NodeIndexer);
+ FreePool (NodeList);
+
DEBUG ((
DEBUG_INFO,
" IdStructCount = %d\n" \
@@ -1268,21 +1150,12 @@ BuildPpttTable (
));
// Allocate the Buffer for the PPTT table
- *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
- if (*Table == NULL) {
+ Pptt = AllocateZeroPool (TableSize);
+ if (Pptt == NULL) {
Status = EFI_OUT_OF_RESOURCES;
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: PPTT: Failed to allocate memory for PPTT Table. " \
- "Size = %d. Status = %r\n",
- TableSize,
- Status
- ));
goto error_handler;
}
- Pptt = (EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER*)*Table;
-
DEBUG ((
DEBUG_INFO,
"PPTT: Pptt = 0x%p. TableSize = 0x%x\n",
@@ -1293,22 +1166,12 @@ BuildPpttTable (
// Add ACPI header
Status = AddAcpiHeader (This, &Pptt->Header, AcpiTableInfo, TableSize);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: PPTT: Failed to add ACPI header. Status = %r\n",
- Status
- ));
goto error_handler;
}
// Add Processor Hierarchy Nodes (Type 0) to the generated table
if (Generator->ProcHierarchyNodeCount != 0) {
- Status = AddProcHierarchyNodes (
- Generator,
- CfgMgrProtocol,
- Pptt,
- ProcHierarchyNodeOffset
- );
+ Status = AddProcHierarchyNodes (Generator, Pptt, ProcHierarchyNodeOffset);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -1321,12 +1184,7 @@ BuildPpttTable (
// Add Cache Type Structures (Type 1) to the generated table
if (Generator->CacheStructCount != 0) {
- Status = AddCacheTypeStructures (
- Generator,
- CfgMgrProtocol,
- Pptt,
- CacheStructOffset
- );
+ Status = AddCacheTypeStructures (Generator, Pptt, CacheStructOffset);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -1339,12 +1197,7 @@ BuildPpttTable (
// Add ID Type Structures (Type 2) to the generated table
if (Generator->IdStructCount != 0) {
- Status = AddIdTypeStructures (
- Generator,
- CfgMgrProtocol,
- Pptt,
- IdStructOffset
- );
+ Status = AddIdTypeStructures (Generator, Pptt, IdStructOffset);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
@@ -1366,6 +1219,7 @@ BuildPpttTable (
goto error_handler;
}
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER*)Pptt;
return Status;
error_handler:
@@ -1374,9 +1228,8 @@ error_handler:
Generator->NodeIndexer = NULL;
}
- if (*Table != NULL) {
- FreePool (*Table);
- *Table = NULL;
+ if (Pptt != NULL) {
+ FreePool (Pptt);
}
return Status;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c
index 2facfaa048..2a8e392d84 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c
@@ -12,7 +12,6 @@
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
-#include <ConfigurationManagerHelper.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
index 46f53f819a..0a7e9da96e 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
@@ -14,12 +14,12 @@
#include <IndustryStandard/SerialPortConsoleRedirectionTable.h>
#include <Library/AcpiLib.h>
#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
#include <Protocol/AcpiTable.h>
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
-#include <ConfigurationManagerHelper.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
@@ -83,15 +83,6 @@ EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE AcpiSpcr = {
#pragma pack()
-/** This macro expands to a function that retrieves the Serial
- Port Information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjSerialConsolePortInfo,
- CM_ARM_SERIAL_PORT_INFO
- )
-
/** Construct the SPCR ACPI table.
This function invokes the Configuration Manager protocol interface
@@ -131,7 +122,6 @@ BuildSpcrTable (
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
- ASSERT (CfgMgrProtocol != NULL);
ASSERT (Table != NULL);
ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
@@ -149,21 +139,10 @@ BuildSpcrTable (
return EFI_INVALID_PARAMETER;
}
- *Table = NULL;
-
- Status = GetEArmObjSerialConsolePortInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &SerialPortInfo,
- NULL
- );
+ Status = CfgMgrGetSimpleObject (
+ EArmObjSerialConsolePortInfo, (VOID **)&SerialPortInfo);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SPCR: Failed to get serial port information. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
if (SerialPortInfo->BaseAddress == 0) {
@@ -207,11 +186,6 @@ BuildSpcrTable (
AcpiTableInfo,
sizeof (EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE));
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SPCR: Failed to add ACPI header. Status = %r\n",
- Status
- ));
goto error_handler;
}
@@ -268,6 +242,7 @@ BuildSpcrTable (
*Table = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiSpcr;
error_handler:
+ FreePool (SerialPortInfo);
return Status;
}
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c
index fda0837f32..28cc8f9e8e 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c
@@ -21,7 +21,6 @@
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
-#include <ConfigurationManagerHelper.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
@@ -38,65 +37,6 @@
- EArmObjDeviceHandlePci (OPTIONAL)
*/
-/** This macro expands to a function that retrieves the GIC
- CPU interface Information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGicCInfo,
- CM_ARM_GICC_INFO
- );
-
-/** This macro expands to a function that retrieves the GIC
- Interrupt Translation Service Information from the
- Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGicItsInfo,
- CM_ARM_GIC_ITS_INFO
- );
-
-/**
- This macro expands to a function that retrieves the Memory Affinity
- information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjMemoryAffinityInfo,
- CM_ARM_MEMORY_AFFINITY_INFO
- );
-
-/**
- This macro expands to a function that retrieves the Generic Initiator Affinity
- information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGenericInitiatorAffinityInfo,
- CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO
- );
-
-/**
- This macro expands to a function that retrieves the ACPI Device Handle
- information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjDeviceHandleAcpi,
- CM_ARM_DEVICE_HANDLE_ACPI
- );
-
-/**
- This macro expands to a function that retrieves the PCI Device Handle
- information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjDeviceHandlePci,
- CM_ARM_DEVICE_HANDLE_PCI
- );
-
/** Return the PCI Device information in BDF format
@@ -123,147 +63,163 @@ GetBdf (
/** Add the GICC Affinity Structures in the SRAT Table.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] Srat Pointer to the SRAT Table.
@param [in] GicCAffOffset Offset of the GICC Affinity
information in the SRAT Table.
- @param [in] GicCInfo Pointer to the GIC CPU Information list.
- @param [in] GicCCount Count of GIC CPU Interfaces.
@retval EFI_SUCCESS Table generated successfully.
**/
STATIC
EFI_STATUS
AddGICCAffinity (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * CONST Srat,
- IN CONST UINT32 GicCAffOffset,
- IN CONST CM_ARM_GICC_INFO * GicCInfo,
- IN UINT32 GicCCount
+ IN CONST UINT32 GicCAffOffset
)
{
- EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE * GicCAff;
+ EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *GicCAff;
+ VOID *GicCInfo;
+ CM_ARM_GICC_INFO *Cursor;
+ UINT32 GicCCount;
+ EFI_STATUS Status;
ASSERT (Srat != NULL);
- ASSERT (GicCInfo != NULL);
+
+ Status =
+ CfgMgrGetObjects (EArmObjGicCInfo, CM_NULL_TOKEN, &GicCInfo, &GicCCount);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
GicCAff = (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *)((UINT8*)Srat +
GicCAffOffset);
+ Cursor = GicCInfo;
while (GicCCount-- != 0) {
DEBUG ((DEBUG_INFO, "SRAT: GicCAff = 0x%p\n", GicCAff));
GicCAff->Type = EFI_ACPI_6_3_GICC_AFFINITY;
GicCAff->Length = sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE);
- GicCAff->ProximityDomain = GicCInfo->ProximityDomain;
- GicCAff->AcpiProcessorUid = GicCInfo->AcpiProcessorUid;
- GicCAff->Flags = GicCInfo->AffinityFlags;
- GicCAff->ClockDomain = GicCInfo->ClockDomain;
+ GicCAff->ProximityDomain = Cursor->ProximityDomain;
+ GicCAff->AcpiProcessorUid = Cursor->AcpiProcessorUid;
+ GicCAff->Flags = Cursor->AffinityFlags;
+ GicCAff->ClockDomain = Cursor->ClockDomain;
// Next
GicCAff++;
- GicCInfo++;
+ Cursor++;
}// while
+
+ FreePool (GicCInfo);
return EFI_SUCCESS;
}
/** Add the GIC ITS Affinity Structures in the SRAT Table.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] Srat Pointer to the SRAT Table.
@param [in] GicItsAffOffset Offset of the GIC ITS Affinity
information in the SRAT Table.
- @param [in] GicItsInfo Pointer to the GIC ITS Information list.
- @param [in] GicItsCount Count of GIC ITS.
@retval EFI_SUCCESS Table generated successfully.
**/
STATIC
EFI_STATUS
AddGICItsAffinity (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * CONST Srat,
- IN CONST UINT32 GicItsAffOffset,
- IN CONST CM_ARM_GIC_ITS_INFO * GicItsInfo,
- IN UINT32 GicItsCount
+ IN CONST UINT32 GicItsAffOffset
)
{
- EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE * GicItsAff;
+ EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE *GicItsAff;
+ CM_ARM_GIC_ITS_INFO *Cursor;
+ VOID *GicItsInfo;
+ UINT32 GicItsCount;
+ EFI_STATUS Status;
ASSERT (Srat != NULL);
- ASSERT (GicItsInfo != NULL);
+
+ Status = CfgMgrGetObjects (
+ EArmObjGicItsInfo, CM_NULL_TOKEN, (VOID **)&GicItsInfo, &GicItsCount);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
GicItsAff = (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE *)((UINT8*)Srat +
GicItsAffOffset);
+ Cursor = GicItsInfo;
while (GicItsCount-- != 0) {
DEBUG ((DEBUG_INFO, "SRAT: GicItsAff = 0x%p\n", GicItsAff));
GicItsAff->Type = EFI_ACPI_6_3_GIC_ITS_AFFINITY;
GicItsAff->Length = sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE);
- GicItsAff->ProximityDomain = GicItsInfo->ProximityDomain;
+ GicItsAff->ProximityDomain = Cursor->ProximityDomain;
GicItsAff->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
GicItsAff->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
- GicItsAff->ItsId = GicItsInfo->GicItsId;
+ GicItsAff->ItsId = Cursor->GicItsId;
// Next
GicItsAff++;
- GicItsInfo++;
+ Cursor++;
}// while
+
+ FreePool (GicItsInfo);
return EFI_SUCCESS;
}
/** Add the Memory Affinity Structures in the SRAT Table.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
@param [in] Srat Pointer to the SRAT Table.
@param [in] MemAffOffset Offset of the Memory Affinity
information in the SRAT Table.
- @param [in] MemAffInfo Pointer to the Memory Affinity Information list.
- @param [in] MemAffCount Count of Memory Affinity objects.
@retval EFI_SUCCESS Table generated successfully.
**/
STATIC
EFI_STATUS
AddMemoryAffinity (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * CONST Srat,
- IN CONST UINT32 MemAffOffset,
- IN CONST CM_ARM_MEMORY_AFFINITY_INFO * MemAffInfo,
- IN UINT32 MemAffCount
+ IN CONST UINT32 MemAffOffset
)
{
- EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE * MemAff;
+ EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE *MemAff;
+ CM_ARM_MEMORY_AFFINITY_INFO *Cursor;
+ VOID *MemAffInfo;
+ UINT32 MemAffCount;
+ EFI_STATUS Status;
ASSERT (Srat != NULL);
- ASSERT (MemAffInfo != NULL);
+
+ Status = CfgMgrGetObjects (
+ EArmObjMemoryAffinityInfo, CM_NULL_TOKEN, &MemAffInfo, &MemAffCount);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
MemAff = (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE *)((UINT8*)Srat +
MemAffOffset);
+
+ Cursor = MemAffInfo;
while (MemAffCount-- != 0) {
DEBUG ((DEBUG_INFO, "SRAT: MemAff = 0x%p\n", MemAff));
MemAff->Type = EFI_ACPI_6_3_MEMORY_AFFINITY;
MemAff->Length = sizeof (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE);
- MemAff->ProximityDomain = MemAffInfo->ProximityDomain;
+ MemAff->ProximityDomain = Cursor->ProximityDomain;
MemAff->Reserved1 = EFI_ACPI_RESERVED_WORD;
- MemAff->AddressBaseLow = (UINT32)(MemAffInfo->BaseAddress & MAX_UINT32);
- MemAff->AddressBaseHigh = (UINT32)(MemAffInfo->BaseAddress >> 32);
- MemAff->LengthLow = (UINT32)(MemAffInfo->Length & MAX_UINT32);
- MemAff->LengthHigh = (UINT32)(MemAffInfo->Length >> 32);
+ MemAff->AddressBaseLow = (UINT32)(Cursor->BaseAddress & MAX_UINT32);
+ MemAff->AddressBaseHigh = (UINT32)(Cursor->BaseAddress >> 32);
+ MemAff->LengthLow = (UINT32)(Cursor->Length & MAX_UINT32);
+ MemAff->LengthHigh = (UINT32)(Cursor->Length >> 32);
MemAff->Reserved2 = EFI_ACPI_RESERVED_DWORD;
- MemAff->Flags = MemAffInfo->Flags;
+ MemAff->Flags = Cursor->Flags;
MemAff->Reserved3 = EFI_ACPI_RESERVED_QWORD;
// Next
MemAff++;
- MemAffInfo++;
+ Cursor++;
}// while
+
+ FreePool (MemAffInfo);
return EFI_SUCCESS;
}
@@ -290,11 +246,8 @@ AddMemoryAffinity (
STATIC
EFI_STATUS
AddGenericInitiatorAffinity (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * CONST Srat,
- IN CONST UINT32 GenInitAffOff,
- IN CONST CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO * GenInitAffInfo,
- IN UINT32 GenInitAffCount
+ IN CONST UINT32 GenInitAffOff
)
{
EFI_STATUS Status;
@@ -302,13 +255,25 @@ AddGenericInitiatorAffinity (
CM_ARM_DEVICE_HANDLE_ACPI * DeviceHandleAcpi;
CM_ARM_DEVICE_HANDLE_PCI * DeviceHandlePci;
UINT32 DeviceHandleCount;
+ CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO * Cursor;
+ VOID * GenInitAffInfo;
+ UINT32 GenInitAffCount;
ASSERT (Srat != NULL);
- ASSERT (GenInitAffInfo != NULL);
+
+ Status = CfgMgrGetObjects (
+ EArmObjGenericInitiatorAffinityInfo,
+ CM_NULL_TOKEN,
+ &GenInitAffInfo,
+ &GenInitAffCount);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
GenInitAff = (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE *)(
(UINT8*)Srat + GenInitAffOff);
+ Cursor = GenInitAffInfo;
while (GenInitAffCount-- != 0) {
DEBUG ((DEBUG_INFO, "SRAT: GenInitAff = 0x%p\n", GenInitAff));
@@ -316,35 +281,35 @@ AddGenericInitiatorAffinity (
GenInitAff->Length =
sizeof (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE);
GenInitAff->Reserved1 = EFI_ACPI_RESERVED_WORD;
- GenInitAff->DeviceHandleType = GenInitAffInfo->DeviceHandleType;
- GenInitAff->ProximityDomain = GenInitAffInfo->ProximityDomain;
+ GenInitAff->DeviceHandleType = Cursor->DeviceHandleType;
+ GenInitAff->ProximityDomain = Cursor->ProximityDomain;
- if (GenInitAffInfo->DeviceHandleToken == CM_NULL_TOKEN) {
+ if (Cursor->DeviceHandleToken == CM_NULL_TOKEN) {
DEBUG ((
DEBUG_ERROR,
"ERROR: SRAT: Invalid Device Handle Token.\n"
));
ASSERT (0);
- return EFI_INVALID_PARAMETER;
+ Status = EFI_INVALID_PARAMETER;
+ goto EXIT;
}
- if (GenInitAffInfo->DeviceHandleType == EFI_ACPI_6_3_ACPI_DEVICE_HANDLE) {
- Status = GetEArmObjDeviceHandleAcpi (
- CfgMgrProtocol,
- GenInitAffInfo->DeviceHandleToken,
- &DeviceHandleAcpi,
- &DeviceHandleCount
- );
+ if (Cursor->DeviceHandleType == EFI_ACPI_6_3_ACPI_DEVICE_HANDLE) {
+ Status = CfgMgrGetObjects (
+ EArmObjDeviceHandleAcpi,
+ Cursor->DeviceHandleToken,
+ (VOID **) &DeviceHandleAcpi,
+ &DeviceHandleCount);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
"ERROR: SRAT: Failed to get ACPI Device Handle Inf."
" DeviceHandleToken = %p."
" Status = %r\n",
- GenInitAffInfo->DeviceHandleToken,
+ Cursor->DeviceHandleToken,
Status
));
- return Status;
+ goto EXIT;
}
// We are expecting only one device handle.
@@ -357,24 +322,24 @@ AddGenericInitiatorAffinity (
GenInitAff->DeviceHandle.Acpi.Reserved[1] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Acpi.Reserved[2] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Acpi.Reserved[3] = EFI_ACPI_RESERVED_BYTE;
- } else if (GenInitAffInfo->DeviceHandleType ==
+ FreePool (DeviceHandleAcpi);
+ } else if (Cursor->DeviceHandleType ==
EFI_ACPI_6_3_PCI_DEVICE_HANDLE) {
- Status = GetEArmObjDeviceHandlePci (
- CfgMgrProtocol,
- GenInitAffInfo->DeviceHandleToken,
- &DeviceHandlePci,
- &DeviceHandleCount
- );
+ Status = CfgMgrGetObjects (
+ EArmObjDeviceHandlePci,
+ Cursor->DeviceHandleToken,
+ (VOID **) &DeviceHandlePci,
+ &DeviceHandleCount);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
"ERROR: SRAT: Failed to get ACPI Device Handle Inf."
" DeviceHandleToken = %p."
" Status = %r\n",
- GenInitAffInfo->DeviceHandleToken,
+ Cursor->DeviceHandleToken,
Status
));
- return Status;
+ goto EXIT;
}
// We are expecting only one device handle
@@ -384,6 +349,8 @@ AddGenericInitiatorAffinity (
GenInitAff->DeviceHandle.Pci.PciSegment = DeviceHandlePci->SegmentNumber;
GenInitAff->DeviceHandle.Pci.PciBdfNumber = GetBdf (DeviceHandlePci);
+ FreePool (DeviceHandlePci);
+
GenInitAff->DeviceHandle.Pci.Reserved[0] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[1] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->DeviceHandle.Pci.Reserved[2] = EFI_ACPI_RESERVED_BYTE;
@@ -405,15 +372,18 @@ AddGenericInitiatorAffinity (
return EFI_INVALID_PARAMETER;
}
- GenInitAff->Flags = GenInitAffInfo->Flags;
+ GenInitAff->Flags = Cursor->Flags;
GenInitAff->Reserved2[0] = EFI_ACPI_RESERVED_BYTE;
GenInitAff->Reserved2[1] = EFI_ACPI_RESERVED_BYTE;
// Next
GenInitAff++;
- GenInitAffInfo++;
+ Cursor++;
}// while
- return EFI_SUCCESS;
+
+EXIT:
+ FreePool (GenInitAffInfo);
+ return Status;
}
/** Construct the SRAT ACPI table.
@@ -450,6 +420,7 @@ BuildSratTable (
)
{
EFI_STATUS Status;
+
UINT32 TableSize;
UINT32 GicCCount;
UINT32 GicItsCount;
@@ -461,21 +432,13 @@ BuildSratTable (
UINT32 MemAffOffset;
UINT32 GenInitiatorAffOffset;
- CM_ARM_GICC_INFO * GicCInfo;
- CM_ARM_GIC_ITS_INFO * GicItsInfo;
- CM_ARM_MEMORY_AFFINITY_INFO * MemAffInfo;
- CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO * GenInitiatorAffInfo;
-
EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER * Srat;
- ASSERT (
- (This != NULL) &&
- (AcpiTableInfo != NULL) &&
- (CfgMgrProtocol != NULL) &&
- (Table != NULL) &&
- (AcpiTableInfo->TableGeneratorId == This->GeneratorID) &&
- (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature)
- );
+ ASSERT (This != NULL);
+ ASSERT (AcpiTableInfo != NULL);
+ ASSERT (Table != NULL);
+ ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
+ ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
(AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) {
@@ -490,21 +453,9 @@ BuildSratTable (
return EFI_INVALID_PARAMETER;
}
- *Table = NULL;
-
- Status = GetEArmObjGicCInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GicCInfo,
- &GicCCount
- );
+ Status = CfgMgrCountObjects (EArmObjGicCInfo, &GicCCount);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SRAT: Failed to get GICC Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
if (GicCCount == 0) {
@@ -513,54 +464,23 @@ BuildSratTable (
"ERROR: SRAT: GIC CPU Interface information not provided.\n"
));
ASSERT (0);
- Status = EFI_INVALID_PARAMETER;
- goto error_handler;
+ return EFI_INVALID_PARAMETER;
}
- Status = GetEArmObjGicItsInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GicItsInfo,
- &GicItsCount
- );
+ Status = CfgMgrCountObjects (EArmObjGicItsInfo, &GicItsCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SRAT: Failed to get GIC ITS Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
- Status = GetEArmObjMemoryAffinityInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &MemAffInfo,
- &MemAffCount
- );
+ Status = CfgMgrCountObjects (EArmObjMemoryAffinityInfo, &MemAffCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SRAT: Failed to get Memory Affinity Info. Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
- Status = GetEArmObjGenericInitiatorAffinityInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GenInitiatorAffInfo,
- &GenInitiatorAffCount
- );
+ Status = CfgMgrCountObjects (
+ EArmObjGenericInitiatorAffinityInfo, &GenInitiatorAffCount);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SRAT: Failed to get Generic Initiator Affinity Info."
- " Status = %r\n",
- Status
- ));
- goto error_handler;
+ return Status;
}
// Calculate the size of the SRAT table
@@ -588,35 +508,15 @@ BuildSratTable (
}
// Allocate the Buffer for SRAT table
- *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
- if (*Table == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SRAT: Failed to allocate memory for SRAT Table, Size = %d," \
- " Status = %r\n",
- TableSize,
- Status
- ));
- goto error_handler;
+ Srat = AllocateZeroPool (TableSize);
+ if (Srat == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
- Srat = (EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER*)*Table;
-
- DEBUG ((
- DEBUG_INFO,
- "SRAT: Srat = 0x%p TableSize = 0x%x\n",
- Srat,
- TableSize
- ));
+ DEBUG ((DEBUG_INFO, "SRAT: Srat = 0x%p TableSize = 0x%x\n", Srat, TableSize));
Status = AddAcpiHeader (This, &Srat->Header, AcpiTableInfo, TableSize);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SRAT: Failed to add ACPI header. Status = %r\n",
- Status
- ));
goto error_handler;
}
@@ -625,86 +525,33 @@ BuildSratTable (
Srat->Reserved1 = 1;
Srat->Reserved2 = EFI_ACPI_RESERVED_QWORD;
- Status = AddGICCAffinity (
- CfgMgrProtocol,
- Srat,
- GicCAffOffset,
- GicCInfo,
- GicCCount
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SRAT: Failed to add GICC Affinity structures. Status = %r\n",
- Status
- ));
- goto error_handler;
- }
+ AddGICCAffinity (Srat, GicCAffOffset);
if (GicItsCount != 0) {
- Status = AddGICItsAffinity (
- CfgMgrProtocol,
- Srat,
- GicItsAffOffset,
- GicItsInfo,
- GicItsCount
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SRAT: Failed to add GIC ITS Affinity structures. Status = %r\n",
- Status
- ));
- goto error_handler;
- }
+ AddGICItsAffinity (Srat, GicItsAffOffset);
}
if (MemAffCount != 0) {
- Status = AddMemoryAffinity (
- CfgMgrProtocol,
- Srat,
- MemAffOffset,
- MemAffInfo,
- MemAffCount
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SRAT: Failed to add Memory Affinity structures. Status = %r\n",
- Status
- ));
- goto error_handler;
- }
+ AddMemoryAffinity (Srat, MemAffOffset);
}
if (GenInitiatorAffCount != 0) {
- Status = AddGenericInitiatorAffinity (
- CfgMgrProtocol,
- Srat,
- GenInitiatorAffOffset,
- GenInitiatorAffInfo,
- GenInitiatorAffCount
- );
+ Status = AddGenericInitiatorAffinity (Srat, GenInitiatorAffOffset);
if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SRAT: Failed to add Generic Initiator Affinity structures."
- " Status = %r\n",
- Status
- ));
+ DEBUG (
+ (DEBUG_ERROR,
+ "ERROR: SRAT: Failed to add Generic Initiator Affinity structures."
+ " Status = %r\n",
+ Status));
goto error_handler;
}
}
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER*)Srat;
return Status;
error_handler:
-
- if (*Table != NULL) {
- FreePool (*Table);
- *Table = NULL;
- }
-
+ FreePool (Srat);
return Status;
}
@@ -728,13 +575,11 @@ FreeSratTableResources (
IN OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table
)
{
- ASSERT (
- (This != NULL) &&
- (AcpiTableInfo != NULL) &&
- (CfgMgrProtocol != NULL) &&
- (AcpiTableInfo->TableGeneratorId == This->GeneratorID) &&
- (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature)
- );
+ ASSERT (This != NULL);
+ ASSERT (AcpiTableInfo != NULL);
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
+ ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
if ((Table == NULL) || (*Table == NULL)) {
DEBUG ((DEBUG_ERROR, "ERROR: SRAT: Invalid Table Pointer\n"));
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-07-31 16:19 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-31 16:19 [PATCH 0/8] ConfigurationManagerProtocol update Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 1/8] DynamicTablesPkg: Include BaseStackCheckLib Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 2/8] DynamicTablesPkg: Fold Namespaces into CmObjectId Enums Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 3/8] DynamicTablesPkg: Add ConfigurationManagerDumpApp Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 4/8] DynamicTablesPkg: Update ConfigurationManagerProtocol Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 5/8] DynamicTablesPkg: Add CfgMgrProtocol helper functions Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 6/8] DynamicTablesPkg/TableHelperLib: User friendly strings Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 7/8] DynamicTablesPkg: Simplify AddAcpiHeader, CfgMgrGetInfo Tomas Pilar (tpilar)
2020-07-31 16:19 ` [PATCH 8/8] DynamicTablesPkg: Remove GET_OBJECT_LIST Tomas Pilar (tpilar)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox