summaryrefslogtreecommitdiff
path: root/DynamicTablesPkg
diff options
context:
space:
mode:
Diffstat (limited to 'DynamicTablesPkg')
-rw-r--r--DynamicTablesPkg/Drivers/DynamicTableManagerDxe/Arm/ArmDynamicTableManager.c63
-rw-r--r--DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c70
-rw-r--r--DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.h63
-rw-r--r--DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf8
-rwxr-xr-xDynamicTablesPkg/Drivers/DynamicTableManagerDxe/X64/X64DynamicTableManager.c56
-rw-r--r--DynamicTablesPkg/DynamicTables.dsc.inc82
-rw-r--r--DynamicTablesPkg/DynamicTablesPkg.ci.yaml1
-rw-r--r--DynamicTablesPkg/Include/AcpiTableGenerator.h21
-rw-r--r--DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h696
-rw-r--r--DynamicTablesPkg/Include/ArmNameSpaceObjects.h686
-rw-r--r--DynamicTablesPkg/Include/ConfigurationManagerObject.h77
-rw-r--r--DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h42
-rw-r--r--DynamicTablesPkg/Include/Library/SsdtPcieSupportLib.h12
-rw-r--r--DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h16
-rw-r--r--DynamicTablesPkg/Include/X64NameSpaceObjects.h180
-rw-r--r--DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600Generator.c16
-rw-r--r--DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h147
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/AcpiDbg2Lib.inf (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/AcpiDbg2LibArm.inf)22
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Arm/ArmDbg2Generator.c67
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Dbg2Generator.c (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c)46
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Dbg2Generator.h56
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Dbg2GeneratorNull.c60
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/AcpiFadtLibArm.inf)16
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/Arm/ArmFadtGenerator.c126
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.c (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c)132
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.h35
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/X64/X64FadtGenerator.c382
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiMcfgLib/AcpiMcfgLib.inf (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/AcpiMcfgLibArm.inf)9
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiMcfgLib/McfgGenerator.c (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c)31
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/AcpiPcctLib.inf (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/AcpiPcctLibArm.inf)2
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/PcctGenerator.c (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/PcctGenerator.c)200
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/PcctGenerator.h (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/PcctGenerator.h)5
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiPpttLib/AcpiPpttLib.inf (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf)2
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiPpttLib/PpttGenerator.c (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c)137
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiPpttLib/PpttGenerator.h (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h)0
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiRawLib/AcpiRawLib.inf (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/AcpiRawLibArm.inf)9
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiRawLib/RawGenerator.c (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c)2
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSpcrLib/AcpiSpcrLib.inf (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf)9
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSpcrLib/SpcrGenerator.c (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c)22
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/AcpiSratLib.inf (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/AcpiSratLibArm.inf)9
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/Arm/ArmSratGenerator.c262
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.c (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c)271
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.h59
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGeneratorNull.c79
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/Arm/ArmSsdtCpuTopologyGenerator.c408
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyGenerator.c (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c)493
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyGenerator.h343
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyLib.inf (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyLibArm.inf)9
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerator.c (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c)127
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerator.h (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h)0
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieLib.inf (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf)2
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtSerialPortLib/SsdtSerialPortGenerator.c (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortGenerator.c)26
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtSerialPortLib/SsdtSerialPortLib.inf (renamed from DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf)6
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/AcpiTpm2Lib.inf29
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/Tpm2Generator.c405
-rw-r--r--DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/AcpiWsmtLib.inf35
-rw-r--r--DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/WsmtGenerator.c288
-rw-r--r--DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c2
-rw-r--r--DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c83
-rw-r--r--DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c2
-rw-r--r--DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c2
-rw-r--r--DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c71
-rw-r--r--DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepo.c269
-rw-r--r--DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoInternal.h11
-rw-r--r--DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenMapper.c9
-rw-r--r--DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.c12
-rw-r--r--DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c46
-rw-r--r--DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c633
-rw-r--r--DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.h19
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtHwInfoParser.c83
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c118
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/BootArch/ArmBootArchParser.c (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/BootArch/ArmBootArchParser.c)2
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/BootArch/ArmBootArchParser.h (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/BootArch/ArmBootArchParser.h)0
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/GenericTimer/ArmGenericTimerParser.c (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/GenericTimer/ArmGenericTimerParser.c)4
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/GenericTimer/ArmGenericTimerParser.h (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/GenericTimer/ArmGenericTimerParser.h)0
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicCParser.c (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c)5
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicCParser.h (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.h)0
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDParser.c (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicDParser.c)4
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDParser.h (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicDParser.h)0
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDispatcher.c (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicDispatcher.c)12
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDispatcher.h (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicDispatcher.h)0
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicItsParser.c (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicItsParser.c)4
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicItsParser.h (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicItsParser.h)0
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicMsiFrameParser.c (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicMsiFrameParser.c)4
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicMsiFrameParser.h (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicMsiFrameParser.h)0
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicRParser.c (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicRParser.c)4
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicRParser.h (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicRParser.h)0
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/CmObjectDescUtility.c10
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/CmObjectDescUtility.h6
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.c78
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.h27
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserInclude.h1
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf48
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c71
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h30
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/ArmPciConfigSpaceParser.c)79
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.h (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/ArmPciConfigSpaceParser.h)36
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/ArmSerialPortParser.c)95
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.h (renamed from DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/ArmSerialPortParser.h)16
-rw-r--r--DynamicTablesPkg/Readme.md114
100 files changed, 5766 insertions, 2701 deletions
diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/Arm/ArmDynamicTableManager.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/Arm/ArmDynamicTableManager.c
new file mode 100644
index 0000000..4874fe8
--- /dev/null
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/Arm/ArmDynamicTableManager.c
@@ -0,0 +1,63 @@
+/** @file
+ ARM Dynamic Table Manager Dxe
+
+ Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Protocol/AcpiSystemDescriptionTable.h>
+#include <Protocol/AcpiTable.h>
+
+// 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 "DynamicTableManagerDxe.h"
+
+///
+/// Array containing the ACPI tables to check.
+/// We require the FADT, MADT, GTDT and the DSDT tables to boot.
+/// This list also include optional ACPI tables: DBG2, SPCR.
+/// The FADT table must be placed at index 0.
+///
+STATIC ACPI_TABLE_PRESENCE_INFO mAcpiVerifyTables[] = {
+ { EStdAcpiTableIdFadt, EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, "FADT", TRUE, 0 },
+ { EStdAcpiTableIdMadt, EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, "MADT", TRUE, 0 },
+ { EStdAcpiTableIdGtdt, EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, "GTDT", TRUE, 0 },
+ { EStdAcpiTableIdDsdt, EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, "DSDT", TRUE, 0 },
+ { EStdAcpiTableIdDbg2, EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, "DBG2", FALSE, 0 },
+ { EStdAcpiTableIdSpcr, EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, "SPCR", FALSE, 0 },
+};
+
+/** Get the arch specific ACPI table presence information.
+
+ @param [out] PresenceArray Array containing the ACPI tables to check.
+ @param [out] PresenceArrayCount Count of elements in the PresenceArray.
+ @param [out] FadtIndex Index of the FADT table in the PresenceArray.
+ -1 if absent.
+
+ @retval EFI_SUCCESS Success.
+**/
+EFI_STATUS
+EFIAPI
+GetAcpiTablePresenceInfo (
+ OUT ACPI_TABLE_PRESENCE_INFO **PresenceArray,
+ OUT UINT32 *PresenceArrayCount,
+ OUT INT32 *FadtIndex
+ )
+{
+ *PresenceArray = mAcpiVerifyTables;
+ *PresenceArrayCount = ARRAY_SIZE (mAcpiVerifyTables);
+ *FadtIndex = ACPI_TABLE_VERIFY_FADT;
+
+ return EFI_SUCCESS;
+}
diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
index 1e9b811..dfccccb 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.c
@@ -23,57 +23,15 @@
#include <Protocol/DynamicTableFactoryProtocol.h>
#include <SmbiosTableGenerator.h>
-///
-/// Bit definitions for acceptable ACPI table presence formats.
-/// Currently only ACPI tables present in the ACPI info list and
-/// already installed will count towards "Table Present" during
-/// verification routine.
-///
-#define ACPI_TABLE_PRESENT_INFO_LIST BIT0
-#define ACPI_TABLE_PRESENT_INSTALLED BIT1
-
-///
-/// Order of ACPI table being verified during presence inspection.
-///
-#define ACPI_TABLE_VERIFY_FADT 0
-#define ACPI_TABLE_VERIFY_MADT 1
-#define ACPI_TABLE_VERIFY_GTDT 2
-#define ACPI_TABLE_VERIFY_DSDT 3
-#define ACPI_TABLE_VERIFY_DBG2 4
-#define ACPI_TABLE_VERIFY_SPCR 5
-#define ACPI_TABLE_VERIFY_COUNT 6
-
-///
-/// Private data structure to verify the presence of mandatory
-/// or optional ACPI tables.
-///
-typedef struct {
- /// ESTD ID for the ACPI table of interest.
- ESTD_ACPI_TABLE_ID EstdTableId;
- /// Standard UINT32 ACPI signature.
- UINT32 AcpiTableSignature;
- /// 4 character ACPI table name (the 5th char8 is for null terminator).
- CHAR8 AcpiTableName[sizeof (UINT32) + 1];
- /// Indicator on whether the ACPI table is required.
- BOOLEAN IsMandatory;
- /// Formats of verified presences, as defined by ACPI_TABLE_PRESENT_*
- /// This field should be initialized to 0 and will be populated during
- /// verification routine.
- UINT16 Presence;
-} ACPI_TABLE_PRESENCE_INFO;
+#include "DynamicTableManagerDxe.h"
///
/// We require the FADT, MADT, GTDT and the DSDT tables to boot.
/// This list also include optional ACPI tables: DBG2, SPCR.
///
-ACPI_TABLE_PRESENCE_INFO mAcpiVerifyTables[ACPI_TABLE_VERIFY_COUNT] = {
- { EStdAcpiTableIdFadt, EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, "FADT", TRUE, 0 },
- { EStdAcpiTableIdMadt, EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, "MADT", TRUE, 0 },
- { EStdAcpiTableIdGtdt, EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, "GTDT", TRUE, 0 },
- { EStdAcpiTableIdDsdt, EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, "DSDT", TRUE, 0 },
- { EStdAcpiTableIdDbg2, EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, "DBG2", FALSE, 0 },
- { EStdAcpiTableIdSpcr, EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, "SPCR", FALSE, 0 },
-};
+STATIC ACPI_TABLE_PRESENCE_INFO *mAcpiVerifyTables;
+STATIC UINT32 mAcpiVerifyTablesCount;
+STATIC INT32 mAcpiVerifyTablesFadtIndex;
/** This macro expands to a function that retrieves the ACPI Table
List from the Configuration Manager.
@@ -472,7 +430,7 @@ VerifyMandatoryTablesArePresent (
// Check against the statically initialized ACPI tables to see if they are in ACPI info list
while (AcpiTableCount-- != 0) {
- for (Index = 0; Index < ACPI_TABLE_VERIFY_COUNT; Index++) {
+ for (Index = 0; Index < mAcpiVerifyTablesCount; Index++) {
if (AcpiTableInfo[AcpiTableCount].AcpiTableSignature == mAcpiVerifyTables[Index].AcpiTableSignature) {
mAcpiVerifyTables[Index].Presence |= ACPI_TABLE_PRESENT_INFO_LIST;
// Found this table, skip the rest.
@@ -491,7 +449,7 @@ VerifyMandatoryTablesArePresent (
return Status;
}
- for (Index = 0; Index < ACPI_TABLE_VERIFY_COUNT; Index++) {
+ for (Index = 0; Index < mAcpiVerifyTablesCount; Index++) {
Handle = 0;
InstalledTableIndex = 0;
do {
@@ -511,7 +469,7 @@ VerifyMandatoryTablesArePresent (
// Reset the return Status value to EFI_SUCCESS. We do not fully care if the table look up has failed.
Status = EFI_SUCCESS;
- for (Index = 0; Index < ACPI_TABLE_VERIFY_COUNT; Index++) {
+ for (Index = 0; Index < mAcpiVerifyTablesCount; Index++) {
if (mAcpiVerifyTables[Index].Presence == 0) {
if (mAcpiVerifyTables[Index].IsMandatory) {
DEBUG ((DEBUG_ERROR, "ERROR: %a Table not found.\n", mAcpiVerifyTables[Index].AcpiTableName));
@@ -623,7 +581,9 @@ ProcessAcpiTables (
}
// Add the FADT Table first.
- if ((mAcpiVerifyTables[ACPI_TABLE_VERIFY_FADT].Presence & ACPI_TABLE_PRESENT_INSTALLED) == 0) {
+ if ((mAcpiVerifyTablesFadtIndex >= 0) &&
+ ((mAcpiVerifyTables[mAcpiVerifyTablesFadtIndex].Presence & ACPI_TABLE_PRESENT_INSTALLED) == 0))
+ {
// FADT is not yet installed
for (Idx = 0; Idx < AcpiTableCount; Idx++) {
if (CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt) ==
@@ -785,6 +745,16 @@ DynamicTableManagerDxeInitialize (
CfgMfrInfo->OemId[5]
));
+ Status = GetAcpiTablePresenceInfo (
+ &mAcpiVerifyTables,
+ &mAcpiVerifyTablesCount,
+ &mAcpiVerifyTablesFadtIndex
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+ }
+
Status = ProcessAcpiTables (TableFactoryProtocol, CfgMgrProtocol);
if (EFI_ERROR (Status)) {
DEBUG ((
diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.h b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.h
new file mode 100644
index 0000000..a12a775
--- /dev/null
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.h
@@ -0,0 +1,63 @@
+/** @file
+ Dynamic Table Manager Dxe
+
+ Copyright (c) 2017 - 2024, ARM Limited. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef DYNAMIC_TABLE_MANAGER_DXE_H_
+#define DYNAMIC_TABLE_MANAGER_DXE_H_
+
+#include <AcpiTableGenerator.h>
+
+///
+/// Bit definitions for acceptable ACPI table presence formats.
+/// Currently only ACPI tables present in the ACPI info list and
+/// already installed will count towards "Table Present" during
+/// verification routine.
+///
+#define ACPI_TABLE_PRESENT_INFO_LIST BIT0
+#define ACPI_TABLE_PRESENT_INSTALLED BIT1
+
+/// The FADT table must be placed at index 0 in mAcpiVerifyTables.
+#define ACPI_TABLE_VERIFY_FADT 0
+
+///
+/// Private data structure to verify the presence of mandatory
+/// or optional ACPI tables.
+///
+typedef struct {
+ /// ESTD ID for the ACPI table of interest.
+ ESTD_ACPI_TABLE_ID EstdTableId;
+ /// Standard UINT32 ACPI signature.
+ UINT32 AcpiTableSignature;
+ /// 4 character ACPI table name (the 5th char8 is for null terminator).
+ CHAR8 AcpiTableName[sizeof (UINT32) + 1];
+ /// Indicator on whether the ACPI table is required.
+ BOOLEAN IsMandatory;
+ /// Formats of verified presences, as defined by ACPI_TABLE_PRESENT_*
+ /// This field should be initialized to 0 and will be populated during
+ /// verification routine.
+ UINT16 Presence;
+} ACPI_TABLE_PRESENCE_INFO;
+
+/** Get the arch specific ACPI table presence information.
+
+ @param [out] PresenceArray Array containing the ACPI tables to check.
+ @param [out] PresenceArrayCount Count of elements in the PresenceArray.
+ @param [out] FadtIndex Index of the FADT table in the PresenceArray.
+ -1 if absent.
+
+ @retval EFI_SUCCESS Success.
+**/
+EFI_STATUS
+EFIAPI
+GetAcpiTablePresenceInfo (
+ OUT ACPI_TABLE_PRESENCE_INFO **PresenceArray,
+ OUT UINT32 *PresenceArrayCount,
+ OUT INT32 *FadtIndex
+ );
+
+#endif // DYNAMIC_TABLE_MANAGER_DXE_H_
diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
index ad8b3d0..c982b24 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
@@ -2,6 +2,7 @@
# Module that drives the table generation and installation process.
#
# Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+# Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
@@ -22,6 +23,13 @@
[Sources]
DynamicTableManagerDxe.c
+ DynamicTableManagerDxe.h
+
+[Sources.ARM, Sources.AARCH64]
+ Arm/ArmDynamicTableManager.c
+
+[Sources.IA32, Sources.X64]
+ X64/X64DynamicTableManager.c
[Packages]
MdePkg/MdePkg.dec
diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/X64/X64DynamicTableManager.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/X64/X64DynamicTableManager.c
new file mode 100755
index 0000000..a5457f3
--- /dev/null
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/X64/X64DynamicTableManager.c
@@ -0,0 +1,56 @@
+/** @file
+ X64 Dynamic Table Manager Dxe
+
+ Copyright (c) 2024, Arm Limited. All rights reserved.
+ Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Protocol/AcpiSystemDescriptionTable.h>
+#include <Protocol/AcpiTable.h>
+
+// 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 "DynamicTableManagerDxe.h"
+
+///
+/// Array containing the ACPI tables to check.
+///
+STATIC ACPI_TABLE_PRESENCE_INFO mAcpiVerifyTables[] = {
+ { EStdAcpiTableIdFadt, EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, "FADT", TRUE, 0 }
+};
+
+/** Get the arch specific ACPI table presence information.
+
+ @param [out] PresenceArray Array containing the ACPI tables to check.
+ @param [out] PresenceArrayCount Count of elements in the PresenceArray.
+ @param [out] FadtIndex Index of the FADT table in the PresenceArray.
+ -1 if absent.
+
+ @retval EFI_SUCCESS Success.
+**/
+EFI_STATUS
+EFIAPI
+GetAcpiTablePresenceInfo (
+ OUT ACPI_TABLE_PRESENCE_INFO **PresenceArray,
+ OUT UINT32 *PresenceArrayCount,
+ OUT INT32 *FadtIndex
+ )
+{
+ *PresenceArray = mAcpiVerifyTables;
+ *PresenceArrayCount = ARRAY_SIZE (mAcpiVerifyTables);
+ *FadtIndex = ACPI_TABLE_VERIFY_FADT;
+
+ return EFI_SUCCESS;
+}
diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc
index 19ca62d..f4866c2 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -3,6 +3,7 @@
#
# Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
+# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -26,63 +27,88 @@
[Components.common]
#
+ # Generators (Common)
+ #
+ DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/AcpiDbg2Lib.inf
+ DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf
+ DynamicTablesPkg/Library/Acpi/Common/AcpiMcfgLib/AcpiMcfgLib.inf
+ DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/AcpiPcctLib.inf
+ DynamicTablesPkg/Library/Acpi/Common/AcpiPpttLib/AcpiPpttLib.inf
+ DynamicTablesPkg/Library/Acpi/Common/AcpiRawLib/AcpiRawLib.inf
+ DynamicTablesPkg/Library/Acpi/Common/AcpiSpcrLib/AcpiSpcrLib.inf
+ DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/AcpiSratLib.inf
+ DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/AcpiTpm2Lib.inf
+
+ # AML Fixup (Common)
+ DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtSerialPortLib/SsdtSerialPortLib.inf
+
+ # AML Codegen (Common)
+ DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyLib.inf
+ DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieLib.inf
+
+ #
# Dynamic Tables Manager Dxe
#
DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
[Components.IA32, Components.X64]
#
+ # Generators (IA32/X64 specific)
+ #
+ DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/AcpiWsmtLib.inf
+
+ #
# Dynamic Table Factory Dxe
#
- DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
+ DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf {
+ <LibraryClasses>
+ # Generators
+ # Common
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/AcpiWsmtLib.inf
+ }
[Components.ARM, Components.AARCH64]
#
- # Generators
+ # Generators (Arm specific)
#
- DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/AcpiDbg2LibArm.inf
- DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/AcpiFadtLibArm.inf
DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/AcpiGtdtLibArm.inf
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf
DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/AcpiMadtLibArm.inf
- DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/AcpiMcfgLibArm.inf
- DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf
- DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/AcpiRawLibArm.inf
- DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf
- DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/AcpiSratLibArm.inf
- DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/AcpiPcctLibArm.inf
-
- # AML Fixup
- DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf
- DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600LibArm.inf
- # AML Codegen
- DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyLibArm.inf
- DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
+ # AML Fixup (Arm specific)
+ DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600LibArm.inf
#
# Dynamic Table Factory Dxe
#
DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf {
<LibraryClasses>
- NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/AcpiDbg2LibArm.inf
- NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/AcpiFadtLibArm.inf
+ # Generators
+ # Common
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/AcpiDbg2Lib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiMcfgLib/AcpiMcfgLib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/AcpiPcctLib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiPpttLib/AcpiPpttLib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiRawLib/AcpiRawLib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiSpcrLib/AcpiSpcrLib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/AcpiSratLib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/AcpiTpm2Lib.inf
+ # Arm specific
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/AcpiGtdtLibArm.inf
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/AcpiMadtLibArm.inf
- NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/AcpiMcfgLibArm.inf
- NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf
- NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/AcpiRawLibArm.inf
- NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf
- NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/AcpiSratLibArm.inf
- NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/AcpiPcctLibArm.inf
# AML Fixup
- NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf
+ # Common
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtSerialPortLib/SsdtSerialPortLib.inf
+ # Arm specific
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600LibArm.inf
# AML Codegen
- NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyLibArm.inf
- NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
+ # Common
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyLib.inf
+ NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieLib.inf
}
diff --git a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
index 42829f3..07768ed 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
+++ b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml
@@ -104,6 +104,7 @@
"CCIDX",
"CCSIDR",
"countof",
+ "EArch",
"edynamic",
"EOBJECT",
"invoc",
diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h b/DynamicTablesPkg/Include/AcpiTableGenerator.h
index d0eda01..d4ad603 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -1,6 +1,8 @@
/** @file
Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.<BR>
+ Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -71,6 +73,8 @@ The Dynamic Tables Framework implements the following ACPI table generators:
The SSDT Pci Express generator collates the Pci Express
information from the Configuration Manager and generates a
SSDT table describing a Pci Express bus.
+ - WSMT : The WSMT generator collates the WSMT protection flag information
+ from the Configuration Manager and builds the WSMT table.
*/
/** The ACPI_TABLE_GENERATOR_ID type describes ACPI table generator ID.
@@ -99,6 +103,8 @@ typedef enum StdAcpiTableId {
EStdAcpiTableIdSsdtCpuTopology, ///< SSDT Cpu Topology
EStdAcpiTableIdSsdtPciExpress, ///< SSDT Pci Express Generator
EStdAcpiTableIdPcct, ///< PCCT Generator
+ EStdAcpiTableIdTpm2, ///< TPM2 Generator
+ EStdAcpiTableIdWsmt, ///< WSMT Generator
EStdAcpiTableIdMax
} ESTD_ACPI_TABLE_ID;
@@ -154,9 +160,14 @@ typedef enum StdAcpiTableId {
TableId \
)
-/** The Creator ID for the ACPI tables generated using
+/** The generic creator ID for the ACPI tables generated using
the standard ACPI table generators.
*/
+#define TABLE_GENERATOR_CREATOR_ID SIGNATURE_32('D', 'Y', 'N', 'T')
+
+/** The Creator ID for the ACPI tables generated using
+ the standard ACPI table generators for ARM.
+*/
#define TABLE_GENERATOR_CREATOR_ID_ARM SIGNATURE_32('A', 'R', 'M', 'H')
/** A macro to initialise the common header part of EFI ACPI tables as
@@ -214,7 +225,7 @@ typedef struct AcpiTableGenerator ACPI_TABLE_GENERATOR;
@return EFI_SUCCESS If the table is generated successfully or other
failure codes as returned by the generator.
**/
-typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLE) (
+typedef EFI_STATUS (EFIAPI *ACPI_TABLE_GENERATOR_BUILD_TABLE)(
IN CONST ACPI_TABLE_GENERATOR *This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
@@ -234,7 +245,7 @@ typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLE) (
@return EFI_SUCCESS If freed successfully or other failure codes
as returned by the generator.
**/
-typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLE) (
+typedef EFI_STATUS (EFIAPI *ACPI_TABLE_GENERATOR_FREE_TABLE)(
IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
@@ -257,7 +268,7 @@ typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLE) (
@return EFI_SUCCESS If the table is generated successfully or other
failure codes as returned by the generator.
**/
-typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLEEX) (
+typedef EFI_STATUS (EFIAPI *ACPI_TABLE_GENERATOR_BUILD_TABLEEX)(
IN CONST ACPI_TABLE_GENERATOR *This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
@@ -280,7 +291,7 @@ typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_BUILD_TABLEEX) (
@return EFI_SUCCESS If freed successfully or other failure codes
as returned by the generator.
**/
-typedef EFI_STATUS (*ACPI_TABLE_GENERATOR_FREE_TABLEEX) (
+typedef EFI_STATUS (EFIAPI *ACPI_TABLE_GENERATOR_FREE_TABLEEX)(
IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
diff --git a/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h b/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h
new file mode 100644
index 0000000..4b83e53
--- /dev/null
+++ b/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h
@@ -0,0 +1,696 @@
+/** @file
+
+ Copyright (c) 2024, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+ - Std or STD - Standard
+**/
+
+#ifndef ARCH_COMMON_NAMESPACE_OBJECTS_H_
+#define ARCH_COMMON_NAMESPACE_OBJECTS_H_
+
+#include <AcpiObjects.h>
+#include <StandardNameSpaceObjects.h>
+
+#include <IndustryStandard/Tpm2Acpi.h>
+
+/** The EARCH_COMMON_OBJECT_ID enum describes the Object IDs
+ in the Arch Common Namespace
+*/
+typedef enum ArchCommonObjectID {
+ EArchCommonObjReserved, ///< 0 - Reserved
+ EArchCommonObjPowerManagementProfileInfo, ///< 1 - Power Management Profile Info
+ EArchCommonObjSerialPortInfo, ///< 2 - Generic Serial Port Info
+ EArchCommonObjConsolePortInfo, ///< 3 - Serial Console Port Info
+ EArchCommonObjSerialDebugPortInfo, ///< 4 - Serial Debug Port Info
+ EArchCommonObjHypervisorVendorIdentity, ///< 5 - Hypervisor Vendor Id
+ EArchCommonObjFixedFeatureFlags, ///< 6 - Fixed feature flags for FADT
+ EArchCommonObjCmRef, ///< 7 - CM Object Reference
+ EArchCommonObjPciConfigSpaceInfo, ///< 8 - PCI Configuration Space Info
+ EArchCommonObjPciAddressMapInfo, ///< 9 - Pci Address Map Info
+ EArchCommonObjPciInterruptMapInfo, ///< 10 - Pci Interrupt Map Info
+ EArchCommonObjMemoryAffinityInfo, ///< 11 - Memory Affinity Info
+ EArchCommonObjDeviceHandleAcpi, ///< 12 - Device Handle Acpi
+ EArchCommonObjDeviceHandlePci, ///< 13 - Device Handle Pci
+ EArchCommonObjGenericInitiatorAffinityInfo, ///< 14 - Generic Initiator Affinity
+ EArchCommonObjLpiInfo, ///< 15 - Lpi Info
+ EArchCommonObjProcHierarchyInfo, ///< 16 - Processor Hierarchy Info
+ EArchCommonObjCacheInfo, ///< 17 - Cache Info
+ EArchCommonObjCpcInfo, ///< 18 - Continuous Performance Control Info
+ EArchCommonObjPccSubspaceType0Info, ///< 19 - Pcc Subspace Type 0 Info
+ EArchCommonObjPccSubspaceType1Info, ///< 20 - Pcc Subspace Type 1 Info
+ EArchCommonObjPccSubspaceType2Info, ///< 21 - Pcc Subspace Type 2 Info
+ EArchCommonObjPccSubspaceType3Info, ///< 22 - Pcc Subspace Type 3 Info
+ EArchCommonObjPccSubspaceType4Info, ///< 23 - Pcc Subspace Type 4 Info
+ EArchCommonObjPccSubspaceType5Info, ///< 24 - Pcc Subspace Type 5 Info
+ EArchCommonObjPsdInfo, ///< 25 - P-State Dependency (PSD) Info
+ EArchCommonObjTpm2InterfaceInfo, ///< 26 - TPM Interface Info
+ EArchCommonObjMax
+} EARCH_COMMON_OBJECT_ID;
+
+#pragma pack(1)
+
+/** A structure that describes the
+ Power Management Profile Information for the Platform.
+
+ ID: EArchCommonObjPowerManagementProfileInfo
+*/
+typedef struct CmArchCommonPowerManagementProfileInfo {
+ /** This is the Preferred_PM_Profile field of the FADT Table
+ described in the ACPI Specification
+ */
+ UINT8 PowerManagementProfile;
+} CM_ARCH_COMMON_POWER_MANAGEMENT_PROFILE_INFO;
+
+/** A structure that describes the
+ Serial Port information for the Platform.
+
+ ID: EArchCommonObjConsolePortInfo or
+ EArchCommonObjSerialDebugPortInfo or
+ EArchCommonObjSerialPortInfo
+*/
+typedef struct EArchCommonSerialPortInfo {
+ /// The physical base address for the serial port
+ UINT64 BaseAddress;
+
+ /** The serial port interrupt.
+ 0 indicates that the serial port does not
+ have an interrupt wired.
+ */
+ UINT32 Interrupt;
+
+ /// The serial port baud rate
+ UINT64 BaudRate;
+
+ /// The serial port clock
+ UINT32 Clock;
+
+ /// Serial Port subtype
+ UINT16 PortSubtype;
+
+ /// The Base address length
+ UINT64 BaseAddressLength;
+
+ /// The access size
+ UINT8 AccessSize;
+} CM_ARCH_COMMON_SERIAL_PORT_INFO;
+
+/** A structure that describes the
+ Hypervisor Vendor ID information for the Platform.
+
+ ID: EArchCommonObjHypervisorVendorIdentity
+*/
+typedef struct CmArchCommonHypervisorVendorIdentity {
+ /// The hypervisor Vendor ID
+ UINT64 HypervisorVendorId;
+} CM_ARCH_COMMON_HYPERVISOR_VENDOR_ID;
+
+/** A structure that describes the
+ Fixed feature flags for the Platform.
+
+ ID: EArchCommonObjFixedFeatureFlags
+*/
+typedef struct CmArchCommonFixedFeatureFlags {
+ /// The Fixed feature flags
+ UINT32 Flags;
+} CM_ARCH_COMMON_FIXED_FEATURE_FLAGS;
+
+/** A structure that describes a reference to another Configuration Manager
+ object.
+
+ This is useful for creating an array of reference tokens. The framework
+ can then query the configuration manager for these arrays using the
+ object ID EArchCommonObjCmRef.
+
+ This can be used is to represent one-to-many relationships between objects.
+
+ ID: EArchCommonObjCmRef
+*/
+typedef struct CmArchCommonObjRef {
+ /// Token of the CM object being referenced
+ CM_OBJECT_TOKEN ReferenceToken;
+} CM_ARCH_COMMON_OBJ_REF;
+
+/** A structure that describes the
+ PCI Configuration Space information for the Platform.
+
+ ID: EArchCommonObjPciConfigSpaceInfo
+*/
+typedef struct CmArchCommonPciConfigSpaceInfo {
+ /// The physical base address for the PCI segment
+ UINT64 BaseAddress;
+
+ /// The PCI segment group number
+ UINT16 PciSegmentGroupNumber;
+
+ /// The start bus number
+ UINT8 StartBusNumber;
+
+ /// The end bus number
+ UINT8 EndBusNumber;
+
+ /// Optional field: Reference Token for address mapping.
+ /// Token identifying a CM_ARCH_COMMON_OBJ_REF structure.
+ CM_OBJECT_TOKEN AddressMapToken;
+
+ /// Optional field: Reference Token for interrupt mapping.
+ /// Token identifying a CM_ARCH_COMMON_OBJ_REF structure.
+ CM_OBJECT_TOKEN InterruptMapToken;
+} CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO;
+
+/** A structure that describes a PCI Address Map.
+
+ The memory-ranges used by the PCI bus are described by this object.
+
+ ID: EArchCommonObjPciAddressMapInfo
+*/
+typedef struct CmArchCommonPciAddressMapInfo {
+ /** Pci address space code
+
+ Available values are:
+ - 0: Configuration Space
+ - 1: I/O Space
+ - 2: 32-bit-address Memory Space
+ - 3: 64-bit-address Memory Space
+ */
+ UINT8 SpaceCode;
+
+ /// PCI address
+ UINT64 PciAddress;
+
+ /// Cpu address
+ UINT64 CpuAddress;
+
+ /// Address size
+ UINT64 AddressSize;
+} CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO;
+
+/** A structure that describes the
+ Generic Interrupts.
+*/
+typedef struct CmArchCommonGenericInterrupt {
+ /// Interrupt number
+ UINT32 Interrupt;
+
+ /// Flags
+ /// BIT0: 0: Interrupt is Level triggered
+ /// 1: Interrupt is Edge triggered
+ /// BIT1: 0: Interrupt is Active high
+ /// 1: Interrupt is Active low
+ UINT32 Flags;
+} CM_ARCH_COMMON_GENERIC_INTERRUPT;
+
+/** A structure that describes a PCI Interrupt Map.
+
+ The legacy PCI interrupts used by PCI devices are described by this object.
+
+ Cf Devicetree Specification - Release v0.3
+ s2.4.3 "Interrupt Nexus Properties"
+
+ ID: EArchCommonObjPciInterruptMapInfo
+*/
+typedef struct CmArchCommonPciInterruptMapInfo {
+ /// Pci Bus.
+ /// Value on 8 bits (max 255).
+ UINT8 PciBus;
+
+ /// Pci Device.
+ /// Value on 5 bits (max 31).
+ UINT8 PciDevice;
+
+ /** PCI interrupt
+
+ ACPI bindings are used:
+ Cf. ACPI 6.4, s6.2.13 _PRT (PCI Routing Table):
+ "0-INTA, 1-INTB, 2-INTC, 3-INTD"
+
+ Device-tree bindings are shifted by 1:
+ "INTA=1, INTB=2, INTC=3, INTD=4"
+ */
+ UINT8 PciInterrupt;
+
+ /** Interrupt controller interrupt.
+
+ Cf Devicetree Specification - Release v0.3
+ s2.4.3 "Interrupt Nexus Properties": "parent interrupt specifier"
+ */
+ CM_ARCH_COMMON_GENERIC_INTERRUPT IntcInterrupt;
+} CM_ARCH_COMMON_PCI_INTERRUPT_MAP_INFO;
+
+/** A structure that describes the Memory Affinity Structure (Type 1) in SRAT
+
+ ID: EArchCommonObjMemoryAffinityInfo
+*/
+typedef struct CmArchCommonMemoryAffinityInfo {
+ /// The proximity domain to which the "range of memory" belongs.
+ UINT32 ProximityDomain;
+
+ /// Base Address
+ UINT64 BaseAddress;
+
+ /// Length
+ UINT64 Length;
+
+ /// Flags
+ UINT32 Flags;
+} CM_ARCH_COMMON_MEMORY_AFFINITY_INFO;
+
+/** A structure that describes the ACPI Device Handle (Type 0) in the
+ Generic Initiator Affinity structure in SRAT
+
+ ID: EArchCommonObjDeviceHandleAcpi
+*/
+typedef struct CmArchCommonDeviceHandleAcpi {
+ /// Hardware ID
+ UINT64 Hid;
+
+ /// Unique Id
+ UINT32 Uid;
+} CM_ARCH_COMMON_DEVICE_HANDLE_ACPI;
+
+/** A structure that describes the PCI Device Handle (Type 1) in the
+ Generic Initiator Affinity structure in SRAT
+
+ ID: EArchCommonObjDeviceHandlePci
+*/
+typedef struct CmArchCommonDeviceHandlePci {
+ /// PCI Segment Number
+ UINT16 SegmentNumber;
+
+ /// PCI Bus Number - Max 256 busses (Bits 15:8 of BDF)
+ UINT8 BusNumber;
+
+ /// PCI Device Number - Max 32 devices (Bits 7:3 of BDF)
+ UINT8 DeviceNumber;
+
+ /// PCI Function Number - Max 8 functions (Bits 2:0 of BDF)
+ UINT8 FunctionNumber;
+} CM_ARCH_COMMON_DEVICE_HANDLE_PCI;
+
+/** A structure that describes the Generic Initiator Affinity structure in SRAT
+
+ ID: EArchCommonObjGenericInitiatorAffinityInfo
+*/
+typedef struct CmArchCommonGenericInitiatorAffinityInfo {
+ /// The proximity domain to which the generic initiator belongs.
+ UINT32 ProximityDomain;
+
+ /// Flags
+ UINT32 Flags;
+
+ /// Device Handle Type
+ UINT8 DeviceHandleType;
+
+ /// Reference Token for the Device Handle
+ CM_OBJECT_TOKEN DeviceHandleToken;
+} CM_ARCH_COMMON_GENERIC_INITIATOR_AFFINITY_INFO;
+
+/** A structure that describes the Lpi information.
+
+ The Low Power Idle states are described in DSDT/SSDT and associated
+ to cpus/clusters in the cpu topology.
+
+ ID: EArchCommonObjLpiInfo
+*/
+typedef struct CmArchCommonLpiInfo {
+ /** Minimum Residency. Time in microseconds after which a
+ state becomes more energy efficient than any shallower state.
+ */
+ UINT32 MinResidency;
+
+ /** Worst case time in microseconds from a wake interrupt
+ being asserted to the return to a running state
+ */
+ UINT32 WorstCaseWakeLatency;
+
+ /** Flags.
+ */
+ UINT32 Flags;
+
+ /** Architecture specific context loss flags.
+ */
+ UINT32 ArchFlags;
+
+ /** Residency counter frequency in cycles-per-second (Hz).
+ */
+ UINT32 ResCntFreq;
+
+ /** Every shallower power state in the parent is also enabled.
+ */
+ UINT32 EnableParentState;
+
+ /** The EntryMethod _LPI field can be described as an integer
+ or in a Register resource data descriptor.
+
+ If IsInteger is TRUE, the IntegerEntryMethod field is used.
+ If IsInteger is FALSE, the RegisterEntryMethod field is used.
+ */
+ BOOLEAN IsInteger;
+
+ /** EntryMethod described as an Integer.
+ */
+ UINT64 IntegerEntryMethod;
+
+ /** EntryMethod described as a EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR.
+ */
+ EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE RegisterEntryMethod;
+
+ /** Residency counter register.
+ */
+ EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE ResidencyCounterRegister;
+
+ /** Usage counter register.
+ */
+ EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE UsageCounterRegister;
+
+ /** String representing the Lpi state
+ */
+ CHAR8 StateName[16];
+} CM_ARCH_COMMON_LPI_INFO;
+
+/** A structure that describes the Processor Hierarchy Node (Type 0) in PPTT
+
+ ID: EArchCommonObjProcHierarchyInfo
+*/
+typedef struct CmArchCommonProcHierarchyInfo {
+ /// A unique token used to identify this object
+ CM_OBJECT_TOKEN Token;
+ /// Processor structure flags (ACPI 6.3 - January 2019, PPTT, Table 5-155)
+ UINT32 Flags;
+ /// Token for the parent CM_ARCH_COMMON_PROC_HIERARCHY_INFO object in the processor
+ /// topology. A value of CM_NULL_TOKEN means this node has no parent.
+ CM_OBJECT_TOKEN ParentToken;
+ /// Token of the associated object which has the corresponding ACPI Processor
+ /// ID, e.g. for Arm systems this is a reference to CM_ARM_GICC_INFO object.
+ /// A value of CM_NULL_TOKEN means this node represents a group of associated
+ /// processors and it does not have an associated CPU interface.
+ CM_OBJECT_TOKEN AcpiIdObjectToken;
+ /// Number of resources private to this Node
+ UINT32 NoOfPrivateResources;
+ /// Token of the array which contains references to the resources private to
+ /// this CM_ARCH_COMMON_PROC_HIERARCHY_INFO instance. This field is ignored if
+ /// the NoOfPrivateResources is 0, in which case it is recommended to set
+ /// this field to CM_NULL_TOKEN.
+ CM_OBJECT_TOKEN PrivateResourcesArrayToken;
+ /// Optional field: Reference Token for the Lpi state of this processor.
+ /// Token identifying a CM_ARCH_COMMON_OBJ_REF structure, itself referencing
+ /// CM_ARCH_COMMON_LPI_INFO objects.
+ CM_OBJECT_TOKEN LpiToken;
+ /// Set to TRUE if UID should override index for name and _UID
+ /// for processor container nodes and name of processors.
+ /// This should be consistently set for containers or processors to avoid
+ /// duplicate values
+ BOOLEAN OverrideNameUidEnabled;
+ /// If OverrideNameUidEnabled is TRUE then this value will be used for name of
+ /// processors and processor containers.
+ UINT16 OverrideName;
+ /// If OverrideNameUidEnabled is TRUE then this value will be used for
+ /// the UID of processor containers.
+ UINT32 OverrideUid;
+} CM_ARCH_COMMON_PROC_HIERARCHY_INFO;
+
+/** A structure that describes the Cache Type Structure (Type 1) in PPTT
+
+ ID: EArchCommonObjCacheInfo
+*/
+typedef struct CmArchCommonCacheInfo {
+ /// A unique token used to identify this object
+ CM_OBJECT_TOKEN Token;
+ /// Reference token for the next level of cache that is private to the same
+ /// CM_ARCH_COMMON_PROC_HIERARCHY_INFO instance. A value of CM_NULL_TOKEN
+ /// means this entry represents the last cache level appropriate to the
+ /// processor hierarchy node structures using this entry.
+ CM_OBJECT_TOKEN NextLevelOfCacheToken;
+ /// Size of the cache in bytes
+ UINT32 Size;
+ /// Number of sets in the cache
+ UINT32 NumberOfSets;
+ /// Integer number of ways. The maximum associativity supported by
+ /// ACPI Cache type structure is limited to MAX_UINT8. However,
+ /// the maximum number of ways supported by the architecture is
+ /// PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX. Therfore this field
+ /// is 32-bit wide.
+ UINT32 Associativity;
+ /// Cache attributes (ACPI 6.4 - January 2021, PPTT, Table 5.140)
+ UINT8 Attributes;
+ /// Line size in bytes
+ UINT16 LineSize;
+ /// Unique ID for the cache
+ UINT32 CacheId;
+} CM_ARCH_COMMON_CACHE_INFO;
+
+/** A structure that describes the Cpc information.
+
+ Continuous Performance Control is described in DSDT/SSDT and associated
+ to cpus/clusters in the cpu topology.
+
+ Unsupported Optional registers should be encoded with NULL resource
+ Register {(SystemMemory, 0, 0, 0, 0)}
+
+ For values that support Integer or Buffer, integer will be used
+ if buffer is NULL resource.
+ If resource is not NULL then Integer must be 0
+
+ Cf. ACPI 6.4, s8.4.7.1 _CPC (Continuous Performance Control)
+
+ ID: EArchCommonObjCpcInfo
+*/
+typedef AML_CPC_INFO CM_ARCH_COMMON_CPC_INFO;
+
+/** A structure that describes a
+ PCC Mailbox Register.
+*/
+typedef struct PccMailboxRegisterInfo {
+ /// GAS describing the Register.
+ EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE Register;
+
+ /** Mask of bits to preserve when writing.
+
+ This mask is also used for registers. The Register is only read
+ and there is no write mask required. E.g.:
+ - Error Status mask (Cf. PCC Subspace types 3/4/5).
+ - Command Complete Check mask (Cf. PCC Subspace types 3/4/5).
+ */
+ UINT64 PreserveMask;
+
+ /// Mask of bits to set when writing.
+ UINT64 WriteMask;
+} PCC_MAILBOX_REGISTER_INFO;
+
+/** A structure that describes the
+ PCC Subspace CHannel Timings.
+*/
+typedef struct PccSubspaceChannelTimingInfo {
+ /// Expected latency to process a command, in microseconds.
+ UINT32 NominalLatency;
+
+ /** Maximum number of periodic requests that the subspace channel can
+ support, reported in commands per minute. 0 indicates no limitation.
+
+ This field is ignored for the PCC Subspace type 5 (HW Registers based).
+ */
+ UINT32 MaxPeriodicAccessRate;
+
+ /** Minimum amount of time that OSPM must wait after the completion
+ of a command before issuing the next command, in microseconds.
+ */
+ UINT16 MinRequestTurnaroundTime;
+} PCC_SUBSPACE_CHANNEL_TIMING_INFO;
+
+/** A structure that describes a
+ Generic PCC Subspace (Type 0).
+*/
+typedef struct PccSubspaceGenericInfo {
+ /** Subspace Id.
+
+ Cf. ACPI 6.4, s14.7 Referencing the PCC address space
+ Cf. s14.1.2 Platform Communications Channel Subspace Structures
+ The subspace ID of a PCC subspace is its index in the array of
+ subspace structures, starting with subspace 0.
+
+ At most 256 subspaces are supported.
+ */
+ UINT8 SubspaceId;
+
+ /// Table type (or subspace).
+ UINT8 Type;
+
+ /// Base address of the shared memory range.
+ /// This field is ignored for the PCC Subspace type 5 (HW Registers based).
+ UINT64 BaseAddress;
+
+ /// Address length.
+ UINT64 AddressLength;
+
+ /// Doorbell Register.
+ PCC_MAILBOX_REGISTER_INFO DoorbellReg;
+
+ /// Mailbox Timings.
+ PCC_SUBSPACE_CHANNEL_TIMING_INFO ChannelTiming;
+} PCC_SUBSPACE_GENERIC_INFO;
+
+/** A structure that describes a
+ PCC Subspace of type 0 (Generic).
+
+ ID: EArchCommonObjPccSubspaceType0Info
+*/
+typedef PCC_SUBSPACE_GENERIC_INFO CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO;
+
+/** A structure that describes a
+ PCC Subspace of type 1 (HW-Reduced).
+
+ ID: EArchCommonObjPccSubspaceType1Info
+*/
+typedef struct CmArchCommonPccSubspaceType1Info {
+ /** Generic Pcc information.
+
+ The Subspace of Type0 contains information that can be re-used
+ in other Subspace types.
+ */
+ PCC_SUBSPACE_GENERIC_INFO GenericPccInfo;
+
+ /// Platform Interrupt.
+ CM_ARCH_COMMON_GENERIC_INTERRUPT PlatIrq;
+} CM_ARCH_COMMON_PCC_SUBSPACE_TYPE1_INFO;
+
+/** A structure that describes a
+ PCC Subspace of type 2 (HW-Reduced).
+
+ ID: EArchCommonObjPccSubspaceType2Info
+*/
+typedef struct CmArchCommonPccSubspaceType2Info {
+ /** Generic Pcc information.
+
+ The Subspace of Type0 contains information that can be re-used
+ in other Subspace types.
+ */
+ PCC_SUBSPACE_GENERIC_INFO GenericPccInfo;
+
+ /// Platform Interrupt.
+ CM_ARCH_COMMON_GENERIC_INTERRUPT PlatIrq;
+
+ /// Platform Interrupt Register.
+ PCC_MAILBOX_REGISTER_INFO PlatIrqAckReg;
+} CM_ARCH_COMMON_PCC_SUBSPACE_TYPE2_INFO;
+
+/** A structure that describes a
+ PCC Subspace of type 3 (Extended)
+
+ ID: EArchCommonObjPccSubspaceType3Info
+*/
+typedef struct CmArchCommonPccSubspaceType3Info {
+ /** Generic Pcc information.
+
+ The Subspace of Type0 contains information that can be re-used
+ in other Subspace types.
+ */
+ PCC_SUBSPACE_GENERIC_INFO GenericPccInfo;
+
+ /// Platform Interrupt.
+ CM_ARCH_COMMON_GENERIC_INTERRUPT PlatIrq;
+
+ /// Platform Interrupt Register.
+ PCC_MAILBOX_REGISTER_INFO PlatIrqAckReg;
+
+ /// Command Complete Check Register.
+ /// The WriteMask field is not used.
+ PCC_MAILBOX_REGISTER_INFO CmdCompleteCheckReg;
+
+ /// Command Complete Update Register.
+ PCC_MAILBOX_REGISTER_INFO CmdCompleteUpdateReg;
+
+ /// Error Status Register.
+ /// The WriteMask field is not used.
+ PCC_MAILBOX_REGISTER_INFO ErrorStatusReg;
+} CM_ARCH_COMMON_PCC_SUBSPACE_TYPE3_INFO;
+
+/** A structure that describes a
+ PCC Subspace of type 4 (Extended)
+
+ ID: EArchCommonObjPccSubspaceType4Info
+*/
+typedef CM_ARCH_COMMON_PCC_SUBSPACE_TYPE3_INFO CM_ARCH_COMMON_PCC_SUBSPACE_TYPE4_INFO;
+
+/** A structure that describes a
+ PCC Subspace of type 5 (HW-Registers).
+
+ ID: EArchCommonObjPccSubspaceType5Info
+*/
+typedef struct CmArchCommonPccSubspaceType5Info {
+ /** Generic Pcc information.
+
+ The Subspace of Type0 contains information that can be re-used
+ in other Subspace types.
+
+ MaximumPeriodicAccessRate doesn't need to be populated for
+ this structure.
+ */
+ PCC_SUBSPACE_GENERIC_INFO GenericPccInfo;
+
+ /// Version.
+ UINT16 Version;
+
+ /// Platform Interrupt.
+ CM_ARCH_COMMON_GENERIC_INTERRUPT PlatIrq;
+
+ /// Command Complete Check Register.
+ /// The WriteMask field is not used.
+ PCC_MAILBOX_REGISTER_INFO CmdCompleteCheckReg;
+
+ /// Error Status Register.
+ /// The WriteMask field is not used.
+ PCC_MAILBOX_REGISTER_INFO ErrorStatusReg;
+} CM_ARCH_COMMON_PCC_SUBSPACE_TYPE5_INFO;
+
+/** A structure that describes a
+ P-State Dependency (PSD) Info.
+
+ Cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency).
+
+ ID: EArchCommonObjPsdInfo
+*/
+typedef AML_PSD_INFO CM_ARCH_COMMON_PSD_INFO;
+
+/** A structure that describes TPM interface and access method.
+
+ TCG ACPI Specification 2.0
+
+ ID: EArchCommonObjTpm2InterfaceInfo
+*/
+typedef struct CmArchCommonTpm2InterfaceInfo {
+ /** Platform Class
+ 0: Client platform
+ 1: Server platform
+ */
+ UINT16 PlatformClass;
+
+ /** Physical address of the Control Area */
+ UINT64 AddressOfControlArea;
+
+ /** The Start Method selector determines which mechanism the
+ device driver uses to notify the TPM 2.0 device that a
+ command is available for processing.
+ */
+ UINT32 StartMethod;
+
+ /** The number of bytes stored in StartMethodParameters[] */
+ UINT8 StartMethodParametersSize;
+
+ /** Start method specific parameters */
+ UINT8 StartMethodParameters[EFI_TPM2_ACPI_TABLE_START_METHOD_SPECIFIC_PARAMETERS_MAX_SIZE];
+
+ /** Log Area Minimum Length */
+ UINT32 Laml;
+
+ /** Log Area Start Address */
+ UINT64 Lasa;
+} CM_ARCH_COMMON_TPM2_INTERFACE_INFO;
+
+#pragma pack()
+
+#endif // ARCH_COMMON_NAMESPACE_OBJECTS_H_
diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index 4a419a8..958c3dc 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -20,59 +20,38 @@
/** The EARM_OBJECT_ID enum describes the Object IDs
in the ARM Namespace
+
+ Note: Whenever an entry in this enum is updated,
+ the following data structures must also be
+ updated:
+ - CM_OBJECT_TOKEN_FIXER TokenFixer[] in
+ Library\Common\DynamicPlatRepoLib\CmObjectTokenFixer.c
*/
typedef enum ArmObjectID {
EArmObjReserved, ///< 0 - Reserved
EArmObjBootArchInfo, ///< 1 - Boot Architecture Info
- EArmObjCpuInfo, ///< 2 - CPU Info
- EArmObjPowerManagementProfileInfo, ///< 3 - Power Management Profile Info
- EArmObjGicCInfo, ///< 4 - GIC CPU Interface Info
- EArmObjGicDInfo, ///< 5 - GIC Distributor Info
- EArmObjGicMsiFrameInfo, ///< 6 - GIC MSI Frame Info
- EArmObjGicRedistributorInfo, ///< 7 - GIC Redistributor Info
- EArmObjGicItsInfo, ///< 8 - GIC ITS Info
- EArmObjSerialConsolePortInfo, ///< 9 - Serial Console Port Info
- EArmObjSerialDebugPortInfo, ///< 10 - Serial Debug Port Info
- EArmObjGenericTimerInfo, ///< 11 - Generic Timer Info
- EArmObjPlatformGTBlockInfo, ///< 12 - Platform GT Block Info
- EArmObjGTBlockTimerFrameInfo, ///< 13 - Generic Timer Block Frame Info
- EArmObjPlatformGenericWatchdogInfo, ///< 14 - Platform Generic Watchdog
- EArmObjPciConfigSpaceInfo, ///< 15 - PCI Configuration Space Info
- EArmObjHypervisorVendorIdentity, ///< 16 - Hypervisor Vendor Id
- EArmObjFixedFeatureFlags, ///< 17 - Fixed feature flags for FADT
- EArmObjItsGroup, ///< 18 - ITS Group
- EArmObjNamedComponent, ///< 19 - Named Component
- EArmObjRootComplex, ///< 20 - Root Complex
- EArmObjSmmuV1SmmuV2, ///< 21 - SMMUv1 or SMMUv2
- EArmObjSmmuV3, ///< 22 - SMMUv3
- EArmObjPmcg, ///< 23 - PMCG
- EArmObjGicItsIdentifierArray, ///< 24 - GIC ITS Identifier Array
- EArmObjIdMappingArray, ///< 25 - ID Mapping Array
- EArmObjSmmuInterruptArray, ///< 26 - SMMU Interrupt Array
- EArmObjProcHierarchyInfo, ///< 27 - Processor Hierarchy Info
- EArmObjCacheInfo, ///< 28 - Cache Info
- EArmObjReserved29, ///< 29 - Reserved
- EArmObjCmRef, ///< 30 - CM Object Reference
- EArmObjMemoryAffinityInfo, ///< 31 - Memory Affinity Info
- EArmObjDeviceHandleAcpi, ///< 32 - Device Handle Acpi
- EArmObjDeviceHandlePci, ///< 33 - Device Handle Pci
- EArmObjGenericInitiatorAffinityInfo, ///< 34 - Generic Initiator Affinity
- EArmObjSerialPortInfo, ///< 35 - Generic Serial Port Info
- EArmObjCmn600Info, ///< 36 - CMN-600 Info
- EArmObjLpiInfo, ///< 37 - Lpi Info
- EArmObjPciAddressMapInfo, ///< 38 - Pci Address Map Info
- EArmObjPciInterruptMapInfo, ///< 39 - Pci Interrupt Map Info
- EArmObjRmr, ///< 40 - Reserved Memory Range Node
- EArmObjMemoryRangeDescriptor, ///< 41 - Memory Range Descriptor
- EArmObjCpcInfo, ///< 42 - Continuous Performance Control Info
- EArmObjPccSubspaceType0Info, ///< 43 - Pcc Subspace Type 0 Info
- EArmObjPccSubspaceType1Info, ///< 44 - Pcc Subspace Type 2 Info
- EArmObjPccSubspaceType2Info, ///< 45 - Pcc Subspace Type 2 Info
- EArmObjPccSubspaceType3Info, ///< 46 - Pcc Subspace Type 3 Info
- EArmObjPccSubspaceType4Info, ///< 47 - Pcc Subspace Type 4 Info
- EArmObjPccSubspaceType5Info, ///< 48 - Pcc Subspace Type 5 Info
- EArmObjEtInfo, ///< 49 - Embedded Trace Extension/Module Info
- EArmObjPsdInfo, ///< 50 - P-State Dependency (PSD) Info
+ EArmObjGicCInfo, ///< 2 - GIC CPU Interface Info
+ EArmObjGicDInfo, ///< 3 - GIC Distributor Info
+ EArmObjGicMsiFrameInfo, ///< 4 - GIC MSI Frame Info
+ EArmObjGicRedistributorInfo, ///< 5 - GIC Redistributor Info
+ EArmObjGicItsInfo, ///< 6 - GIC ITS Info
+ EArmObjGenericTimerInfo, ///< 7 - Generic Timer Info
+ EArmObjPlatformGTBlockInfo, ///< 8 - Platform GT Block Info
+ EArmObjGTBlockTimerFrameInfo, ///< 9 - Generic Timer Block Frame Info
+ EArmObjPlatformGenericWatchdogInfo, ///< 10 - Platform Generic Watchdog
+ EArmObjItsGroup, ///< 11 - ITS Group
+ EArmObjNamedComponent, ///< 12 - Named Component
+ EArmObjRootComplex, ///< 13 - Root Complex
+ EArmObjSmmuV1SmmuV2, ///< 14 - SMMUv1 or SMMUv2
+ EArmObjSmmuV3, ///< 15 - SMMUv3
+ EArmObjPmcg, ///< 16 - PMCG
+ EArmObjGicItsIdentifierArray, ///< 17 - GIC ITS Identifier Array
+ EArmObjIdMappingArray, ///< 18 - ID Mapping Array
+ EArmObjSmmuInterruptArray, ///< 19 - SMMU Interrupt Array
+ EArmObjCmn600Info, ///< 20 - CMN-600 Info
+ EArmObjRmr, ///< 21 - Reserved Memory Range Node
+ EArmObjMemoryRangeDescriptor, ///< 22 - Memory Range Descriptor
+ EArmObjEtInfo, ///< 23 - Embedded Trace Extension/Module Info
EArmObjMax
} EARM_OBJECT_ID;
@@ -89,18 +68,6 @@ typedef struct CmArmBootArchInfo {
} CM_ARM_BOOT_ARCH_INFO;
/** A structure that describes the
- Power Management Profile Information for the Platform.
-
- ID: EArmObjPowerManagementProfileInfo
-*/
-typedef struct CmArmPowerManagementProfileInfo {
- /** This is the Preferred_PM_Profile field of the FADT Table
- described in the ACPI Specification
- */
- UINT8 PowerManagementProfile;
-} CM_ARM_POWER_MANAGEMENT_PROFILE_INFO;
-
-/** A structure that describes the
GIC CPU Interface for the Platform.
ID: EArmObjGicCInfo
@@ -202,7 +169,7 @@ typedef struct CmArmGicCInfo {
UINT32 AffinityFlags;
/** Optional field: Reference Token for the Cpc info of this processor.
- i.e. a token referencing a CM_ARM_CPC_INFO object.
+ i.e. a token referencing a CM_ARCH_COMMON_CPC_INFO object.
*/
CM_OBJECT_TOKEN CpcToken;
@@ -220,7 +187,7 @@ typedef struct CmArmGicCInfo {
CM_OBJECT_TOKEN EtToken;
/** Optional field: Reference Token for the Psd info of this processor.
- i.e. a token referencing a CM_ARM_PSD_INFO object.
+ i.e. a token referencing a CM_ARCH_COMMON_PSD_INFO object.
*/
CM_OBJECT_TOKEN PsdToken;
} CM_ARM_GICC_INFO;
@@ -307,39 +274,6 @@ typedef struct CmArmGicItsInfo {
} CM_ARM_GIC_ITS_INFO;
/** A structure that describes the
- Serial Port information for the Platform.
-
- ID: EArmObjSerialConsolePortInfo or
- EArmObjSerialDebugPortInfo or
- EArmObjSerialPortInfo
-*/
-typedef struct CmArmSerialPortInfo {
- /// The physical base address for the serial port
- UINT64 BaseAddress;
-
- /** The serial port interrupt.
- 0 indicates that the serial port does not
- have an interrupt wired.
- */
- UINT32 Interrupt;
-
- /// The serial port baud rate
- UINT64 BaudRate;
-
- /// The serial port clock
- UINT32 Clock;
-
- /// Serial Port subtype
- UINT16 PortSubtype;
-
- /// The Base address length
- UINT64 BaseAddressLength;
-
- /// The access size
- UINT8 AccessSize;
-} CM_ARM_SERIAL_PORT_INFO;
-
-/** A structure that describes the
Generic Timer information for the Platform.
ID: EArmObjGenericTimerInfo
@@ -457,53 +391,6 @@ typedef struct CmArmGenericWatchdogInfo {
} CM_ARM_GENERIC_WATCHDOG_INFO;
/** A structure that describes the
- PCI Configuration Space information for the Platform.
-
- ID: EArmObjPciConfigSpaceInfo
-*/
-typedef struct CmArmPciConfigSpaceInfo {
- /// The physical base address for the PCI segment
- UINT64 BaseAddress;
-
- /// The PCI segment group number
- UINT16 PciSegmentGroupNumber;
-
- /// The start bus number
- UINT8 StartBusNumber;
-
- /// The end bus number
- UINT8 EndBusNumber;
-
- /// Optional field: Reference Token for address mapping.
- /// Token identifying a CM_ARM_OBJ_REF structure.
- CM_OBJECT_TOKEN AddressMapToken;
-
- /// Optional field: Reference Token for interrupt mapping.
- /// Token identifying a CM_ARM_OBJ_REF structure.
- CM_OBJECT_TOKEN InterruptMapToken;
-} CM_ARM_PCI_CONFIG_SPACE_INFO;
-
-/** A structure that describes the
- Hypervisor Vendor ID information for the Platform.
-
- ID: EArmObjHypervisorVendorIdentity
-*/
-typedef struct CmArmHypervisorVendorId {
- /// The hypervisor Vendor ID
- UINT64 HypervisorVendorId;
-} CM_ARM_HYPERVISOR_VENDOR_ID;
-
-/** A structure that describes the
- Fixed feature flags for the Platform.
-
- ID: EArmObjFixedFeatureFlags
-*/
-typedef struct CmArmFixedFeatureFlags {
- /// The Fixed feature flags
- UINT32 Flags;
-} CM_ARM_FIXED_FEATURE_FLAGS;
-
-/** A structure that describes the
ITS Group node for the Platform.
ID: EArmObjItsGroup
@@ -729,21 +616,6 @@ typedef struct CmArmIdMapping {
UINT32 Flags;
} CM_ARM_ID_MAPPING;
-/** A structure that describes the Arm
- Generic Interrupts.
-*/
-typedef struct CmArmGenericInterrupt {
- /// Interrupt number
- UINT32 Interrupt;
-
- /// Flags
- /// BIT0: 0: Interrupt is Level triggered
- /// 1: Interrupt is Edge triggered
- /// BIT1: 0: Interrupt is Active high
- /// 1: Interrupt is Active low
- UINT32 Flags;
-} CM_ARM_GENERIC_INTERRUPT;
-
/** A structure that describes the SMMU interrupts for the Platform.
Interrupt Interrupt number.
@@ -751,7 +623,7 @@ typedef struct CmArmGenericInterrupt {
ID: EArmObjSmmuInterruptArray
*/
-typedef CM_ARM_GENERIC_INTERRUPT CM_ARM_SMMU_INTERRUPT;
+typedef CM_ARCH_COMMON_GENERIC_INTERRUPT CM_ARM_SMMU_INTERRUPT;
/** A structure that describes the AML Extended Interrupts.
@@ -761,162 +633,7 @@ typedef CM_ARM_GENERIC_INTERRUPT CM_ARM_SMMU_INTERRUPT;
resource descriptor.
See EFI_ACPI_EXTENDED_INTERRUPT_FLAG_xxx in Acpi10.h
*/
-typedef CM_ARM_GENERIC_INTERRUPT CM_ARM_EXTENDED_INTERRUPT;
-
-/** A structure that describes the Processor Hierarchy Node (Type 0) in PPTT
-
- ID: EArmObjProcHierarchyInfo
-*/
-typedef struct CmArmProcHierarchyInfo {
- /// A unique token used to identify this object
- CM_OBJECT_TOKEN Token;
- /// Processor structure flags (ACPI 6.3 - January 2019, PPTT, Table 5-155)
- UINT32 Flags;
- /// Token for the parent CM_ARM_PROC_HIERARCHY_INFO object in the processor
- /// topology. A value of CM_NULL_TOKEN means this node has no parent.
- CM_OBJECT_TOKEN ParentToken;
- /// Token of the associated CM_ARM_GICC_INFO object which has the
- /// corresponding ACPI Processor ID. A value of CM_NULL_TOKEN means this
- /// node represents a group of associated processors and it does not have an
- /// associated GIC CPU interface.
- CM_OBJECT_TOKEN GicCToken;
- /// Number of resources private to this Node
- UINT32 NoOfPrivateResources;
- /// Token of the array which contains references to the resources private to
- /// this CM_ARM_PROC_HIERARCHY_INFO instance. This field is ignored if
- /// the NoOfPrivateResources is 0, in which case it is recommended to set
- /// this field to CM_NULL_TOKEN.
- CM_OBJECT_TOKEN PrivateResourcesArrayToken;
- /// Optional field: Reference Token for the Lpi state of this processor.
- /// Token identifying a CM_ARM_OBJ_REF structure, itself referencing
- /// CM_ARM_LPI_INFO objects.
- CM_OBJECT_TOKEN LpiToken;
- /// Set to TRUE if UID should override index for name and _UID
- /// for processor container nodes and name of processors.
- /// This should be consistently set for containers or processors to avoid
- /// duplicate values
- BOOLEAN OverrideNameUidEnabled;
- /// If OverrideNameUidEnabled is TRUE then this value will be used for name of
- /// processors and processor containers.
- UINT16 OverrideName;
- /// If OverrideNameUidEnabled is TRUE then this value will be used for
- /// the UID of processor containers.
- UINT32 OverrideUid;
-} CM_ARM_PROC_HIERARCHY_INFO;
-
-/** A structure that describes the Cache Type Structure (Type 1) in PPTT
-
- ID: EArmObjCacheInfo
-*/
-typedef struct CmArmCacheInfo {
- /// A unique token used to identify this object
- CM_OBJECT_TOKEN Token;
- /// Reference token for the next level of cache that is private to the same
- /// CM_ARM_PROC_HIERARCHY_INFO instance. A value of CM_NULL_TOKEN means this
- /// entry represents the last cache level appropriate to the processor
- /// hierarchy node structures using this entry.
- CM_OBJECT_TOKEN NextLevelOfCacheToken;
- /// Size of the cache in bytes
- UINT32 Size;
- /// Number of sets in the cache
- UINT32 NumberOfSets;
- /// Integer number of ways. The maximum associativity supported by
- /// ACPI Cache type structure is limited to MAX_UINT8. However,
- /// the maximum number of ways supported by the architecture is
- /// PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX. Therfore this field
- /// is 32-bit wide.
- UINT32 Associativity;
- /// Cache attributes (ACPI 6.4 - January 2021, PPTT, Table 5.140)
- UINT8 Attributes;
- /// Line size in bytes
- UINT16 LineSize;
- /// Unique ID for the cache
- UINT32 CacheId;
-} CM_ARM_CACHE_INFO;
-
-/** A structure that describes a reference to another Configuration Manager
- object.
-
- This is useful for creating an array of reference tokens. The framework
- can then query the configuration manager for these arrays using the
- object ID EArmObjCmRef.
-
- This can be used is to represent one-to-many relationships between objects.
-
- ID: EArmObjCmRef
-*/
-typedef struct CmArmObjRef {
- /// Token of the CM object being referenced
- CM_OBJECT_TOKEN ReferenceToken;
-} CM_ARM_OBJ_REF;
-
-/** A structure that describes the Memory Affinity Structure (Type 1) in SRAT
-
- ID: EArmObjMemoryAffinityInfo
-*/
-typedef struct CmArmMemoryAffinityInfo {
- /// The proximity domain to which the "range of memory" belongs.
- UINT32 ProximityDomain;
-
- /// Base Address
- UINT64 BaseAddress;
-
- /// Length
- UINT64 Length;
-
- /// Flags
- UINT32 Flags;
-} CM_ARM_MEMORY_AFFINITY_INFO;
-
-/** A structure that describes the ACPI Device Handle (Type 0) in the
- Generic Initiator Affinity structure in SRAT
-
- ID: EArmObjDeviceHandleAcpi
-*/
-typedef struct CmArmDeviceHandleAcpi {
- /// Hardware ID
- UINT64 Hid;
-
- /// Unique Id
- UINT32 Uid;
-} CM_ARM_DEVICE_HANDLE_ACPI;
-
-/** A structure that describes the PCI Device Handle (Type 1) in the
- Generic Initiator Affinity structure in SRAT
-
- ID: EArmObjDeviceHandlePci
-*/
-typedef struct CmArmDeviceHandlePci {
- /// PCI Segment Number
- UINT16 SegmentNumber;
-
- /// PCI Bus Number - Max 256 busses (Bits 15:8 of BDF)
- UINT8 BusNumber;
-
- /// PCI Device Number - Max 32 devices (Bits 7:3 of BDF)
- UINT8 DeviceNumber;
-
- /// PCI Function Number - Max 8 functions (Bits 2:0 of BDF)
- UINT8 FunctionNumber;
-} CM_ARM_DEVICE_HANDLE_PCI;
-
-/** A structure that describes the Generic Initiator Affinity structure in SRAT
-
- ID: EArmObjGenericInitiatorAffinityInfo
-*/
-typedef struct CmArmGenericInitiatorAffinityInfo {
- /// The proximity domain to which the generic initiator belongs.
- UINT32 ProximityDomain;
-
- /// Flags
- UINT32 Flags;
-
- /// Device Handle Type
- UINT8 DeviceHandleType;
-
- /// Reference Token for the Device Handle
- CM_OBJECT_TOKEN DeviceHandleToken;
-} CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO;
+typedef CM_ARCH_COMMON_GENERIC_INTERRUPT CM_ARM_EXTENDED_INTERRUPT;
/** A structure that describes the CMN-600 hardware.
@@ -950,133 +667,6 @@ typedef struct CmArmCmn600Info {
CM_ARM_EXTENDED_INTERRUPT DtcInterrupt[4];
} CM_ARM_CMN_600_INFO;
-/** A structure that describes the Lpi information.
-
- The Low Power Idle states are described in DSDT/SSDT and associated
- to cpus/clusters in the cpu topology.
-
- ID: EArmObjLpiInfo
-*/
-typedef struct CmArmLpiInfo {
- /** Minimum Residency. Time in microseconds after which a
- state becomes more energy efficient than any shallower state.
- */
- UINT32 MinResidency;
-
- /** Worst case time in microseconds from a wake interrupt
- being asserted to the return to a running state
- */
- UINT32 WorstCaseWakeLatency;
-
- /** Flags.
- */
- UINT32 Flags;
-
- /** Architecture specific context loss flags.
- */
- UINT32 ArchFlags;
-
- /** Residency counter frequency in cycles-per-second (Hz).
- */
- UINT32 ResCntFreq;
-
- /** Every shallower power state in the parent is also enabled.
- */
- UINT32 EnableParentState;
-
- /** The EntryMethod _LPI field can be described as an integer
- or in a Register resource data descriptor.
-
- If IsInteger is TRUE, the IntegerEntryMethod field is used.
- If IsInteger is FALSE, the RegisterEntryMethod field is used.
- */
- BOOLEAN IsInteger;
-
- /** EntryMethod described as an Integer.
- */
- UINT64 IntegerEntryMethod;
-
- /** EntryMethod described as a EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR.
- */
- EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE RegisterEntryMethod;
-
- /** Residency counter register.
- */
- EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE ResidencyCounterRegister;
-
- /** Usage counter register.
- */
- EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE UsageCounterRegister;
-
- /** String representing the Lpi state
- */
- CHAR8 StateName[16];
-} CM_ARM_LPI_INFO;
-
-/** A structure that describes a PCI Address Map.
-
- The memory-ranges used by the PCI bus are described by this object.
-
- ID: EArmObjPciAddressMapInfo
-*/
-typedef struct CmArmPciAddressMapInfo {
- /** Pci address space code
-
- Available values are:
- - 0: Configuration Space
- - 1: I/O Space
- - 2: 32-bit-address Memory Space
- - 3: 64-bit-address Memory Space
- */
- UINT8 SpaceCode;
-
- /// PCI address
- UINT64 PciAddress;
-
- /// Cpu address
- UINT64 CpuAddress;
-
- /// Address size
- UINT64 AddressSize;
-} CM_ARM_PCI_ADDRESS_MAP_INFO;
-
-/** A structure that describes a PCI Interrupt Map.
-
- The legacy PCI interrupts used by PCI devices are described by this object.
-
- Cf Devicetree Specification - Release v0.3
- s2.4.3 "Interrupt Nexus Properties"
-
- ID: EArmObjPciInterruptMapInfo
-*/
-typedef struct CmArmPciInterruptMapInfo {
- /// Pci Bus.
- /// Value on 8 bits (max 255).
- UINT8 PciBus;
-
- /// Pci Device.
- /// Value on 5 bits (max 31).
- UINT8 PciDevice;
-
- /** PCI interrupt
-
- ACPI bindings are used:
- Cf. ACPI 6.4, s6.2.13 _PRT (PCI Routing Table):
- "0-INTA, 1-INTB, 2-INTC, 3-INTD"
-
- Device-tree bindings are shifted by 1:
- "INTA=1, INTB=2, INTC=3, INTD=4"
- */
- UINT8 PciInterrupt;
-
- /** Interrupt controller interrupt.
-
- Cf Devicetree Specification - Release v0.3
- s2.4.3 "Interrupt Nexus Properties": "parent interrupt specifier"
- */
- CM_ARM_GENERIC_INTERRUPT IntcInterrupt;
-} CM_ARM_PCI_INTERRUPT_MAP_INFO;
-
/** A structure that describes the
RMR node for the Platform.
@@ -1117,209 +707,6 @@ typedef struct CmArmRmrDescriptor {
UINT64 Length;
} CM_ARM_MEMORY_RANGE_DESCRIPTOR;
-/** A structure that describes the Cpc information.
-
- Continuous Performance Control is described in DSDT/SSDT and associated
- to cpus/clusters in the cpu topology.
-
- Unsupported Optional registers should be encoded with NULL resource
- Register {(SystemMemory, 0, 0, 0, 0)}
-
- For values that support Integer or Buffer, integer will be used
- if buffer is NULL resource.
- If resource is not NULL then Integer must be 0
-
- Cf. ACPI 6.4, s8.4.7.1 _CPC (Continuous Performance Control)
-
- ID: EArmObjCpcInfo
-*/
-typedef AML_CPC_INFO CM_ARM_CPC_INFO;
-
-/** A structure that describes a
- PCC Mailbox Register.
-*/
-typedef struct PccMailboxRegisterInfo {
- /// GAS describing the Register.
- EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE Register;
-
- /** Mask of bits to preserve when writing.
-
- This mask is also used for registers. The Register is only read
- and there is no write mask required. E.g.:
- - Error Status mask (Cf. PCC Subspace types 3/4/5).
- - Command Complete Check mask (Cf. PCC Subspace types 3/4/5).
- */
- UINT64 PreserveMask;
-
- /// Mask of bits to set when writing.
- UINT64 WriteMask;
-} PCC_MAILBOX_REGISTER_INFO;
-
-/** A structure that describes the
- PCC Subspace CHannel Timings.
-*/
-typedef struct PccSubspaceChannelTimingInfo {
- /// Expected latency to process a command, in microseconds.
- UINT32 NominalLatency;
-
- /** Maximum number of periodic requests that the subspace channel can
- support, reported in commands per minute. 0 indicates no limitation.
-
- This field is ignored for the PCC Subspace type 5 (HW Registers based).
- */
- UINT32 MaxPeriodicAccessRate;
-
- /** Minimum amount of time that OSPM must wait after the completion
- of a command before issuing the next command, in microseconds.
- */
- UINT16 MinRequestTurnaroundTime;
-} PCC_SUBSPACE_CHANNEL_TIMING_INFO;
-
-/** A structure that describes a
- Generic PCC Subspace (Type 0).
-*/
-typedef struct CmArmPccSubspaceGenericInfo {
- /** Subspace Id.
-
- Cf. ACPI 6.4, s14.7 Referencing the PCC address space
- Cf. s14.1.2 Platform Communications Channel Subspace Structures
- The subspace ID of a PCC subspace is its index in the array of
- subspace structures, starting with subspace 0.
-
- At most 256 subspaces are supported.
- */
- UINT8 SubspaceId;
-
- /// Table type (or subspace).
- UINT8 Type;
-
- /// Base address of the shared memory range.
- /// This field is ignored for the PCC Subspace type 5 (HW Registers based).
- UINT64 BaseAddress;
-
- /// Address length.
- UINT64 AddressLength;
-
- /// Doorbell Register.
- PCC_MAILBOX_REGISTER_INFO DoorbellReg;
-
- /// Mailbox Timings.
- PCC_SUBSPACE_CHANNEL_TIMING_INFO ChannelTiming;
-} PCC_SUBSPACE_GENERIC_INFO;
-
-/** A structure that describes a
- PCC Subspace of type 0 (Generic).
-
- ID: EArmObjPccSubspaceType0Info
-*/
-typedef PCC_SUBSPACE_GENERIC_INFO CM_ARM_PCC_SUBSPACE_TYPE0_INFO;
-
-/** A structure that describes a
- PCC Subspace of type 1 (HW-Reduced).
-
- ID: EArmObjPccSubspaceType1Info
-*/
-typedef struct CmArmPccSubspaceType1Info {
- /** Generic Pcc information.
-
- The Subspace of Type0 contains information that can be re-used
- in other Subspace types.
- */
- PCC_SUBSPACE_GENERIC_INFO GenericPccInfo;
-
- /// Platform Interrupt.
- CM_ARM_GENERIC_INTERRUPT PlatIrq;
-} CM_ARM_PCC_SUBSPACE_TYPE1_INFO;
-
-/** A structure that describes a
- PCC Subspace of type 2 (HW-Reduced).
-
- ID: EArmObjPccSubspaceType2Info
-*/
-typedef struct CmArmPccSubspaceType2Info {
- /** Generic Pcc information.
-
- The Subspace of Type0 contains information that can be re-used
- in other Subspace types.
- */
- PCC_SUBSPACE_GENERIC_INFO GenericPccInfo;
-
- /// Platform Interrupt.
- CM_ARM_GENERIC_INTERRUPT PlatIrq;
-
- /// Platform Interrupt Register.
- PCC_MAILBOX_REGISTER_INFO PlatIrqAckReg;
-} CM_ARM_PCC_SUBSPACE_TYPE2_INFO;
-
-/** A structure that describes a
- PCC Subspace of type 3 (Extended)
-
- ID: EArmObjPccSubspaceType3Info
-*/
-typedef struct CmArmPccSubspaceType3Info {
- /** Generic Pcc information.
-
- The Subspace of Type0 contains information that can be re-used
- in other Subspace types.
- */
- PCC_SUBSPACE_GENERIC_INFO GenericPccInfo;
-
- /// Platform Interrupt.
- CM_ARM_GENERIC_INTERRUPT PlatIrq;
-
- /// Platform Interrupt Register.
- PCC_MAILBOX_REGISTER_INFO PlatIrqAckReg;
-
- /// Command Complete Check Register.
- /// The WriteMask field is not used.
- PCC_MAILBOX_REGISTER_INFO CmdCompleteCheckReg;
-
- /// Command Complete Update Register.
- PCC_MAILBOX_REGISTER_INFO CmdCompleteUpdateReg;
-
- /// Error Status Register.
- /// The WriteMask field is not used.
- PCC_MAILBOX_REGISTER_INFO ErrorStatusReg;
-} CM_ARM_PCC_SUBSPACE_TYPE3_INFO;
-
-/** A structure that describes a
- PCC Subspace of type 4 (Extended)
-
- ID: EArmObjPccSubspaceType4Info
-*/
-typedef CM_ARM_PCC_SUBSPACE_TYPE3_INFO CM_ARM_PCC_SUBSPACE_TYPE4_INFO;
-
-/** A structure that describes a
- PCC Subspace of type 5 (HW-Registers).
-
- ID: EArmObjPccSubspaceType5Info
-*/
-typedef struct CmArmPccSubspaceType5Info {
- /** Generic Pcc information.
-
- The Subspace of Type0 contains information that can be re-used
- in other Subspace types.
-
- MaximumPeriodicAccessRate doesn't need to be populated for
- this structure.
- */
- PCC_SUBSPACE_GENERIC_INFO GenericPccInfo;
-
- /// Version.
- UINT16 Version;
-
- /// Platform Interrupt.
- CM_ARM_GENERIC_INTERRUPT PlatIrq;
-
- /// Command Complete Check Register.
- /// The WriteMask field is not used.
- PCC_MAILBOX_REGISTER_INFO CmdCompleteCheckReg;
-
- /// Error Status Register.
- /// The WriteMask field is not used.
- PCC_MAILBOX_REGISTER_INFO ErrorStatusReg;
-} CM_ARM_PCC_SUBSPACE_TYPE5_INFO;
-
/** An enum describing the Arm Embedded Trace device type.
*/
typedef enum ArmEtType {
@@ -1336,15 +723,6 @@ typedef struct CmArmEtInfo {
ARM_ET_TYPE EtType;
} CM_ARM_ET_INFO;
-/** A structure that describes a
- P-State Dependency (PSD) Info.
-
- Cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency).
-
- ID: EArmObjPsdInfo
-*/
-typedef AML_PSD_INFO CM_ARM_PSD_INFO;
-
#pragma pack()
#endif // ARM_NAMESPACE_OBJECTS_H_
diff --git a/DynamicTablesPkg/Include/ConfigurationManagerObject.h b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
index 74ad25d..2660522 100644
--- a/DynamicTablesPkg/Include/ConfigurationManagerObject.h
+++ b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
@@ -1,19 +1,23 @@
/** @file
- Copyright (c) 2017 - 2022, ARM Limited. All rights reserved.
+ Copyright (c) 2017 - 2024, Arm Limited. All rights reserved.
+ Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Glossary:
- Cm or CM - Configuration Manager
- Obj or OBJ - Object
+ - X64 or x64 - X64 Architecture
**/
#ifndef CONFIGURATION_MANAGER_OBJECT_H_
#define CONFIGURATION_MANAGER_OBJECT_H_
+#include <ArchCommonNameSpaceObjects.h>
#include <ArmNameSpaceObjects.h>
#include <StandardNameSpaceObjects.h>
+#include <X64NameSpaceObjects.h>
#pragma pack(1)
@@ -29,8 +33,10 @@ _______________________________________________________________________________
Bits: [31:28] - Name Space ID
0000 - Standard
- 0001 - ARM
- 1000 - Custom/OEM
+ 0001 - Arch Common
+ 0010 - ARM
+ 0011 - X64
+ 1111 - Custom/OEM
All other values are reserved.
Bits: [27:16] - Reserved.
@@ -49,38 +55,11 @@ Object ID's in the Standard Namespace:
1 - ACPI Table List
2 - SMBIOS Table List
+Object ID's in the Arch Common Namespace:
+ See EARCH_COMMON_OBJECT_ID.
+
Object ID's in the ARM Namespace:
- 0 - Reserved
- 1 - Boot Architecture Info
- 2 - CPU Info
- 3 - Power Management Profile Info
- 4 - GICC Info
- 5 - GICD Info
- 6 - GIC MSI Frame Info
- 7 - GIC Redistributor Info
- 8 - GIC ITS Info
- 9 - Serial Console Port Info
- 10 - Serial Debug Port Info
- 11 - Generic Timer Info
- 12 - Platform GT Block Info
- 13 - Generic Timer Block Frame Info
- 14 - Platform Generic Watchdog
- 15 - PCI Configuration Space Info
- 16 - Hypervisor Vendor Id
- 17 - Fixed feature flags for FADT
- 18 - ITS Group
- 19 - Named Component
- 20 - Root Complex
- 21 - SMMUv1 or SMMUv2
- 22 - SMMUv3
- 23 - PMCG
- 24 - GIC ITS Identifier Array
- 25 - ID Mapping Array
- 26 - SMMU Interrupt Array
- 27 - Processor Hierarchy Info
- 28 - Cache Info
- 29 - Processor Hierarchy Node ID Info
- 30 - CM Object Reference
+ See EARM_OBJECT_ID.
*/
typedef UINT32 CM_OBJECT_ID;
@@ -105,10 +84,12 @@ typedef UINT32 CM_OBJECT_ID;
for the Configuration Manager Objects.
*/
typedef enum ObjectNameSpaceID {
- EObjNameSpaceStandard, ///< Standard Objects Namespace
- EObjNameSpaceArm, ///< ARM Objects Namespace
- EObjNameSpaceOem = 0x8, ///< OEM Objects Namespace
- EObjNameSpaceMax
+ EObjNameSpaceStandard, ///< Standard Objects Namespace
+ EObjNameSpaceArchCommon, ///< Arch Common Objects Namespace
+ EObjNameSpaceArm, ///< ARM Objects Namespace
+ EObjNameSpaceX64, ///< X64 Objects Namespace
+ EObjNameSpaceOem = 0xF, ///< OEM Objects Namespace
+ EObjNameSpaceMax,
} EOBJECT_NAMESPACE_ID;
/** A descriptor for Configuration Manager Objects.
@@ -183,6 +164,16 @@ typedef struct CmObjDescriptor {
(CREATE_CM_OBJECT_ID (EObjNameSpaceArm, ObjectId))
/** This macro returns a Configuration Manager Object ID
+ in the Arch Common Object Namespace.
+
+ @param [in] ObjectId The Object ID.
+
+ @retval Returns an Arch Common Configuration Manager Object ID.
+**/
+#define CREATE_CM_ARCH_COMMON_OBJECT_ID(ObjectId) \
+ (CREATE_CM_OBJECT_ID (EObjNameSpaceArchCommon, ObjectId))
+
+/** This macro returns a Configuration Manager Object ID
in the OEM Object Namespace.
@param [in] ObjectId The Object ID.
@@ -192,4 +183,14 @@ typedef struct CmObjDescriptor {
#define CREATE_CM_OEM_OBJECT_ID(ObjectId) \
(CREATE_CM_OBJECT_ID (EObjNameSpaceOem, ObjectId))
+/** This macro returns a Configuration Manager Object ID
+ in the X64 Object Namespace.
+
+ @param [in] ObjectId The Object ID.
+
+ @retval Returns X64 Configuration Manager Object ID.
+**/
+#define CREATE_CM_X64_OBJECT_ID(ObjectId) \
+ (CREATE_CM_OBJECT_ID (EObjNameSpaceX64, ObjectId))
+
#endif // CONFIGURATION_MANAGER_OBJECT_H_
diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
index 7c13073..13ce97c 100644
--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
@@ -1028,6 +1028,48 @@ AmlCodeGenRdInterrupt (
OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
);
+/** Code generation for the "IO ()" ASL function.
+
+ The Resource Data effectively created is a IO Resource
+ Data. Cf ACPI 6.5:
+ - s19.6.65 IO (IO Resource Descriptor Macro)
+ - s6.4.2.5 I/O Port Descriptor
+
+ The created resource data node can be:
+ - appended to the list of resource data elements of the NameOpNode.
+ In such case NameOpNode must be defined by a the "Name ()" ASL statement
+ and initially contain a "ResourceTemplate ()".
+ - returned through the NewRdNode parameter.
+
+ @param [in] IsDecoder16 Decoder parameter.
+ TRUE if 16-bit decoder.
+ FALSE if 10-bit decoder.
+ @param [in] AddressMinimum Minimum address.
+ @param [in] AddressMaximum Maximum address.
+ @param [in] Alignment Alignment.
+ @param [in] RangeLength Range length.
+ @param [in] NameOpNode NameOp object node defining a named object.
+ If provided, append the new resource data
+ node to the list of resource data elements
+ of this node.
+ @param [out] NewRdNode If provided and success,
+ contain the created node.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenRdIo (
+ IN BOOLEAN IsDecoder16,
+ IN UINT16 AddressMinimum,
+ IN UINT16 AddressMaximum,
+ IN UINT8 Alignment,
+ IN UINT8 RangeLength,
+ IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
+ OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
+ );
+
/** AML code generation for DefinitionBlock.
Create a Root Node handle.
diff --git a/DynamicTablesPkg/Include/Library/SsdtPcieSupportLib.h b/DynamicTablesPkg/Include/Library/SsdtPcieSupportLib.h
index 4171dab..50a335e 100644
--- a/DynamicTablesPkg/Include/Library/SsdtPcieSupportLib.h
+++ b/DynamicTablesPkg/Include/Library/SsdtPcieSupportLib.h
@@ -43,8 +43,8 @@ typedef struct MappingTable {
EFI_STATUS
EFIAPI
AddOscMethod (
- IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo,
- IN OUT AML_OBJECT_NODE_HANDLE PciNode
+ IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciInfo,
+ IN OUT AML_OBJECT_NODE_HANDLE PciNode
);
/** Generate Pci slots devices.
@@ -66,10 +66,10 @@ AddOscMethod (
EFI_STATUS
EFIAPI
GeneratePciSlots (
- IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo,
- IN CONST MAPPING_TABLE *MappingTable,
- IN UINT32 Uid,
- IN OUT AML_OBJECT_NODE_HANDLE PciNode
+ IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciInfo,
+ IN CONST MAPPING_TABLE *MappingTable,
+ IN UINT32 Uid,
+ IN OUT AML_OBJECT_NODE_HANDLE PciNode
);
#endif // SSDT_PCIE_SUPPORT_LIB_H_
diff --git a/DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h b/DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h
index 4835f31..ac7b39f 100644
--- a/DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h
+++ b/DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h
@@ -29,11 +29,11 @@
EFI_STATUS
EFIAPI
BuildSsdtSerialPortTable (
- IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *AcpiTableInfo,
- IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo,
- IN CONST CHAR8 *Name,
- IN CONST UINT64 Uid,
- OUT EFI_ACPI_DESCRIPTION_HEADER **Table
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *AcpiTableInfo,
+ IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo,
+ IN CONST CHAR8 *Name,
+ IN CONST UINT64 Uid,
+ OUT EFI_ACPI_DESCRIPTION_HEADER **Table
);
/** Free an SSDT table previously created by
@@ -52,7 +52,7 @@ FreeSsdtSerialPortTable (
/** Validate the Serial Port Information.
- @param [in] SerialPortInfoTable Table of CM_ARM_SERIAL_PORT_INFO.
+ @param [in] SerialPortInfoTable Table of CM_ARCH_COMMON_SERIAL_PORT_INFO.
@param [in] SerialPortCount Count of SerialPort in the table.
@retval EFI_SUCCESS Success.
@@ -61,8 +61,8 @@ FreeSsdtSerialPortTable (
EFI_STATUS
EFIAPI
ValidateSerialPortInfo (
- IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfoTable,
- IN UINT32 SerialPortCount
+ IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfoTable,
+ IN UINT32 SerialPortCount
);
#endif // SSDT_SERIAL_PORT_LIB_H_
diff --git a/DynamicTablesPkg/Include/X64NameSpaceObjects.h b/DynamicTablesPkg/Include/X64NameSpaceObjects.h
new file mode 100644
index 0000000..d897051
--- /dev/null
+++ b/DynamicTablesPkg/Include/X64NameSpaceObjects.h
@@ -0,0 +1,180 @@
+/** @file
+
+ Defines the X64 Namespace Object.
+
+ Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+ - X64 or x64 - X64 Architecture
+**/
+
+#ifndef X64_NAMESPACE_OBJECTS_H_
+#define X64_NAMESPACE_OBJECTS_H_
+
+#include <IndustryStandard/Acpi.h>
+
+/** The EX64_OBJECT_ID enum describes the Object IDs
+ in the X64 Namespace
+*/
+typedef enum X64ObjectID {
+ EX64ObjReserved, ///< 0 - Reserved
+ EX64ObjFadtSciInterrupt, ///< 1 - FADT SCI Interrupt information
+ EX64ObjFadtSciCmdInfo, ///< 2 - FADT SCI CMD information
+ EX64ObjFadtPmBlockInfo, ///< 3 - FADT Power management block info
+ EX64ObjFadtGpeBlockInfo, ///< 4 - FADT GPE block info
+ EX64ObjFadtXpmBlockInfo, ///< 5 - FADT 64-bit Power Management block info
+ EX64ObjFadtXgpeBlockInfo, ///< 6 - FADT 64-bit GPE block info
+ EX64ObjFadtSleepBlockInfo, ///< 7 - FADT Sleep block info
+ EX64ObjFadtResetBlockInfo, ///< 8 - FADT Reset block info
+ EX64ObjFadtMiscInfo, ///< 9 - FADT Legacy fields info
+ EX64ObjWsmtFlagsInfo, ///< 10 - WSMT protection flags info
+ EX64ObjMax ///< 11 - Maximum Object ID
+} EX64_OBJECT_ID;
+
+/** A structure that describes the
+ SCI interrupt Information for the Platform.
+
+ ID: EX64ObjFadtSciInterrupt
+*/
+typedef struct CmX64FadtSciInterrupt {
+ /** This is the SCI interrupt field of the FADT Table
+ described in the ACPI Specification
+ */
+ UINT16 SciInterrupt;
+} CM_X64_FADT_SCI_INTERRUPT;
+
+/** A structure that describes the
+ SCI CMD Information for the Platform.
+
+ ID: EX64ObjFadtSciCmdInfo
+*/
+typedef struct CmX64FadtSciCmdInfo {
+ /** This is the System control interrupt command information of the FADT Table
+ described in the ACPI Specification
+ */
+ UINT32 SciCmd;
+ UINT8 AcpiEnable;
+ UINT8 AcpiDisable;
+ UINT8 S4BiosReq;
+ UINT8 PstateCnt;
+ UINT8 CstCnt;
+} CM_X64_FADT_SCI_CMD_INFO;
+
+/** A structure that describes the
+ power management block information.
+
+ ID: EX64ObjFadtPmBlockInfo
+*/
+typedef struct CmX64FadtPmBlockInfo {
+ /** This is the PM event block information of the FADT Table
+ described in the ACPI Specification
+ */
+ UINT32 Pm1aEvtBlk;
+ UINT32 Pm1bEvtBlk;
+ UINT32 Pm1aCntBlk;
+ UINT32 Pm1bCntBlk;
+ UINT32 Pm2CntBlk;
+ UINT32 PmTmrBlk;
+ UINT8 Pm1EvtLen;
+ UINT8 Pm1CntLen;
+ UINT8 Pm2CntLen;
+ UINT8 PmTmrLen;
+} CM_X64_FADT_PM_BLOCK_INFO;
+
+/** A structure that describes the
+ GPE block information.
+
+ ID: EX64ObjFadtGpeBlockInfo
+*/
+typedef struct CmX64FadtGpeBlockInfo {
+ /** This is the GPE Block information of the FADT Table
+ described in the ACPI Specification
+ */
+ UINT32 Gpe0Blk;
+ UINT32 Gpe1Blk;
+ UINT8 Gpe0BlkLen;
+ UINT8 Gpe1BlkLen;
+ UINT8 Gpe1Base;
+} CM_X64_FADT_GPE_BLOCK_INFO;
+
+/** A structure that describes the
+ 64bit power management block information.
+
+ ID: EX64ObjFadtXpmBlockInfo
+*/
+typedef struct CmX64FadtXpmBlockInfo {
+ /** This is the System control interrupt command information of the FADT Table
+ described in the ACPI Specification
+ */
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk;
+} CM_X64_FADT_X_PM_BLOCK_INFO;
+
+/** A structure that describes the
+ 64-bit GPE block information.
+
+ ID: EX64ObjFadtXgpeBlockInfo
+*/
+typedef struct CmX64FadtXgpeBlockInfo {
+ /** This is the GPE Block information of the FADT Table
+ described in the ACPI Specification
+ */
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XGpe0Blk;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XGpe1Blk;
+} CM_X64_FADT_X_GPE_BLOCK_INFO;
+
+/** A structure that describes the
+ sleep control block information.
+
+ ID: EX64ObjFadtSleepBlockInfo
+*/
+typedef struct CmX64FadtSleepBlockInfo {
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE SleepControlReg;
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE SleepStatusReg;
+} CM_X64_FADT_SLEEP_BLOCK_INFO;
+
+/** A structure that describes the
+ Reset control block information.
+
+ ID: EX64ObjFadtResetBlockInfo
+*/
+typedef struct CmX64FadtResetBlockInfo {
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE ResetReg;
+ UINT8 ResetValue;
+} CM_X64_FADT_RESET_BLOCK_INFO;
+
+/** A structure that describes the
+ miscellaneous FADT fields information.
+
+ ID: EX64ObjFadtMiscInfo
+*/
+typedef struct CmX64FadtFadtMiscInfo {
+ UINT16 PLvl2Lat;
+ UINT16 PLvl3Lat;
+ UINT16 FlushSize;
+ UINT16 FlushStride;
+ UINT8 DutyOffset;
+ UINT8 DutyWidth;
+ UINT8 DayAlrm;
+ UINT8 MonAlrm;
+ UINT8 Century;
+} CM_X64_FADT_MISC_INFO;
+
+/**
+ A structure that describes the WSMT protection flags information.
+
+ ID: EX64ObjWsmtFlagsInfo
+*/
+typedef struct CmX64WsmtFlagsInfo {
+ UINT32 ProtectionFlags;
+} CM_X64_WSMT_FLAGS_INFO;
+
+#endif // X64_NAMESPACE_OBJECTS_H_
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600Generator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600Generator.c
index 6118df0..3585a53 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600Generator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600Generator.c
@@ -65,10 +65,10 @@ ValidateCmn600Info (
IN CONST UINT32 Cmn600Count
)
{
- UINT32 Index;
- UINT32 DtcIndex;
- CONST CM_ARM_CMN_600_INFO *Cmn600Info;
- CONST CM_ARM_GENERIC_INTERRUPT *DtcInterrupt;
+ UINT32 Index;
+ UINT32 DtcIndex;
+ CONST CM_ARM_CMN_600_INFO *Cmn600Info;
+ CONST CM_ARCH_COMMON_GENERIC_INTERRUPT *DtcInterrupt;
if ((Cmn600InfoList == NULL) ||
(Cmn600Count == 0))
@@ -231,10 +231,10 @@ FixupCmn600Info (
OUT EFI_ACPI_DESCRIPTION_HEADER **Table
)
{
- EFI_STATUS Status;
- EFI_STATUS Status1;
- UINT8 Index;
- CONST CM_ARM_GENERIC_INTERRUPT *DtcInt;
+ EFI_STATUS Status;
+ EFI_STATUS Status1;
+ UINT8 Index;
+ CONST CM_ARCH_COMMON_GENERIC_INTERRUPT *DtcInt;
EFI_ACPI_DESCRIPTION_HEADER *SsdtCmn600Template;
AML_ROOT_NODE_HANDLE RootNodeHandle;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h
deleted file mode 100644
index 0c7a0b0..0000000
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/** @file
- SSDT Cpu Topology Table Generator.
-
- Copyright (c) 2021 - 2023, Arm Limited. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
- @par Reference(s):
- - ACPI 6.3 Specification - January 2019 - s8.4 Declaring Processors
- - ACPI for CoreSight version 1.2 Platform Design Document
- (https://developer.arm.com/documentation/den0067/a/?lang=en)
-
- @par Glossary:
- - ETE - Embedded Trace Extension.
- - ETM - Embedded Trace Macrocell.
-**/
-
-#ifndef SSDT_CPU_TOPOLOGY_GENERATOR_H_
-#define SSDT_CPU_TOPOLOGY_GENERATOR_H_
-
-#pragma pack(1)
-
-// Mask for the flags that need to be checked.
-#define PPTT_PROCESSOR_MASK ( \
- (EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) | \
- (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
- (EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
-
-// Mask for the cpu flags.
-#define PPTT_CPU_PROCESSOR_MASK ( \
- (EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \
- (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
- (EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
-
-// Mask for the cluster flags.
-// Even though a _UID is generated for clusters, it is simpler to use
-// EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID and to not match the cluster id of
-// the PPTT table (not sure the PPTT table is generated).
-#define PPTT_CLUSTER_PROCESSOR_MASK ( \
- (EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \
- (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID << 1) | \
- (EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF << 3))
-
-// Leaf nodes specific mask.
-#define PPTT_LEAF_MASK ((EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
- (EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
-
-/** LPI states are stored in the ASL namespace at '\_SB_.Lxxx',
- with xxx being the node index of the LPI state.
-*/
-#define SB_SCOPE "\\_SB_"
-#define SB_SCOPE_PREFIX SB_SCOPE "."
-/// Size of the SB_SCOPE_PREFIX string.
-#define SB_SCOPE_PREFIX_SIZE sizeof (SB_SCOPE_PREFIX)
-
-/// HID for a processor device.
-#define ACPI_HID_PROCESSOR_DEVICE "ACPI0007"
-
-/// HID for a ETM/ETE device.
-#define ACPI_HID_ET_DEVICE "ARMHC500"
-
-/// HID for a processor container device.
-#define ACPI_HID_PROCESSOR_CONTAINER_DEVICE "ACPI0010"
-
-/** Node names of Cpus and Clusters are 'Cxxx', and 'Lxxx' for LPI states.
- The 'xxx' is an index on 12 bits is given to node name,
- thus the limitation in the number of nodes.
-*/
-#define MAX_NODE_COUNT (1 << 12)
-
-/** A structure used to handle the Lpi structures referencing.
-
- A CM_ARM_PROC_HIERARCHY_INFO structure references a CM_ARM_OBJ_REF.
- This CM_ARM_OBJ_REF references CM_ARM_LPI_INFO structures.
-
- Example:
- (Cpu0) (Cpu1)
- CM_ARM_PROC_HIERARCHY_INFO CM_ARM_PROC_HIERARCHY_INFO
- | |
- +----------------------------------------
- |
- v
- (List of references to Lpi states)
- CM_ARM_OBJ_REF
- |
- +----------------------------------------
- | |
- v v
- (A first Lpi state) (A second Lpi state)
- CM_ARM_LPI_INFO[0] CM_ARM_LPI_INFO[1]
-
- Here, Cpu0 and Cpu1 have the same Lpi states. Both CM_ARM_PROC_HIERARCHY_INFO
- structures reference the same CM_ARM_OBJ_REF. An entry is created in the
- TokenTable such as:
- 0 <-> CM_ARM_OBJ_REF
-
- This will lead to the creation of this pseudo-ASL code where Cpu0 and Cpu1
- return the same object at \_SB.L000:
- Scope (\_SB) {
- Device (C000) {
- [...]
- Method (_LPI) {
- Return (\_SB.L000)
- }
- } // C000
-
- Device (C001) {
- [...]
- Method (_LPI) {
- Return (\_SB.L000)
- }
- } // C001
-
- // Lpi states
- Name (L000, Package (0x05) {
- [...]
- }
- }
-*/
-typedef struct TokenTable {
- /// TokenTable, a table allowing to map:
- /// Index <-> CM_OBJECT_TOKEN (to CM_ARM_LPI_INFO structures).
- CM_OBJECT_TOKEN *Table;
-
- /// Last used index of the TokenTable.
- /// LastIndex is bound by ProcNodeCount.
- UINT32 LastIndex;
-} TOKEN_TABLE;
-
-/** A structure holding the Cpu topology generator and additional private data.
-*/
-typedef struct AcpiCpuTopologyGenerator {
- /// ACPI Table generator header
- ACPI_TABLE_GENERATOR Header;
-
- // Private fields are defined from here.
-
- /// Private object used to handle token referencing.
- TOKEN_TABLE TokenTable;
- /// List of CM_ARM_PROC_HIERARCHY_INFO CM objects.
- CM_ARM_PROC_HIERARCHY_INFO *ProcNodeList;
- /// Count of CM_ARM_PROC_HIERARCHY_INFO CM objects.
- UINT32 ProcNodeCount;
-} ACPI_CPU_TOPOLOGY_GENERATOR;
-
-#pragma pack()
-
-#endif // SSDT_CPU_TOPOLOGY_GENERATOR_H_
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/AcpiDbg2LibArm.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/AcpiDbg2Lib.inf
index f7b7c1c..ed049ea 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/AcpiDbg2LibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/AcpiDbg2Lib.inf
@@ -8,7 +8,7 @@
[Defines]
INF_VERSION = 0x00010019
- BASE_NAME = AcpiDbg2LibArm
+ BASE_NAME = AcpiDbg2Lib
FILE_GUID = A17BA4F0-3DEB-4FE5-BD27-EC008E541B22
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
@@ -18,17 +18,28 @@
[Sources]
Dbg2Generator.c
+ Dbg2Generator.h
+
+[Sources.ARM, Sources.AARCH64]
+ Arm/ArmDbg2Generator.c
+
+[Sources.IA32, Sources.X86]
+ Dbg2GeneratorNull.c
+
+[Packages.ARM, Packages.AARCH64]
+ ArmPlatformPkg/ArmPlatformPkg.dec
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
DynamicTablesPkg/DynamicTablesPkg.dec
+[LibraryClasses.ARM, LibraryClasses.AARCH64]
+ PL011UartLib
+
[LibraryClasses]
BaseLib
- PL011UartLib
SsdtSerialPortFixupLib
[FixedPcd]
@@ -36,8 +47,3 @@
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
-
-[Protocols]
-
-[Guids]
-
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Arm/ArmDbg2Generator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Arm/ArmDbg2Generator.c
new file mode 100644
index 0000000..a063f49
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Arm/ArmDbg2Generator.c
@@ -0,0 +1,67 @@
+/** @file
+ Arm DBG2 Table Generator
+
+ Copyright (c) 2024, Arm Limited. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - Microsoft Debug Port Table 2 (DBG2) Specification - December 10, 2015.
+**/
+
+#include <ConfigurationManagerObject.h>
+#include <Library/PL011UartLib.h>
+#include <Protocol/SerialIo.h>
+#include "Dbg2Generator.h"
+
+/**
+ Initialise the serial port to the specified settings.
+ The serial port is re-configured only if the specified settings
+ are different from the current settings.
+ All unspecified settings will be set to the default values.
+
+ @param SerialPortInfo CM_ARCH_COMMON_SERIAL_PORT_INFO object describing
+ the serial port.
+ @param BaudRate The baud rate of the serial device. If the
+ baud rate is not supported, the speed will be
+ reduced to the nearest supported one and the
+ variable's value will be updated accordingly.
+ @param ReceiveFifoDepth The number of characters the device will
+ buffer on input. Value of 0 will use the
+ device's default FIFO depth.
+ @param Parity If applicable, this is the EFI_PARITY_TYPE
+ that is computed or checked as each character
+ is transmitted or received. If the device
+ does not support parity, the value is the
+ default parity value.
+ @param DataBits The number of data bits in each character.
+ @param StopBits If applicable, the EFI_STOP_BITS_TYPE number
+ of stop bits per character.
+ If the device does not support stop bits, the
+ value is the default stop bit value.
+
+ @retval RETURN_SUCCESS All attributes were set correctly on the
+ serial device.
+ @retval RETURN_INVALID_PARAMETER One or more of the attributes has an
+ unsupported value.
+**/
+RETURN_STATUS
+EFIAPI
+Dbg2InitializePort (
+ IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo,
+ IN OUT UINT64 *BaudRate,
+ IN OUT UINT32 *ReceiveFifoDepth,
+ IN OUT EFI_PARITY_TYPE *Parity,
+ IN OUT UINT8 *DataBits,
+ IN OUT EFI_STOP_BITS_TYPE *StopBits
+ )
+{
+ return PL011UartInitializePort (
+ (UINTN)SerialPortInfo->BaseAddress,
+ SerialPortInfo->Clock,
+ BaudRate,
+ ReceiveFifoDepth,
+ Parity,
+ DataBits,
+ StopBits
+ );
+}
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Dbg2Generator.c
index f6dfb3d..f387319 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Dbg2Generator.c
@@ -14,7 +14,6 @@
#include <Library/AcpiLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
-#include <Library/PL011UartLib.h>
#include <Protocol/AcpiTable.h>
#include <Protocol/SerialIo.h>
@@ -26,14 +25,16 @@
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
+#include "Dbg2Generator.h"
+
/** ARM standard DBG2 Table Generator
- Constructs the DBG2 table for PL011 or SBSA UART peripherals.
+ Constructs the DBG2 table for corresponding DBG2 peripheral.
Requirements:
The following Configuration Manager Object(s) are required by
this Generator:
- - EArmObjSerialDebugPortInfo
+ - EArchCommonObjSerialDebugPortInfo
*/
#pragma pack(1)
@@ -169,7 +170,7 @@ DBG2_TABLE AcpiDbg2 = {
DBG2_DEBUG_PORT_DDI (
0, // {Template}: Serial Port Subtype
0, // {Template}: Serial Port Base Address
- PL011_UART_LENGTH,
+ 0, // {Template}: Serial Port Base Address Size
NAMESPACE_STR_DBG_PORT0
)
}
@@ -181,12 +182,12 @@ DBG2_TABLE AcpiDbg2 = {
debug port information from the Configuration Manager
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjSerialDebugPortInfo,
- CM_ARM_SERIAL_PORT_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjSerialDebugPortInfo,
+ CM_ARCH_COMMON_SERIAL_PORT_INFO
);
-/** Initialize the PL011/SBSA UART with the parameters obtained from
+/** Initialize the DBG2 UART with the parameters obtained from
the Configuration Manager.
@param [in] SerialPortInfo Pointer to the Serial Port Information.
@@ -198,7 +199,7 @@ GET_OBJECT_LIST (
STATIC
EFI_STATUS
SetupDebugUart (
- IN CONST CM_ARM_SERIAL_PORT_INFO *CONST SerialPortInfo
+ IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *CONST SerialPortInfo
)
{
EFI_STATUS Status;
@@ -218,9 +219,8 @@ SetupDebugUart (
StopBits = (EFI_STOP_BITS_TYPE)FixedPcdGet8 (PcdUartDefaultStopBits);
BaudRate = SerialPortInfo->BaudRate;
- Status = PL011UartInitializePort (
- (UINTN)SerialPortInfo->BaseAddress,
- SerialPortInfo->Clock,
+ Status = Dbg2InitializePort (
+ SerialPortInfo,
&BaudRate,
&ReceiveFifoDepth,
&Parity,
@@ -329,10 +329,10 @@ BuildDbg2TableEx (
OUT UINTN *CONST TableCount
)
{
- EFI_STATUS Status;
- CM_ARM_SERIAL_PORT_INFO *SerialPortInfo;
- UINT32 SerialPortCount;
- EFI_ACPI_DESCRIPTION_HEADER **TableList;
+ EFI_STATUS Status;
+ CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo;
+ UINT32 SerialPortCount;
+ EFI_ACPI_DESCRIPTION_HEADER **TableList;
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
@@ -358,7 +358,7 @@ BuildDbg2TableEx (
*Table = NULL;
- Status = GetEArmObjSerialDebugPortInfo (
+ Status = GetEArchCommonObjSerialDebugPortInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
&SerialPortInfo,
@@ -460,6 +460,9 @@ BuildDbg2TableEx (
(SerialPortInfo->PortSubtype ==
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART))
{
+ // Setup the PL011 length.
+ AcpiDbg2.Dbg2DeviceInfo[INDEX_DBG_PORT0].AddressSize = PL011_UART_LENGTH;
+
// Initialize the serial port
Status = SetupDebugUart (SerialPortInfo);
if (EFI_ERROR (Status)) {
@@ -470,6 +473,13 @@ BuildDbg2TableEx (
));
goto error_handler;
}
+ } else if ((SerialPortInfo->PortSubtype ==
+ EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_16550_WITH_GAS))
+ {
+ AcpiDbg2.Dbg2DeviceInfo[INDEX_DBG_PORT0].AddressSize = SIZE_4KB;
+ } else {
+ // Try to catch other serial ports, but don't return an error.
+ ASSERT (0);
}
TableList[0] = (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiDbg2;
@@ -524,7 +534,7 @@ ACPI_TABLE_GENERATOR Dbg2Generator = {
// Minimum supported ACPI Table Revision
EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,
// Creator ID
- TABLE_GENERATOR_CREATOR_ID_ARM,
+ TABLE_GENERATOR_CREATOR_ID,
// Creator Revision
DBG2_GENERATOR_REVISION,
// Build table function. Use the extended version instead.
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Dbg2Generator.h b/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Dbg2Generator.h
new file mode 100644
index 0000000..5424be4
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Dbg2Generator.h
@@ -0,0 +1,56 @@
+/** @file
+ DBG2 Table Generator
+
+ Copyright (c) 2024, Arm Limited. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - Microsoft Debug Port Table 2 (DBG2) Specification - December 10, 2015.
+**/
+
+#ifndef DBG2_GENERATOR_H_
+#define DBG2_GENERATOR_H_
+
+/**
+ Initialise the serial port to the specified settings.
+ The serial port is re-configured only if the specified settings
+ are different from the current settings.
+ All unspecified settings will be set to the default values.
+
+ @param SerialPortInfo CM_ARCH_COMMON_SERIAL_PORT_INFO object describing
+ the serial port.
+ @param BaudRate The baud rate of the serial device. If the
+ baud rate is not supported, the speed will be
+ reduced to the nearest supported one and the
+ variable's value will be updated accordingly.
+ @param ReceiveFifoDepth The number of characters the device will
+ buffer on input. Value of 0 will use the
+ device's default FIFO depth.
+ @param Parity If applicable, this is the EFI_PARITY_TYPE
+ that is computed or checked as each character
+ is transmitted or received. If the device
+ does not support parity, the value is the
+ default parity value.
+ @param DataBits The number of data bits in each character.
+ @param StopBits If applicable, the EFI_STOP_BITS_TYPE number
+ of stop bits per character.
+ If the device does not support stop bits, the
+ value is the default stop bit value.
+
+ @retval RETURN_SUCCESS All attributes were set correctly on the
+ serial device.
+ @retval RETURN_INVALID_PARAMETER One or more of the attributes has an
+ unsupported value.
+**/
+RETURN_STATUS
+EFIAPI
+Dbg2InitializePort (
+ IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo,
+ IN OUT UINT64 *BaudRate,
+ IN OUT UINT32 *ReceiveFifoDepth,
+ IN OUT EFI_PARITY_TYPE *Parity,
+ IN OUT UINT8 *DataBits,
+ IN OUT EFI_STOP_BITS_TYPE *StopBits
+ );
+
+#endif // DBG2_GENERATOR_H_
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Dbg2GeneratorNull.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Dbg2GeneratorNull.c
new file mode 100644
index 0000000..3219f6f
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiDbg2Lib/Dbg2GeneratorNull.c
@@ -0,0 +1,60 @@
+/** @file
+ Common DBG2 Table Generator
+
+ Copyright (c) 2024, Arm Limited. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - Microsoft Debug Port Table 2 (DBG2) Specification - December 10, 2015.
+**/
+
+#include <ConfigurationManagerObject.h>
+#include <Protocol/SerialIo.h>
+#include "Dbg2Generator.h"
+
+/**
+ Initialise the serial port to the specified settings.
+ The serial port is re-configured only if the specified settings
+ are different from the current settings.
+ All unspecified settings will be set to the default values.
+
+ @param SerialPortInfo CM_ARCH_COMMON_SERIAL_PORT_INFO object describing
+ the serial port.
+ @param BaudRate The baud rate of the serial device. If the
+ baud rate is not supported, the speed will be
+ reduced to the nearest supported one and the
+ variable's value will be updated accordingly.
+ @param ReceiveFifoDepth The number of characters the device will
+ buffer on input. Value of 0 will use the
+ device's default FIFO depth.
+ @param Parity If applicable, this is the EFI_PARITY_TYPE
+ that is computed or checked as each character
+ is transmitted or received. If the device
+ does not support parity, the value is the
+ default parity value.
+ @param DataBits The number of data bits in each character.
+ @param StopBits If applicable, the EFI_STOP_BITS_TYPE number
+ of stop bits per character.
+ If the device does not support stop bits, the
+ value is the default stop bit value.
+
+ @retval RETURN_SUCCESS All attributes were set correctly on the
+ serial device.
+ @retval RETURN_UNSUPPORTED Not supported.
+ @retval RETURN_INVALID_PARAMETER One or more of the attributes has an
+ unsupported value.
+**/
+RETURN_STATUS
+EFIAPI
+Dbg2InitializePort (
+ IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo,
+ IN OUT UINT64 *BaudRate,
+ IN OUT UINT32 *ReceiveFifoDepth,
+ IN OUT EFI_PARITY_TYPE *Parity,
+ IN OUT UINT8 *DataBits,
+ IN OUT EFI_STOP_BITS_TYPE *StopBits
+ )
+{
+ // Not implemented.
+ return RETURN_UNSUPPORTED;
+}
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/AcpiFadtLibArm.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf
index 8fe3401..b4b899c 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/AcpiFadtLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf
@@ -8,7 +8,7 @@
[Defines]
INF_VERSION = 0x00010019
- BASE_NAME = AcpiFadtLibArm
+ BASE_NAME = AcpiFadtLib
FILE_GUID = 686FE5FE-B944-485F-8B1C-7D60E0056487
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
@@ -18,6 +18,13 @@
[Sources]
FadtGenerator.c
+ FadtGenerator.h
+
+[Sources.ARM, Sources.AARCH64]
+ Arm/ArmFadtGenerator.c
+
+[Sources.IA32, Sources.X64]
+ X64/X64FadtGenerator.c
[Packages]
MdePkg/MdePkg.dec
@@ -27,10 +34,3 @@
[LibraryClasses]
BaseLib
-
-[Pcd]
-
-[Protocols]
-
-[Guids]
-
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/Arm/ArmFadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/Arm/ArmFadtGenerator.c
new file mode 100644
index 0000000..2d2afe9
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/Arm/ArmFadtGenerator.c
@@ -0,0 +1,126 @@
+/** @file
+ ARM FADT Table Helpers
+
+ Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.5 Specification, Aug 29, 2022
+
+**/
+
+#include <Library/AcpiLib.h>
+#include <Library/DebugLib.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>
+#include "FadtGenerator.h"
+
+/** ARM Standard FADT Generator
+
+Requirements:
+ The following Configuration Manager Object(s) are required by
+ this Generator:
+ - EArmObjBootArchInfo
+*/
+
+/** 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 defines the FADT flag options for ARM Platforms.
+*/
+#define FADT_FLAGS (EFI_ACPI_6_5_HW_REDUCED_ACPI | \
+ EFI_ACPI_6_5_LOW_POWER_S0_IDLE_CAPABLE)
+
+/** Updates the Architecture specific information in the FADT Table.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in, out] Fadt Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object was not found.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
+ Manager is less than the Object size for the
+ requested object.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+ArmFadtBootArchInfoUpdate (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN OUT EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
+ )
+{
+ EFI_STATUS Status;
+ CM_ARM_BOOT_ARCH_INFO *BootArchInfo;
+
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (Fadt != NULL);
+
+ // Get the Boot Architecture flags from the Platform Configuration Manager
+ Status = GetEArmObjBootArchInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &BootArchInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get Boot Architecture flags. Status = %r\n",
+ Status
+ ));
+ return Status;
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "FADT BootArchFlag = 0x%x\n",
+ BootArchInfo->BootArchFlags
+ ));
+
+ Fadt->ArmBootArch = BootArchInfo->BootArchFlags;
+
+ return Status;
+}
+
+/** Updates the Architecture specific information in the FADT Table.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in, out] Fadt Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object was 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
+FadtArchUpdate (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN OUT EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
+ )
+{
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (Fadt != NULL);
+
+ Fadt->Flags = FADT_FLAGS;
+
+ return ArmFadtBootArchInfoUpdate (CfgMgrProtocol, Fadt);
+}
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.c
index 57aaaf8..3ba3fc2 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.c
@@ -19,22 +19,17 @@
#include <ConfigurationManagerHelper.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
+#include "FadtGenerator.h"
-/** ARM standard FADT Generator
+/** Standard FADT Generator
Requirements:
The following Configuration Manager Object(s) are required by
this Generator:
- - EArmObjPowerManagementProfileInfo
- - EArmObjBootArchInfo
- - EArmObjHypervisorVendorIdentity (OPTIONAL)
+ - EArchCommonObjPowerManagementProfileInfo
+ - EArchCommonObjHypervisorVendorIdentity (OPTIONAL)
*/
-/** This macro defines the FADT flag options for ARM Platforms.
-*/
-#define FADT_FLAGS (EFI_ACPI_6_5_HW_REDUCED_ACPI | \
- EFI_ACPI_6_5_LOW_POWER_S0_IDLE_CAPABLE)
-
/** This macro defines the valid mask for the FADT flag option
if HW_REDUCED_ACPI flag in the table is set.
@@ -159,13 +154,13 @@ EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
// UINT8 Reserved1
0,
// UINT32 Flags
- FADT_FLAGS,
+ 0,
// EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE ResetReg
NULL_GAS,
// UINT8 ResetValue
0,
// UINT16 ArmBootArch
- EFI_ACPI_6_5_ARM_PSCI_COMPLIANT, // {Template}: ARM Boot Architecture Flags
+ 0, // {Template}: ARM Boot Architecture Flags
// UINT8 MinorRevision
EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION, // {Template}
// UINT64 XFirmwareCtrl
@@ -202,36 +197,27 @@ EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = {
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
+ EObjNameSpaceArchCommon,
+ EArchCommonObjPowerManagementProfileInfo,
+ CM_ARCH_COMMON_POWER_MANAGEMENT_PROFILE_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
+ EObjNameSpaceArchCommon,
+ EArchCommonObjHypervisorVendorIdentity,
+ CM_ARCH_COMMON_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
+ EObjNameSpaceArchCommon,
+ EArchCommonObjFixedFeatureFlags,
+ CM_ARCH_COMMON_FIXED_FEATURE_FLAGS
);
/** Update the Power Management Profile information in the FADT Table.
@@ -253,13 +239,13 @@ FadtAddPmProfileInfo (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol
)
{
- EFI_STATUS Status;
- CM_ARM_POWER_MANAGEMENT_PROFILE_INFO *PmProfile;
+ EFI_STATUS Status;
+ CM_ARCH_COMMON_POWER_MANAGEMENT_PROFILE_INFO *PmProfile;
ASSERT (CfgMgrProtocol != NULL);
// Get the Power Management Profile from the Platform Configuration Manager
- Status = GetEArmObjPowerManagementProfileInfo (
+ Status = GetEArchCommonObjPowerManagementProfileInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
&PmProfile,
@@ -287,58 +273,6 @@ error_handler:
return Status;
}
-/** 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.
- @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
- Manager is less than the Object size for the
- requested object.
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-FadtAddBootArchInfo (
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol
- )
-{
- 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
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: FADT: Failed to get Boot Architecture flags. Status = %r\n",
- Status
- ));
- goto error_handler;
- }
-
- DEBUG ((
- DEBUG_INFO,
- "FADT BootArchFlag = 0x%x\n",
- BootArchInfo->BootArchFlags
- ));
-
- AcpiFadt.ArmBootArch = BootArchInfo->BootArchFlags;
-
-error_handler:
- return Status;
-}
-
/** Update the Hypervisor Vendor ID in the FADT Table.
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
@@ -358,13 +292,13 @@ FadtAddHypervisorVendorId (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol
)
{
- EFI_STATUS Status;
- CM_ARM_HYPERVISOR_VENDOR_ID *HypervisorVendorInfo;
+ EFI_STATUS Status;
+ CM_ARCH_COMMON_HYPERVISOR_VENDOR_ID *HypervisorVendorInfo;
ASSERT (CfgMgrProtocol != NULL);
// Get the Hypervisor Vendor ID from the Platform Configuration Manager
- Status = GetEArmObjHypervisorVendorIdentity (
+ Status = GetEArchCommonObjHypervisorVendorIdentity (
CfgMgrProtocol,
CM_NULL_TOKEN,
&HypervisorVendorInfo,
@@ -391,7 +325,7 @@ FadtAddHypervisorVendorId (
DEBUG ((
DEBUG_INFO,
- "FADT: EArmObjHypervisorVendorIdentity = 0x%lx\n",
+ "FADT: EArchCommonObjHypervisorVendorIdentity = 0x%lx\n",
HypervisorVendorInfo->HypervisorVendorId
));
@@ -420,13 +354,13 @@ FadtAddFixedFeatureFlags (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol
)
{
- EFI_STATUS Status;
- CM_ARM_FIXED_FEATURE_FLAGS *FixedFeatureFlags;
+ EFI_STATUS Status;
+ CM_ARCH_COMMON_FIXED_FEATURE_FLAGS *FixedFeatureFlags;
ASSERT (CfgMgrProtocol != NULL);
// Get the Fixed feature flags from the Platform Configuration Manager
- Status = GetEArmObjFixedFeatureFlags (
+ Status = GetEArchCommonObjFixedFeatureFlags (
CfgMgrProtocol,
CM_NULL_TOKEN,
&FixedFeatureFlags,
@@ -453,7 +387,7 @@ FadtAddFixedFeatureFlags (
DEBUG ((
DEBUG_INFO,
- "FADT: EArmObjFixedFeatureFlags = 0x%x\n",
+ "FADT: EArchCommonObjFixedFeatureFlags = 0x%x\n",
FixedFeatureFlags->Flags
));
@@ -577,12 +511,6 @@ BuildFadtTable (
goto error_handler;
}
- // Update BootArch Info
- Status = FadtAddBootArchInfo (CfgMgrProtocol);
- if (EFI_ERROR (Status)) {
- goto error_handler;
- }
-
// Add the Hypervisor Vendor Id if present
// Note if no hypervisor is present the zero bytes
// will be placed in this field.
@@ -623,6 +551,12 @@ BuildFadtTable (
}
}
+ // Update Arch specific Info
+ Status = FadtArchUpdate (CfgMgrProtocol, &AcpiFadt);
+ if (EFI_ERROR (Status)) {
+ goto error_handler;
+ }
+
*Table = (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiFadt;
error_handler:
return Status;
@@ -648,7 +582,7 @@ ACPI_TABLE_GENERATOR FadtGenerator = {
// Minimum supported ACPI Table Revision
EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
// Creator ID
- TABLE_GENERATOR_CREATOR_ID_ARM,
+ TABLE_GENERATOR_CREATOR_ID,
// Creator Revision
FADT_GENERATOR_REVISION,
// Build Table function
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.h b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.h
new file mode 100644
index 0000000..08ac59e
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.h
@@ -0,0 +1,35 @@
+/** @file
+ FADT Table Generator
+
+ Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.5 Specification, Aug 29, 2022
+
+**/
+
+#ifndef FADT_GENERATOR_H_
+#define FADT_GENERATOR_H_
+
+/** Updates the Architecture specific information in the FADT Table.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in, out] Fadt Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object was 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
+FadtArchUpdate (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN OUT EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
+ );
+
+#endif // FADT_GENERATOR_H_
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/X64/X64FadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/X64/X64FadtGenerator.c
new file mode 100644
index 0000000..1138941
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/X64/X64FadtGenerator.c
@@ -0,0 +1,382 @@
+/** @file
+ X64 FADT Table Helpers
+
+ Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.5 Specification, Aug 29, 2022
+
+**/
+
+#include <X64NameSpaceObjects.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/AcpiLib.h>
+#include <Library/DebugLib.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>
+#include "FadtGenerator.h"
+
+/** This macro expands to a function that retrieves the
+ SCI interrupt information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceX64,
+ EX64ObjFadtSciInterrupt,
+ CM_X64_FADT_SCI_INTERRUPT
+ );
+
+/** This macro expands to a function that retrieves the
+ SCI command information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceX64,
+ EX64ObjFadtSciCmdInfo,
+ CM_X64_FADT_SCI_CMD_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ legacy power management information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceX64,
+ EX64ObjFadtPmBlockInfo,
+ CM_X64_FADT_PM_BLOCK_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ legacy GPE block information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceX64,
+ EX64ObjFadtGpeBlockInfo,
+ CM_X64_FADT_GPE_BLOCK_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ legacy level2 latency, level 3 latency, RTC information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceX64,
+ EX64ObjFadtMiscInfo,
+ CM_X64_FADT_MISC_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ 64-bit power management information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceX64,
+ EX64ObjFadtXpmBlockInfo,
+ CM_X64_FADT_X_PM_BLOCK_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ 64-bit GPE block information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceX64,
+ EX64ObjFadtXgpeBlockInfo,
+ CM_X64_FADT_X_GPE_BLOCK_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ sleep block information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceX64,
+ EX64ObjFadtSleepBlockInfo,
+ CM_X64_FADT_SLEEP_BLOCK_INFO
+ );
+
+/** This macro expands to a function that retrieves the
+ reset block information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceX64,
+ EX64ObjFadtResetBlockInfo,
+ CM_X64_FADT_RESET_BLOCK_INFO
+ );
+
+/** Updates the Architecture specific information in the FADT Table.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in, out] Fadt Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object was 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
+FadtArchUpdate (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN OUT EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
+ )
+{
+ EFI_STATUS Status;
+ CM_X64_FADT_SCI_INTERRUPT *SciInterrupt;
+ CM_X64_FADT_SCI_CMD_INFO *SciCmdinfo;
+ CM_X64_FADT_PM_BLOCK_INFO *PmBlockInfo;
+ CM_X64_FADT_GPE_BLOCK_INFO *GpeBlockInfo;
+ CM_X64_FADT_X_PM_BLOCK_INFO *XpmBlockInfo;
+ CM_X64_FADT_X_GPE_BLOCK_INFO *XgpeBlockInfo;
+ CM_X64_FADT_SLEEP_BLOCK_INFO *SleepBlockInfo;
+ CM_X64_FADT_RESET_BLOCK_INFO *ResetBlockInfo;
+ CM_X64_FADT_MISC_INFO *FadtMiscInfo;
+
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (Fadt != NULL);
+
+ // Get the SCI interrupt from the Platform Configuration Manager
+ Status = GetEX64ObjFadtSciInterrupt (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &SciInterrupt,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get SCI Interrupt information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ Fadt->SciInt = SciInterrupt->SciInterrupt;
+ }
+
+ // Get the SCI CMD information from the Platform Configuration Manager
+ Status = GetEX64ObjFadtSciCmdInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &SciCmdinfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get SCI CMD information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ Fadt->SmiCmd = SciCmdinfo->SciCmd;
+ Fadt->AcpiEnable = SciCmdinfo->AcpiEnable;
+ Fadt->AcpiDisable = SciCmdinfo->AcpiDisable;
+ Fadt->S4BiosReq = SciCmdinfo->S4BiosReq;
+ Fadt->PstateCnt = SciCmdinfo->PstateCnt;
+ Fadt->CstCnt = SciCmdinfo->CstCnt;
+ }
+
+ // Get the SCI PM Block information from the Platform Configuration Manager
+ Status = GetEX64ObjFadtPmBlockInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &PmBlockInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get PM Block information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ Fadt->Pm1aEvtBlk = PmBlockInfo->Pm1aEvtBlk;
+ Fadt->Pm1bEvtBlk = PmBlockInfo->Pm1bEvtBlk;
+ Fadt->Pm1aCntBlk = PmBlockInfo->Pm1aCntBlk;
+ Fadt->Pm1bCntBlk = PmBlockInfo->Pm1bCntBlk;
+ Fadt->Pm2CntBlk = PmBlockInfo->Pm2CntBlk;
+ Fadt->PmTmrBlk = PmBlockInfo->PmTmrBlk;
+ Fadt->Pm1EvtLen = PmBlockInfo->Pm1EvtLen;
+ Fadt->Pm1CntLen = PmBlockInfo->Pm1CntLen;
+ Fadt->Pm2CntLen = PmBlockInfo->Pm2CntLen;
+ Fadt->PmTmrLen = PmBlockInfo->PmTmrLen;
+ }
+
+ // Get the SCI PM Block information from the Platform Configuration Manager
+ Status = GetEX64ObjFadtGpeBlockInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &GpeBlockInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get PM Block information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ Fadt->Gpe0Blk = GpeBlockInfo->Gpe0Blk;
+ Fadt->Gpe1Blk = GpeBlockInfo->Gpe1Blk;
+ Fadt->Gpe0BlkLen = GpeBlockInfo->Gpe0BlkLen;
+ Fadt->Gpe1BlkLen = GpeBlockInfo->Gpe1BlkLen;
+ Fadt->Gpe1Base = GpeBlockInfo->Gpe1Base;
+ }
+
+ // Get the 64-bit PM Block information from the Platform Configuration Manager
+ Status = GetEX64ObjFadtXpmBlockInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &XpmBlockInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get 64-bit PM Block information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ CopyMem (
+ &Fadt->XPm1aCntBlk,
+ &XpmBlockInfo->XPm1aCntBlk,
+ sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE)
+ );
+ CopyMem (
+ &Fadt->XPm1bEvtBlk,
+ &XpmBlockInfo->XPm1bEvtBlk,
+ sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE)
+ );
+ CopyMem (
+ &Fadt->XPm1aCntBlk,
+ &XpmBlockInfo->XPm1aCntBlk,
+ sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE)
+ );
+ CopyMem (
+ &Fadt->XPm1bCntBlk,
+ &XpmBlockInfo->XPm1bCntBlk,
+ sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE)
+ );
+ CopyMem (
+ &Fadt->XPm2CntBlk,
+ &XpmBlockInfo->XPm2CntBlk,
+ sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE)
+ );
+ CopyMem (
+ &Fadt->XPmTmrBlk,
+ &XpmBlockInfo->XPmTmrBlk,
+ sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE)
+ );
+ }
+
+ // Get the various platform information from the Platform Configuration manager
+ Status = GetEX64ObjFadtMiscInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &FadtMiscInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get various platform information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ Fadt->PLvl2Lat = FadtMiscInfo->PLvl2Lat;
+ Fadt->PLvl3Lat = FadtMiscInfo->PLvl3Lat;
+ Fadt->FlushSize = FadtMiscInfo->FlushSize;
+ Fadt->FlushStride = FadtMiscInfo->FlushStride;
+ Fadt->DutyOffset = FadtMiscInfo->DutyOffset;
+ Fadt->DutyWidth = FadtMiscInfo->DutyWidth;
+ Fadt->DayAlrm = FadtMiscInfo->DayAlrm;
+ Fadt->MonAlrm = FadtMiscInfo->MonAlrm;
+ Fadt->Century = FadtMiscInfo->Century;
+ }
+
+ // Get the 64-bit GPE Block information from the Platform Configuration Manager
+ Status = GetEX64ObjFadtXgpeBlockInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &XgpeBlockInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get 64-bit GPE Block information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ CopyMem (
+ &Fadt->XGpe0Blk,
+ &XgpeBlockInfo->XGpe0Blk,
+ sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE)
+ );
+ CopyMem (
+ &Fadt->XGpe1Blk,
+ &XgpeBlockInfo->XGpe1Blk,
+ sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE)
+ );
+ }
+
+ // Get the sleep Block information from the Platform Configuration Manager
+ Status = GetEX64ObjFadtSleepBlockInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &SleepBlockInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get Sleep Block information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ CopyMem (
+ &Fadt->SleepControlReg,
+ &SleepBlockInfo->SleepControlReg,
+ sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE)
+ );
+ CopyMem (
+ &Fadt->SleepStatusReg,
+ &SleepBlockInfo->SleepStatusReg,
+ sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE)
+ );
+ }
+
+ // Get the sleep Block information from the Platform Configuration Manager
+ Status = GetEX64ObjFadtResetBlockInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &ResetBlockInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: FADT: Failed to get Reset Block information." \
+ " Status = %r\n",
+ Status
+ ));
+ } else {
+ CopyMem (
+ &Fadt->ResetReg,
+ &ResetBlockInfo->ResetReg,
+ sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE)
+ );
+ Fadt->ResetValue = ResetBlockInfo->ResetValue;
+ }
+
+ return Status;
+}
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/AcpiMcfgLibArm.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiMcfgLib/AcpiMcfgLib.inf
index 1c7f085..36c343d 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/AcpiMcfgLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiMcfgLib/AcpiMcfgLib.inf
@@ -8,7 +8,7 @@
[Defines]
INF_VERSION = 0x00010019
- BASE_NAME = AcpiMcfgLibArm
+ BASE_NAME = AcpiMcfgLib
FILE_GUID = 8C9BDCB2-72D4-4F30-A12D-1145C3807FF7
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
@@ -27,10 +27,3 @@
[LibraryClasses]
BaseLib
-
-[Pcd]
-
-[Protocols]
-
-[Guids]
-
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiMcfgLib/McfgGenerator.c
index 004b794..79a2f59 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiMcfgLib/McfgGenerator.c
@@ -27,7 +27,7 @@
Requirements:
The following Configuration Manager Object(s) are required by
this Generator:
- - EArmObjPciConfigSpaceInfo
+ - EArchCommonObjPciConfigSpaceInfo
*/
#pragma pack(1)
@@ -51,9 +51,9 @@ typedef
/** Retrieve the PCI Configuration Space Information.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPciConfigSpaceInfo,
- CM_ARM_PCI_CONFIG_SPACE_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjPciConfigSpaceInfo,
+ CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO
);
/** Add the PCI Enhanced Configuration Space Information to the MCFG Table.
@@ -68,10 +68,10 @@ GET_OBJECT_LIST (
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 MCFG_TABLE *CONST Mcfg,
+ IN CONST UINT32 PciCfgSpaceOffset,
+ IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciCfgSpaceInfoList,
+ IN UINT32 PciCfgSpaceCount
)
{
MCFG_CFG_SPACE_ADDR *PciCfgSpace;
@@ -126,11 +126,11 @@ BuildMcfgTable (
OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
)
{
- EFI_STATUS Status;
- UINT32 TableSize;
- UINT32 ConfigurationSpaceCount;
- CM_ARM_PCI_CONFIG_SPACE_INFO *PciConfigSpaceInfoList;
- MCFG_TABLE *Mcfg;
+ EFI_STATUS Status;
+ UINT32 TableSize;
+ UINT32 ConfigurationSpaceCount;
+ CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciConfigSpaceInfoList;
+ MCFG_TABLE *Mcfg;
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
@@ -154,7 +154,7 @@ BuildMcfgTable (
}
*Table = NULL;
- Status = GetEArmObjPciConfigSpaceInfo (
+ Status = GetEArchCommonObjPciConfigSpaceInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
&PciConfigSpaceInfoList,
@@ -261,6 +261,7 @@ error_handler:
**/
STATIC
EFI_STATUS
+EFIAPI
FreeMcfgTableResources (
IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
@@ -305,7 +306,7 @@ ACPI_TABLE_GENERATOR McfgGenerator = {
// Minimum supported ACPI Table Revision
EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION,
// Creator ID
- TABLE_GENERATOR_CREATOR_ID_ARM,
+ TABLE_GENERATOR_CREATOR_ID,
// Creator Revision
MCFG_GENERATOR_REVISION,
// Build Table function
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/AcpiPcctLibArm.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/AcpiPcctLib.inf
index da54585..666bdca 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/AcpiPcctLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/AcpiPcctLib.inf
@@ -8,7 +8,7 @@
[Defines]
INF_VERSION = 0x0001001B
- BASE_NAME = AcpiPcctLibArm
+ BASE_NAME = AcpiPcctLib
FILE_GUID = 38FE945C-D6ED-4CD6-8D20-FCEF3260D15A
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/PcctGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/PcctGenerator.c
index 36caf4a..e362254 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/PcctGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/PcctGenerator.c
@@ -29,66 +29,66 @@
Requirements:
The following Configuration Manager Object(s) are required by
this Generator:
- - EArmObjPccSubspaceType0Info
- - EArmObjPccSubspaceType1Info
- - EArmObjPccSubspaceType2Info
- - EArmObjPccSubspaceType3Info
- - EArmObjPccSubspaceType4Info
- - EArmObjPccSubspaceType5Info
+ - EArchCommonObjPccSubspaceType0Info
+ - EArchCommonObjPccSubspaceType1Info
+ - EArchCommonObjPccSubspaceType2Info
+ - EArchCommonObjPccSubspaceType3Info
+ - EArchCommonObjPccSubspaceType4Info
+ - EArchCommonObjPccSubspaceType5Info
*/
/** This macro expands to a function that retrieves the PCC
Subspace of Type 0 Information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPccSubspaceType0Info,
- CM_ARM_PCC_SUBSPACE_TYPE0_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjPccSubspaceType0Info,
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO
);
/** This macro expands to a function that retrieves the PCC
Subspace of Type 1 Information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPccSubspaceType1Info,
- CM_ARM_PCC_SUBSPACE_TYPE1_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjPccSubspaceType1Info,
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE1_INFO
);
/** This macro expands to a function that retrieves the PCC
Subspace of Type 2 Information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPccSubspaceType2Info,
- CM_ARM_PCC_SUBSPACE_TYPE2_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjPccSubspaceType2Info,
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE2_INFO
);
/** This macro expands to a function that retrieves the PCC
Subspace of Type 3 Information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPccSubspaceType3Info,
- CM_ARM_PCC_SUBSPACE_TYPE3_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjPccSubspaceType3Info,
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE3_INFO
);
/** This macro expands to a function that retrieves the PCC
Subspace of Type 4 Information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPccSubspaceType4Info,
- CM_ARM_PCC_SUBSPACE_TYPE4_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjPccSubspaceType4Info,
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE4_INFO
);
/** This macro expands to a function that retrieves the PCC
Subspace of Type 5 Information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPccSubspaceType5Info,
- CM_ARM_PCC_SUBSPACE_TYPE5_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjPccSubspaceType5Info,
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE5_INFO
);
/** The Platform is capable of generating an interrupt
@@ -164,11 +164,12 @@ MappingTableFree (
}
}
-/** Add a new entry for CmArmPccSubspace at Index.
+/** Add a new entry for PccSubspace at Index.
@param [in] MappingTable The mapping table structure.
- @param [in] CmArmPccSubspace Pointer to a CM_ARM_PCC_SUBSPACE_TYPE[X]_INFO.
- @param [in] Index Index at which CmArmPccSubspace must be added.
+ @param [in] PccSubspace A pointer to
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE[X]_INFO.
+ @param [in] Index Index at which PccSubspace must be added.
This is the Subspace Id.
@retval EFI_SUCCESS Success.
@@ -180,13 +181,13 @@ EFI_STATUS
EFIAPI
MappingTableAdd (
IN MAPPING_TABLE *MappingTable,
- IN VOID *CmArmPccSubspace,
+ IN VOID *PccSubspace,
IN UINT32 Index
)
{
if ((MappingTable == NULL) ||
(MappingTable->Table == NULL) ||
- (CmArmPccSubspace == NULL))
+ (PccSubspace == NULL))
{
ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
return EFI_INVALID_PARAMETER;
@@ -200,14 +201,15 @@ MappingTableAdd (
}
// Just map the Pcc Subspace in the Table.
- MappingTable->Table[Index] = CmArmPccSubspace;
+ MappingTable->Table[Index] = PccSubspace;
return EFI_SUCCESS;
}
/** Parse the CmPccArray objects and add them to the MappingTable.
@param [in] MappingTable The mapping table structure.
- @param [in] CmPccArray Pointer to an array of CM_ARM_PCC_SUBSPACE_TYPE[X]_INFO.
+ @param [in] CmPccArray Pointer to an array of
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE[X]_INFO.
@param [in] CmPccCount Count of objects in CmPccArray.
@retval EFI_SUCCESS Success.
@@ -242,27 +244,27 @@ MapPccSubspaceId (
switch (GenericPcc->Type) {
case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_GENERIC:
- CmObjSize = sizeof (CM_ARM_PCC_SUBSPACE_TYPE0_INFO);
+ CmObjSize = sizeof (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO);
break;
case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_1_HW_REDUCED_COMMUNICATIONS:
- CmObjSize = sizeof (CM_ARM_PCC_SUBSPACE_TYPE1_INFO);
+ CmObjSize = sizeof (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE1_INFO);
break;
case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_2_HW_REDUCED_COMMUNICATIONS:
- CmObjSize = sizeof (CM_ARM_PCC_SUBSPACE_TYPE2_INFO);
+ CmObjSize = sizeof (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE2_INFO);
break;
case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_3_EXTENDED_PCC:
- CmObjSize = sizeof (CM_ARM_PCC_SUBSPACE_TYPE3_INFO);
+ CmObjSize = sizeof (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE3_INFO);
break;
case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC:
- CmObjSize = sizeof (CM_ARM_PCC_SUBSPACE_TYPE4_INFO);
+ CmObjSize = sizeof (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE4_INFO);
break;
case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_5_HW_REGISTERS_COMMUNICATIONS:
- CmObjSize = sizeof (CM_ARM_PCC_SUBSPACE_TYPE5_INFO);
+ CmObjSize = sizeof (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE5_INFO);
break;
default:
@@ -304,8 +306,8 @@ STATIC
EFI_STATUS
EFIAPI
AddSubspaceStructType0 (
- IN CM_ARM_PCC_SUBSPACE_TYPE0_INFO *PccCmObj,
- IN EFI_ACPI_6_4_PCCT_SUBSPACE_GENERIC *PccAcpi
+ IN CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO *PccCmObj,
+ IN EFI_ACPI_6_4_PCCT_SUBSPACE_GENERIC *PccAcpi
)
{
PCC_MAILBOX_REGISTER_INFO *Doorbell;
@@ -356,15 +358,15 @@ STATIC
EFI_STATUS
EFIAPI
AddSubspaceStructType1 (
- IN CM_ARM_PCC_SUBSPACE_TYPE1_INFO *PccCmObj,
+ IN CM_ARCH_COMMON_PCC_SUBSPACE_TYPE1_INFO *PccCmObj,
IN EFI_ACPI_6_4_PCCT_SUBSPACE_1_HW_REDUCED_COMMUNICATIONS *PccAcpi
)
{
- CM_ARM_PCC_SUBSPACE_TYPE0_INFO *GenericPccCmObj;
- PCC_MAILBOX_REGISTER_INFO *Doorbell;
- PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO *GenericPccCmObj;
+ PCC_MAILBOX_REGISTER_INFO *Doorbell;
+ PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
- GenericPccCmObj = (CM_ARM_PCC_SUBSPACE_TYPE0_INFO *)PccCmObj;
+ GenericPccCmObj = (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO *)PccCmObj;
if ((PccCmObj == NULL) ||
(GenericPccCmObj->Type != EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_1_HW_REDUCED_COMMUNICATIONS) ||
@@ -377,10 +379,12 @@ AddSubspaceStructType1 (
Doorbell = &GenericPccCmObj->DoorbellReg;
ChannelTiming = &GenericPccCmObj->ChannelTiming;
+ ASSERT ((PccCmObj->PlatIrq.Flags & ~MAX_UINT8) == 0);
+
PccAcpi->Type = GenericPccCmObj->Type;
PccAcpi->Length = sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_1_HW_REDUCED_COMMUNICATIONS);
PccAcpi->PlatformInterrupt = PccCmObj->PlatIrq.Interrupt;
- PccAcpi->PlatformInterruptFlags = PccCmObj->PlatIrq.Flags;
+ PccAcpi->PlatformInterruptFlags = (UINT8)PccCmObj->PlatIrq.Flags;
PccAcpi->Reserved = EFI_ACPI_RESERVED_BYTE;
PccAcpi->BaseAddress = GenericPccCmObj->BaseAddress;
PccAcpi->AddressLength = GenericPccCmObj->AddressLength;
@@ -416,16 +420,16 @@ STATIC
EFI_STATUS
EFIAPI
AddSubspaceStructType2 (
- IN CM_ARM_PCC_SUBSPACE_TYPE2_INFO *PccCmObj,
+ IN CM_ARCH_COMMON_PCC_SUBSPACE_TYPE2_INFO *PccCmObj,
IN EFI_ACPI_6_4_PCCT_SUBSPACE_2_HW_REDUCED_COMMUNICATIONS *PccAcpi
)
{
- CM_ARM_PCC_SUBSPACE_TYPE0_INFO *GenericPccCmObj;
- PCC_MAILBOX_REGISTER_INFO *Doorbell;
- PCC_MAILBOX_REGISTER_INFO *PlatIrqAck;
- PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO *GenericPccCmObj;
+ PCC_MAILBOX_REGISTER_INFO *Doorbell;
+ PCC_MAILBOX_REGISTER_INFO *PlatIrqAck;
+ PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
- GenericPccCmObj = (CM_ARM_PCC_SUBSPACE_TYPE0_INFO *)PccCmObj;
+ GenericPccCmObj = (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO *)PccCmObj;
if ((PccCmObj == NULL) ||
(GenericPccCmObj->Type != EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_2_HW_REDUCED_COMMUNICATIONS) ||
@@ -439,10 +443,12 @@ AddSubspaceStructType2 (
PlatIrqAck = &PccCmObj->PlatIrqAckReg;
ChannelTiming = &GenericPccCmObj->ChannelTiming;
+ ASSERT ((PccCmObj->PlatIrq.Flags & ~MAX_UINT8) == 0);
+
PccAcpi->Type = GenericPccCmObj->Type;
PccAcpi->Length = sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_2_HW_REDUCED_COMMUNICATIONS);
PccAcpi->PlatformInterrupt = PccCmObj->PlatIrq.Interrupt;
- PccAcpi->PlatformInterruptFlags = PccCmObj->PlatIrq.Flags;
+ PccAcpi->PlatformInterruptFlags = (UINT8)PccCmObj->PlatIrq.Flags;
PccAcpi->BaseAddress = GenericPccCmObj->BaseAddress;
PccAcpi->Reserved = EFI_ACPI_RESERVED_BYTE;
PccAcpi->BaseAddress = GenericPccCmObj->BaseAddress;
@@ -487,19 +493,19 @@ STATIC
EFI_STATUS
EFIAPI
AddSubspaceStructType34 (
- IN CM_ARM_PCC_SUBSPACE_TYPE3_INFO *PccCmObj,
+ IN CM_ARCH_COMMON_PCC_SUBSPACE_TYPE3_INFO *PccCmObj,
IN EFI_ACPI_6_4_PCCT_SUBSPACE_3_EXTENDED_PCC *PccAcpi
)
{
- CM_ARM_PCC_SUBSPACE_TYPE0_INFO *GenericPccCmObj;
- PCC_MAILBOX_REGISTER_INFO *Doorbell;
- PCC_MAILBOX_REGISTER_INFO *PlatIrqAck;
- PCC_MAILBOX_REGISTER_INFO *CmdCompleteCheck;
- PCC_MAILBOX_REGISTER_INFO *CmdCompleteUpdate;
- PCC_MAILBOX_REGISTER_INFO *ErrorStatus;
- PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO *GenericPccCmObj;
+ PCC_MAILBOX_REGISTER_INFO *Doorbell;
+ PCC_MAILBOX_REGISTER_INFO *PlatIrqAck;
+ PCC_MAILBOX_REGISTER_INFO *CmdCompleteCheck;
+ PCC_MAILBOX_REGISTER_INFO *CmdCompleteUpdate;
+ PCC_MAILBOX_REGISTER_INFO *ErrorStatus;
+ PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
- GenericPccCmObj = (CM_ARM_PCC_SUBSPACE_TYPE0_INFO *)PccCmObj;
+ GenericPccCmObj = (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO *)PccCmObj;
if ((PccCmObj == NULL) ||
((GenericPccCmObj->Type != EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_3_EXTENDED_PCC) &&
@@ -517,13 +523,16 @@ AddSubspaceStructType34 (
ErrorStatus = &PccCmObj->ErrorStatusReg;
ChannelTiming = &GenericPccCmObj->ChannelTiming;
+ ASSERT ((PccCmObj->PlatIrq.Flags & ~MAX_UINT8) == 0);
+ ASSERT ((GenericPccCmObj->AddressLength & ~MAX_UINT32) == 0);
+
PccAcpi->Type = GenericPccCmObj->Type;
PccAcpi->Length = sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_3_EXTENDED_PCC);
PccAcpi->PlatformInterrupt = PccCmObj->PlatIrq.Interrupt;
- PccAcpi->PlatformInterruptFlags = PccCmObj->PlatIrq.Flags;
+ PccAcpi->PlatformInterruptFlags = (UINT8)PccCmObj->PlatIrq.Flags;
PccAcpi->Reserved = EFI_ACPI_RESERVED_BYTE;
PccAcpi->BaseAddress = GenericPccCmObj->BaseAddress;
- PccAcpi->AddressLength = GenericPccCmObj->AddressLength;
+ PccAcpi->AddressLength = (UINT32)GenericPccCmObj->AddressLength;
CopyMem (
&PccAcpi->DoorbellRegister,
@@ -599,17 +608,17 @@ STATIC
EFI_STATUS
EFIAPI
AddSubspaceStructType5 (
- IN CM_ARM_PCC_SUBSPACE_TYPE5_INFO *PccCmObj,
+ IN CM_ARCH_COMMON_PCC_SUBSPACE_TYPE5_INFO *PccCmObj,
IN EFI_ACPI_6_4_PCCT_SUBSPACE_5_HW_REGISTERS_COMMUNICATIONS *PccAcpi
)
{
- CM_ARM_PCC_SUBSPACE_TYPE0_INFO *GenericPccCmObj;
- PCC_MAILBOX_REGISTER_INFO *Doorbell;
- PCC_MAILBOX_REGISTER_INFO *CmdCompleteCheck;
- PCC_MAILBOX_REGISTER_INFO *ErrorStatus;
- PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO *GenericPccCmObj;
+ PCC_MAILBOX_REGISTER_INFO *Doorbell;
+ PCC_MAILBOX_REGISTER_INFO *CmdCompleteCheck;
+ PCC_MAILBOX_REGISTER_INFO *ErrorStatus;
+ PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
- GenericPccCmObj = (CM_ARM_PCC_SUBSPACE_TYPE0_INFO *)PccCmObj;
+ GenericPccCmObj = (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO *)PccCmObj;
if ((PccCmObj == NULL) ||
(GenericPccCmObj->Type != EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_5_HW_REGISTERS_COMMUNICATIONS) ||
@@ -705,7 +714,7 @@ PopulatePcctTable (
switch (((PCC_SUBSPACE_GENERIC_INFO *)CurrentPccSubspace)->Type) {
case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_GENERIC:
Status = AddSubspaceStructType0 (
- (CM_ARM_PCC_SUBSPACE_TYPE0_INFO *)CurrentPccSubspace,
+ (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO *)CurrentPccSubspace,
(EFI_ACPI_6_4_PCCT_SUBSPACE_GENERIC *)PccBuffer
);
@@ -714,7 +723,7 @@ PopulatePcctTable (
case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_1_HW_REDUCED_COMMUNICATIONS:
Status = AddSubspaceStructType1 (
- (CM_ARM_PCC_SUBSPACE_TYPE1_INFO *)CurrentPccSubspace,
+ (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE1_INFO *)CurrentPccSubspace,
(EFI_ACPI_6_4_PCCT_SUBSPACE_1_HW_REDUCED_COMMUNICATIONS *)PccBuffer
);
@@ -723,7 +732,7 @@ PopulatePcctTable (
case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_2_HW_REDUCED_COMMUNICATIONS:
Status = AddSubspaceStructType2 (
- (CM_ARM_PCC_SUBSPACE_TYPE2_INFO *)CurrentPccSubspace,
+ (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE2_INFO *)CurrentPccSubspace,
(EFI_ACPI_6_4_PCCT_SUBSPACE_2_HW_REDUCED_COMMUNICATIONS *)PccBuffer
);
@@ -732,7 +741,7 @@ PopulatePcctTable (
case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_3_EXTENDED_PCC:
Status = AddSubspaceStructType34 (
- (CM_ARM_PCC_SUBSPACE_TYPE3_INFO *)CurrentPccSubspace,
+ (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE3_INFO *)CurrentPccSubspace,
(EFI_ACPI_6_4_PCCT_SUBSPACE_3_EXTENDED_PCC *)PccBuffer
);
@@ -741,7 +750,7 @@ PopulatePcctTable (
case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC:
Status = AddSubspaceStructType34 (
- (CM_ARM_PCC_SUBSPACE_TYPE4_INFO *)CurrentPccSubspace,
+ (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE4_INFO *)CurrentPccSubspace,
(EFI_ACPI_6_4_PCCT_SUBSPACE_4_EXTENDED_PCC *)PccBuffer
);
@@ -750,7 +759,7 @@ PopulatePcctTable (
case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_5_HW_REGISTERS_COMMUNICATIONS:
Status = AddSubspaceStructType5 (
- (CM_ARM_PCC_SUBSPACE_TYPE5_INFO *)CurrentPccSubspace,
+ (CM_ARCH_COMMON_PCC_SUBSPACE_TYPE5_INFO *)CurrentPccSubspace,
(EFI_ACPI_6_4_PCCT_SUBSPACE_5_HW_REGISTERS_COMMUNICATIONS *)PccBuffer
);
@@ -822,18 +831,18 @@ BuildPcctTable (
MAPPING_TABLE *MappingTable;
UINT32 MappingTableCount;
- CM_ARM_PCC_SUBSPACE_TYPE0_INFO *PccType0;
- UINT32 PccType0Count;
- CM_ARM_PCC_SUBSPACE_TYPE1_INFO *PccType1;
- UINT32 PccType1Count;
- CM_ARM_PCC_SUBSPACE_TYPE2_INFO *PccType2;
- UINT32 PccType2Count;
- CM_ARM_PCC_SUBSPACE_TYPE3_INFO *PccType3;
- UINT32 PccType3Count;
- CM_ARM_PCC_SUBSPACE_TYPE4_INFO *PccType4;
- UINT32 PccType4Count;
- CM_ARM_PCC_SUBSPACE_TYPE5_INFO *PccType5;
- UINT32 PccType5Count;
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE0_INFO *PccType0;
+ UINT32 PccType0Count;
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE1_INFO *PccType1;
+ UINT32 PccType1Count;
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE2_INFO *PccType2;
+ UINT32 PccType2Count;
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE3_INFO *PccType3;
+ UINT32 PccType3Count;
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE4_INFO *PccType4;
+ UINT32 PccType4Count;
+ CM_ARCH_COMMON_PCC_SUBSPACE_TYPE5_INFO *PccType5;
+ UINT32 PccType5Count;
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
@@ -863,7 +872,7 @@ BuildPcctTable (
// First get all the Pcc Subpace CmObj of type X.
- Status = GetEArmObjPccSubspaceType0Info (
+ Status = GetEArchCommonObjPccSubspaceType0Info (
CfgMgrProtocol,
CM_NULL_TOKEN,
&PccType0,
@@ -874,7 +883,7 @@ BuildPcctTable (
goto error_handler;
}
- Status = GetEArmObjPccSubspaceType1Info (
+ Status = GetEArchCommonObjPccSubspaceType1Info (
CfgMgrProtocol,
CM_NULL_TOKEN,
&PccType1,
@@ -885,7 +894,7 @@ BuildPcctTable (
goto error_handler;
}
- Status = GetEArmObjPccSubspaceType2Info (
+ Status = GetEArchCommonObjPccSubspaceType2Info (
CfgMgrProtocol,
CM_NULL_TOKEN,
&PccType2,
@@ -896,7 +905,7 @@ BuildPcctTable (
goto error_handler;
}
- Status = GetEArmObjPccSubspaceType3Info (
+ Status = GetEArchCommonObjPccSubspaceType3Info (
CfgMgrProtocol,
CM_NULL_TOKEN,
&PccType3,
@@ -907,7 +916,7 @@ BuildPcctTable (
goto error_handler;
}
- Status = GetEArmObjPccSubspaceType4Info (
+ Status = GetEArchCommonObjPccSubspaceType4Info (
CfgMgrProtocol,
CM_NULL_TOKEN,
&PccType4,
@@ -918,7 +927,7 @@ BuildPcctTable (
goto error_handler;
}
- Status = GetEArmObjPccSubspaceType5Info (
+ Status = GetEArchCommonObjPccSubspaceType5Info (
CfgMgrProtocol,
CM_NULL_TOKEN,
&PccType5,
@@ -1066,6 +1075,7 @@ error_handler:
**/
STATIC
EFI_STATUS
+EFIAPI
FreePcctTableResources (
IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
@@ -1111,7 +1121,7 @@ ACPI_PCCT_GENERATOR PcctGenerator = {
// Minimum ACPI Table Revision supported by this Generator
EFI_ACPI_6_4_PLATFORM_COMMUNICATION_CHANNEL_TABLE_REVISION,
// Creator ID
- TABLE_GENERATOR_CREATOR_ID_ARM,
+ TABLE_GENERATOR_CREATOR_ID,
// Creator Revision
PCCT_GENERATOR_REVISION,
// Build Table function
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/PcctGenerator.h b/DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/PcctGenerator.h
index 0631a1f..b99bf91 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/PcctGenerator.h
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiPcctLib/PcctGenerator.h
@@ -19,7 +19,7 @@
*/
typedef struct MappingTable {
/// Mapping table for Subspace Ids.
- /// Subspace ID/Index <-> CM_ARM_PCC_SUBSPACE_TYPE[X]_INFO pointer
+ /// Subspace ID/Index <-> CM_ARCH_COMMON_PCC_SUBSPACE_TYPE[X]_INFO pointer
VOID **Table;
/// Number of entries in the Table.
@@ -34,7 +34,8 @@ typedef struct AcpiPcctGenerator {
// Private fields are defined from here.
- /// Table to map: Subspace ID/Index <-> CM_ARM_PCC_SUBSPACE_TYPE[X]_INFO pointer
+ /// Table to map:
+ /// Subspace ID/Index <-> CM_ARCH_COMMON_PCC_SUBSPACE_TYPE[X]_INFO pointer
MAPPING_TABLE MappingTable;
} ACPI_PCCT_GENERATOR;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiPpttLib/AcpiPpttLib.inf
index 2c7d195..a1c91a6 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiPpttLib/AcpiPpttLib.inf
@@ -8,7 +8,7 @@
[Defines]
INF_VERSION = 0x0001001B
- BASE_NAME = AcpiPpttLibArm
+ BASE_NAME = AcpiPpttLib
FILE_GUID = FA102D52-5A92-4F95-A097-1D53F9CF5959
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiPpttLib/PpttGenerator.c
index 78fa63f..8e2e1f6 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiPpttLib/PpttGenerator.c
@@ -32,9 +32,9 @@
Requirements:
The following Configuration Manager Object(s) are used by this Generator:
- - EArmObjProcHierarchyInfo (REQUIRED)
- - EArmObjCacheInfo
- - EArmObjCmRef
+ - EArchCommonObjProcHierarchyInfo (REQUIRED)
+ - EArchCommonObjCacheInfo
+ - EArchCommonObjCmRef
- EArmObjGicCInfo (REQUIRED)
*/
@@ -43,9 +43,9 @@
information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjProcHierarchyInfo,
- CM_ARM_PROC_HIERARCHY_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjProcHierarchyInfo,
+ CM_ARCH_COMMON_PROC_HIERARCHY_INFO
);
/**
@@ -53,9 +53,9 @@ GET_OBJECT_LIST (
from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjCacheInfo,
- CM_ARM_CACHE_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjCacheInfo,
+ CM_ARCH_COMMON_CACHE_INFO
);
/**
@@ -63,9 +63,9 @@ GET_OBJECT_LIST (
reference information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjCmRef,
- CM_ARM_OBJ_REF
+ EObjNameSpaceArchCommon,
+ EArchCommonObjCmRef,
+ CM_ARCH_COMMON_OBJ_REF
);
/**
@@ -90,7 +90,7 @@ GET_OBJECT_LIST (
STATIC
UINT32
GetProcHierarchyNodeSize (
- IN CONST CM_ARM_PROC_HIERARCHY_INFO *Node
+ IN CONST CM_ARCH_COMMON_PROC_HIERARCHY_INFO *Node
)
{
ASSERT (Node != NULL);
@@ -107,7 +107,7 @@ GetProcHierarchyNodeSize (
GET_SIZE_OF_PPTT_STRUCTS (
ProcHierarchyNodes,
GetProcHierarchyNodeSize (NodesToIndex),
- CM_ARM_PROC_HIERARCHY_INFO
+ CM_ARCH_COMMON_PROC_HIERARCHY_INFO
);
/**
@@ -117,7 +117,7 @@ GET_SIZE_OF_PPTT_STRUCTS (
GET_SIZE_OF_PPTT_STRUCTS (
CacheTypeStructs,
sizeof (EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE),
- CM_ARM_CACHE_INFO
+ CM_ARCH_COMMON_CACHE_INFO
);
/**
@@ -264,7 +264,7 @@ DetectCyclesInTopology (
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
+ @param [in] PrivResArrayToken Reference Token for the CM_ARCH_COMMON_OBJ_REF
array describing node's private resources.
@retval EFI_SUCCESS Array updated successfully.
@@ -281,10 +281,10 @@ AddPrivateResources (
IN CONST CM_OBJECT_TOKEN PrivResArrayToken
)
{
- EFI_STATUS Status;
- CM_ARM_OBJ_REF *CmObjRefs;
- UINT32 CmObjRefCount;
- PPTT_NODE_INDEXER *PpttNodeFound;
+ EFI_STATUS Status;
+ CM_ARCH_COMMON_OBJ_REF *CmObjRefs;
+ UINT32 CmObjRefCount;
+ PPTT_NODE_INDEXER *PpttNodeFound;
ASSERT (
(Generator != NULL) &&
@@ -308,7 +308,7 @@ AddPrivateResources (
CmObjRefCount = 0;
// Get the CM Object References
- Status = GetEArmObjCmRef (
+ Status = GetEArchCommonObjCmRef (
CfgMgrProtocol,
PrivResArrayToken,
&CmObjRefs,
@@ -397,22 +397,24 @@ AddPrivateResources (
@param [in] Index2 Index of Object2 to be displayed for debugging
purposes.
- @retval TRUE Object1 and Object2 have the same GicCToken.
- @retval FALSE Object1 and Object2 have different GicCTokens.
+ @retval TRUE Object1 and Object2 have the same
+ AcpiIdObjectToken.
+ @retval FALSE Object1 and Object2 have different
+ AcpiIdObjectTokens.
**/
BOOLEAN
EFIAPI
-IsGicCTokenEqual (
+IsAcpiIdObjectTokenEqual (
IN CONST VOID *Object1,
IN CONST VOID *Object2,
IN UINTN Index1,
IN UINTN Index2
)
{
- PPTT_NODE_INDEXER *IndexedObject1;
- PPTT_NODE_INDEXER *IndexedObject2;
- CM_ARM_PROC_HIERARCHY_INFO *ProcNode1;
- CM_ARM_PROC_HIERARCHY_INFO *ProcNode2;
+ PPTT_NODE_INDEXER *IndexedObject1;
+ PPTT_NODE_INDEXER *IndexedObject2;
+ CM_ARCH_COMMON_PROC_HIERARCHY_INFO *ProcNode1;
+ CM_ARCH_COMMON_PROC_HIERARCHY_INFO *ProcNode2;
ASSERT (
(Object1 != NULL) &&
@@ -421,23 +423,23 @@ IsGicCTokenEqual (
IndexedObject1 = (PPTT_NODE_INDEXER *)Object1;
IndexedObject2 = (PPTT_NODE_INDEXER *)Object2;
- ProcNode1 = (CM_ARM_PROC_HIERARCHY_INFO *)IndexedObject1->Object;
- ProcNode2 = (CM_ARM_PROC_HIERARCHY_INFO *)IndexedObject2->Object;
+ ProcNode1 = (CM_ARCH_COMMON_PROC_HIERARCHY_INFO *)IndexedObject1->Object;
+ ProcNode2 = (CM_ARCH_COMMON_PROC_HIERARCHY_INFO *)IndexedObject2->Object;
if (IS_ACPI_PROC_ID_VALID (ProcNode1) &&
IS_ACPI_PROC_ID_VALID (ProcNode2) &&
- (ProcNode1->GicCToken != CM_NULL_TOKEN) &&
- (ProcNode2->GicCToken != CM_NULL_TOKEN) &&
- (ProcNode1->GicCToken == ProcNode2->GicCToken))
+ (ProcNode1->AcpiIdObjectToken != CM_NULL_TOKEN) &&
+ (ProcNode2->AcpiIdObjectToken != CM_NULL_TOKEN) &&
+ (ProcNode1->AcpiIdObjectToken == ProcNode2->AcpiIdObjectToken))
{
DEBUG ((
DEBUG_ERROR,
"ERROR: PPTT: Two Processor Hierarchy Info objects (%d and %d) map to " \
- "the same GICC Info object. ACPI Processor IDs are not unique. " \
- "GicCToken = %p.\n",
+ "the same ACPI ID reference object. ACPI Processor IDs are not unique. " \
+ "AcpiIdObjectToken = %p.\n",
Index1,
Index2,
- ProcNode1->GicCToken
+ ProcNode1->AcpiIdObjectToken
));
return TRUE;
}
@@ -474,14 +476,14 @@ AddProcHierarchyNodes (
EFI_STATUS Status;
EFI_ACPI_6_4_PPTT_STRUCTURE_PROCESSOR *ProcStruct;
UINT32 *PrivateResources;
- BOOLEAN IsGicCTokenDuplicated;
+ BOOLEAN IsAcpiIdObjectTokenDuplicated;
CM_ARM_GICC_INFO *GicCInfoList;
UINT32 GicCInfoCount;
UINT32 UniqueGicCRefCount;
- PPTT_NODE_INDEXER *PpttNodeFound;
- CM_ARM_PROC_HIERARCHY_INFO *ProcInfoNode;
+ PPTT_NODE_INDEXER *PpttNodeFound;
+ CM_ARCH_COMMON_PROC_HIERARCHY_INFO *ProcInfoNode;
PPTT_NODE_INDEXER *ProcNodeIterator;
UINT32 NodeCount;
@@ -500,22 +502,22 @@ AddProcHierarchyNodes (
NodeCount = Generator->ProcHierarchyNodeCount;
// Check if every GICC Object is referenced by onlu one Proc Node
- IsGicCTokenDuplicated = FindDuplicateValue (
- ProcNodeIterator,
- NodeCount,
- sizeof (PPTT_NODE_INDEXER),
- IsGicCTokenEqual
- );
+ IsAcpiIdObjectTokenDuplicated = FindDuplicateValue (
+ ProcNodeIterator,
+ NodeCount,
+ sizeof (PPTT_NODE_INDEXER),
+ IsAcpiIdObjectTokenEqual
+ );
// Duplicate GIC CPU Interface Token was found so two PPTT Processor Hierarchy
// Nodes map to the same MADT GICC structure
- if (IsGicCTokenDuplicated) {
+ if (IsAcpiIdObjectTokenDuplicated) {
return EFI_INVALID_PARAMETER;
}
UniqueGicCRefCount = 0;
while (NodeCount-- != 0) {
- ProcInfoNode = (CM_ARM_PROC_HIERARCHY_INFO *)ProcNodeIterator->Object;
+ ProcInfoNode = (CM_ARCH_COMMON_PROC_HIERARCHY_INFO *)ProcNodeIterator->Object;
// Check if the private resource count is within the size limit
// imposed on the Processor Hierarchy node by the specification.
@@ -575,7 +577,7 @@ AddProcHierarchyNodes (
// Test if the reference is to a 'leaf' node
if (IS_PROC_NODE_LEAF (
- ((CM_ARM_PROC_HIERARCHY_INFO *)PpttNodeFound->Object)
+ ((CM_ARCH_COMMON_PROC_HIERARCHY_INFO *)PpttNodeFound->Object)
))
{
Status = EFI_INVALID_PARAMETER;
@@ -602,14 +604,14 @@ AddProcHierarchyNodes (
if (!IS_ACPI_PROC_ID_VALID (ProcInfoNode)) {
// Default invalid ACPI Processor ID to 0
ProcStruct->AcpiProcessorId = 0;
- } else if (ProcInfoNode->GicCToken == CM_NULL_TOKEN) {
+ } else if (ProcInfoNode->AcpiIdObjectToken == CM_NULL_TOKEN) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
DEBUG_ERROR,
- "ERROR: PPTT: The 'ACPI Processor ID valid' flag is set but no GICC " \
- "structure token was provided. GicCToken = %p. RequestorToken = %p. " \
- "Status = %r\n",
- ProcInfoNode->GicCToken,
+ "ERROR: PPTT: The 'ACPI Processor ID valid' flag is set but no " \
+ "ACPI ID Reference object token was provided. " \
+ "AcpiIdObjectToken = %p. RequestorToken = %p. Status = %r\n",
+ ProcInfoNode->AcpiIdObjectToken,
ProcInfoNode->Token,
Status
));
@@ -617,17 +619,17 @@ AddProcHierarchyNodes (
} else {
Status = GetEArmObjGicCInfo (
CfgMgrProtocol,
- ProcInfoNode->GicCToken,
+ ProcInfoNode->AcpiIdObjectToken,
&GicCInfoList,
&GicCInfoCount
);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
- "ERROR: PPTT: Failed to get GICC structure. ACPI Processor ID " \
- "can't be populated. GicCToken = %p. RequestorToken = %p. " \
- "Status = %r\n",
- ProcInfoNode->GicCToken,
+ "ERROR: PPTT: Failed to get ACPI ID Reference object token. " \
+ "ACPI Processor ID can't be populated. " \
+ "AcpiIdObjectToken = %p. RequestorToken = %p. Status = %r\n",
+ ProcInfoNode->AcpiIdObjectToken,
ProcInfoNode->Token,
Status
));
@@ -640,10 +642,10 @@ AddProcHierarchyNodes (
DEBUG_ERROR,
"ERROR: PPTT: Failed to find a unique GICC structure. " \
"ACPI Processor ID can't be populated. " \
- "GICC Structure Count = %d. GicCToken = %p. RequestorToken = %p " \
+ "GICC Structure Count = %d. AcpiIdObjectToken = %p. RequestorToken = %p " \
"Status = %r\n",
GicCInfoCount,
- ProcInfoNode->GicCToken,
+ ProcInfoNode->AcpiIdObjectToken,
ProcInfoNode->Token,
Status
));
@@ -786,7 +788,7 @@ AddCacheTypeStructures (
EFI_STATUS Status;
EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE *CacheStruct;
PPTT_NODE_INDEXER *PpttNodeFound;
- CM_ARM_CACHE_INFO *CacheInfoNode;
+ CM_ARCH_COMMON_CACHE_INFO *CacheInfoNode;
PPTT_NODE_INDEXER *CacheNodeIterator;
UINT32 NodeCount;
BOOLEAN CacheIdUnique;
@@ -812,7 +814,7 @@ AddCacheTypeStructures (
}
for (NodeIndex = 0; NodeIndex < NodeCount; NodeIndex++) {
- CacheInfoNode = (CM_ARM_CACHE_INFO *)CacheNodeIterator->Object;
+ CacheInfoNode = (CM_ARCH_COMMON_CACHE_INFO *)CacheNodeIterator->Object;
// Populate the node header
CacheStruct->Type = EFI_ACPI_6_4_PPTT_TYPE_CACHE;
@@ -1072,8 +1074,8 @@ BuildPpttTable (
UINT32 ProcHierarchyNodeOffset;
UINT32 CacheStructOffset;
- CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyNodeList;
- CM_ARM_CACHE_INFO *CacheStructList;
+ CM_ARCH_COMMON_PROC_HIERARCHY_INFO *ProcHierarchyNodeList;
+ CM_ARCH_COMMON_CACHE_INFO *CacheStructList;
ACPI_PPTT_GENERATOR *Generator;
@@ -1110,7 +1112,7 @@ BuildPpttTable (
// Get the processor hierarchy info and update the processor topology
// structure count with Processor Hierarchy Nodes (Type 0)
- Status = GetEArmObjProcHierarchyInfo (
+ Status = GetEArchCommonObjProcHierarchyInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
&ProcHierarchyNodeList,
@@ -1130,7 +1132,7 @@ BuildPpttTable (
// Get the cache info and update the processor topology structure count with
// Cache Type Structures (Type 1)
- Status = GetEArmObjCacheInfo (
+ Status = GetEArchCommonObjCacheInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
&CacheStructList,
@@ -1340,6 +1342,7 @@ error_handler:
**/
STATIC
EFI_STATUS
+EFIAPI
FreePpttTableResources (
IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
@@ -1400,7 +1403,7 @@ ACPI_PPTT_GENERATOR PpttGenerator = {
// Minimum supported ACPI Table Revision
EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_REVISION,
// Creator ID
- TABLE_GENERATOR_CREATOR_ID_ARM,
+ TABLE_GENERATOR_CREATOR_ID,
// Creator Revision
PPTT_GENERATOR_REVISION,
// Build Table function
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h b/DynamicTablesPkg/Library/Acpi/Common/AcpiPpttLib/PpttGenerator.h
index 15b0a98..15b0a98 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiPpttLib/PpttGenerator.h
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/AcpiRawLibArm.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiRawLib/AcpiRawLib.inf
index f2ab1b7..8b461ea 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/AcpiRawLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiRawLib/AcpiRawLib.inf
@@ -8,7 +8,7 @@
[Defines]
INF_VERSION = 0x00010019
- BASE_NAME = AcpiRawLibArm
+ BASE_NAME = AcpiRawLib
FILE_GUID = 20F31568-D687-49BA-B326-CCD9D38EDE16
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
@@ -27,10 +27,3 @@
[LibraryClasses]
BaseLib
-
-[Pcd]
-
-[Protocols]
-
-[Guids]
-
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiRawLib/RawGenerator.c
index a8323ad..a4f1cfb 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/RawGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiRawLib/RawGenerator.c
@@ -81,7 +81,7 @@ ACPI_TABLE_GENERATOR RawGenerator = {
// Minimum ACPI Table Revision - Unused
0,
// Creator ID
- TABLE_GENERATOR_CREATOR_ID_ARM,
+ TABLE_GENERATOR_CREATOR_ID,
// Creator Revision
RAW_GENERATOR_REVISION,
// Build Table function
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiSpcrLib/AcpiSpcrLib.inf
index e11f878..80a6102 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSpcrLib/AcpiSpcrLib.inf
@@ -8,7 +8,7 @@
[Defines]
INF_VERSION = 0x00010019
- BASE_NAME = AcpiSpcrLibArm
+ BASE_NAME = AcpiSpcrLib
FILE_GUID = 55088136-7B78-4974-B1EE-F630150D0DE7
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
@@ -28,10 +28,3 @@
[LibraryClasses]
BaseLib
SsdtSerialPortFixupLib
-
-[Pcd]
-
-[Protocols]
-
-[Guids]
-
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSpcrLib/SpcrGenerator.c
index 59cbacb..ddd8262 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSpcrLib/SpcrGenerator.c
@@ -26,14 +26,14 @@
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
-/** ARM standard SPCR Table Generator
+/** Standard SPCR Table Generator
Constructs the SPCR table for PL011 or SBSA UART peripherals.
Requirements:
The following Configuration Manager Object(s) are required by
this Generator:
- - EArmObjSerialConsolePortInfo
+ - EArchCommonObjConsolePortInfo
NOTE: This implementation ignores the possibility that the Serial settings may
be modified from the UEFI Shell. A more complex handler would be needed
@@ -98,9 +98,9 @@ EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE AcpiSpcr = {
Port Information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjSerialConsolePortInfo,
- CM_ARM_SERIAL_PORT_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjConsolePortInfo,
+ CM_ARCH_COMMON_SERIAL_PORT_INFO
)
/** Free any resources allocated for constructing the tables.
@@ -200,10 +200,10 @@ BuildSpcrTableEx (
OUT UINTN *CONST TableCount
)
{
- EFI_STATUS Status;
- CM_ARM_SERIAL_PORT_INFO *SerialPortInfo;
- UINT32 SerialPortCount;
- EFI_ACPI_DESCRIPTION_HEADER **TableList;
+ EFI_STATUS Status;
+ CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo;
+ UINT32 SerialPortCount;
+ EFI_ACPI_DESCRIPTION_HEADER **TableList;
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
@@ -229,7 +229,7 @@ BuildSpcrTableEx (
*Table = NULL;
- Status = GetEArmObjSerialConsolePortInfo (
+ Status = GetEArchCommonObjConsolePortInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
&SerialPortInfo,
@@ -419,7 +419,7 @@ ACPI_TABLE_GENERATOR SpcrGenerator = {
// Minimum supported ACPI Table Revision
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION,
// Creator ID
- TABLE_GENERATOR_CREATOR_ID_ARM,
+ TABLE_GENERATOR_CREATOR_ID,
// Creator Revision
SPCR_GENERATOR_REVISION,
// Build table function. Use the extended version instead.
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/AcpiSratLibArm.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/AcpiSratLib.inf
index 5891dc4..14e435e 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/AcpiSratLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/AcpiSratLib.inf
@@ -8,7 +8,7 @@
[Defines]
INF_VERSION = 0x0001001B
- BASE_NAME = AcpiSratLibArm
+ BASE_NAME = AcpiSratLib
FILE_GUID = 2CE21E0A-A39C-4B26-BC0E-526178036ACD
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
@@ -18,6 +18,13 @@
[Sources]
SratGenerator.c
+ SratGenerator.h
+
+[Sources.ARM, Sources.AARCH64]
+ Arm/ArmSratGenerator.c
+
+[Sources.IA32, Sources.X64]
+ SratGeneratorNull.c
[Packages]
EmbeddedPkg/EmbeddedPkg.dec
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/Arm/ArmSratGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/Arm/ArmSratGenerator.c
new file mode 100644
index 0000000..3d36b25
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/Arm/ArmSratGenerator.c
@@ -0,0 +1,262 @@
+/** @file
+ Arm SRAT Table Generator
+
+ Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.3 Specification, January 2019
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+**/
+
+#include <Library/AcpiLib.h>
+#include <Library/BaseLib.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>
+
+#include "SratGenerator.h"
+
+/**
+ ARM standard SRAT Generator
+
+ Requirements:
+ The following Configuration Manager Object(s) are used by this Generator:
+ - EArmObjGicCInfo (REQUIRED)
+ - 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
+ Interrupt Translation Service Information from the
+ Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArm,
+ EArmObjGicItsInfo,
+ CM_ARM_GIC_ITS_INFO
+ );
+
+/** Enum of the Arm specific CM objects required to
+ build the arch specific information of the SRAT table.
+*/
+typedef enum ArmSratSubTableType {
+ EArmGicCSubTableType,
+ EArmGicItsSubTableType,
+ EArmSubTableTypeMax,
+} EARM_SRAT_SUB_TABLE_TYPE;
+
+typedef struct SratSubTable {
+ /// Start offset of the arch specific sub-table.
+ UINT32 Offset;
+
+ /// Count
+ UINT32 Count;
+
+ /// Array of CmInfo objects of the relevant type.
+ VOID *CmInfo;
+} SRAT_SUB_TABLE;
+
+STATIC SRAT_SUB_TABLE mSratSubTable[EArmSubTableTypeMax];
+
+/** Reserve arch sub-tables space.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ @param [in, out] ArchOffset On input, contains the offset where arch specific
+ sub-tables can be written. It is expected that
+ there enough space to write all the arch specific
+ sub-tables from this offset onward.
+ On ouput, contains the ending offset of the arch
+ specific sub-tables.
+
+ @retval EFI_SUCCESS Table generated 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
+ArchReserveOffsets (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN OUT UINT32 *ArchOffset
+ )
+{
+ EFI_STATUS Status;
+
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (ArchOffset != NULL);
+
+ Status = GetEArmObjGicCInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ (CM_ARM_GICC_INFO **)&mSratSubTable[EArmGicCSubTableType].CmInfo,
+ &mSratSubTable[EArmGicCSubTableType].Count
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: SRAT: Failed to get GICC Info. Status = %r\n",
+ Status
+ ));
+ return Status;
+ }
+
+ if (mSratSubTable[EArmGicCSubTableType].Count == 0) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: SRAT: GIC CPU Interface information not provided.\n"
+ ));
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = GetEArmObjGicItsInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ (CM_ARM_GIC_ITS_INFO **)&mSratSubTable[EArmGicItsSubTableType].CmInfo,
+ &mSratSubTable[EArmGicItsSubTableType].Count
+ );
+ if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: SRAT: Failed to get GIC ITS Info. Status = %r\n",
+ Status
+ ));
+ return Status;
+ }
+
+ mSratSubTable[EArmGicCSubTableType].Offset = *ArchOffset;
+ *ArchOffset += (sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE) *
+ mSratSubTable[EArmGicCSubTableType].Count);
+
+ if (mSratSubTable[EArmGicItsSubTableType].Count != 0) {
+ mSratSubTable[EArmGicItsSubTableType].Offset = *ArchOffset;
+ *ArchOffset += (sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE) *
+ mSratSubTable[EArmGicItsSubTableType].Count);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/** 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.
+**/
+STATIC
+VOID
+EFIAPI
+AddGICCAffinity (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST Srat
+ )
+{
+ EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *GicCAff;
+ CM_ARM_GICC_INFO *GicCInfo;
+
+ GicCInfo = mSratSubTable[EArmGicCSubTableType].CmInfo;
+ GicCAff = (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *)((UINT8 *)Srat +
+ mSratSubTable[EArmGicCSubTableType].Offset);
+
+ while (mSratSubTable[EArmGicCSubTableType].Count-- != 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;
+
+ // Next
+ GicCAff++;
+ GicCInfo++;
+ }// while
+}
+
+/** 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.
+**/
+STATIC
+VOID
+EFIAPI
+AddGICItsAffinity (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST Srat
+ )
+{
+ EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE *GicItsAff;
+ CM_ARM_GIC_ITS_INFO *GicItsInfo;
+
+ GicItsInfo = mSratSubTable[EArmGicItsSubTableType].CmInfo;
+ GicItsAff = (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE *)((UINT8 *)Srat +
+ mSratSubTable[EArmGicItsSubTableType].Offset);
+
+ while (mSratSubTable[EArmGicItsSubTableType].Count-- != 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->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
+ GicItsAff->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
+ GicItsAff->ItsId = GicItsInfo->GicItsId;
+
+ // Next
+ GicItsAff++;
+ GicItsInfo++;
+ }// while
+}
+
+/** Add the arch specific sub-tables to the SRAT table.
+
+ These sub-tables are written in the space reserved beforehand.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in] Srat Pointer to the SRAT Table.
+
+ @retval EFI_SUCCESS Table generated successfully.
+**/
+EFI_STATUS
+EFIAPI
+AddArchObjects (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST Srat
+ )
+{
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (Srat != NULL);
+
+ AddGICCAffinity (CfgMgrProtocol, Srat);
+
+ if (mSratSubTable[EArmGicCSubTableType].Count != 0) {
+ AddGICItsAffinity (CfgMgrProtocol, Srat);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.c
index 431995e..20e1a4b 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.c
@@ -25,46 +25,27 @@
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
+#include "SratGenerator.h"
+
/**
- ARM standard SRAT Generator
+ Standard SRAT Generator
Requirements:
The following Configuration Manager Object(s) are used by this Generator:
- - EArmObjGicCInfo (REQUIRED)
- - EArmObjGicItsInfo (OPTIONAL)
- - EArmObjMemoryAffinityInfo (OPTIONAL)
- - EArmObjGenericInitiatorAffinityInfo (OPTIONAL)
- - EArmObjDeviceHandleAcpi (OPTIONAL)
- - EArmObjDeviceHandlePci (OPTIONAL)
-*/
-
-/** This macro expands to a function that retrieves the GIC
- CPU interface Information from the Configuration Manager.
+ - EArchCommonObjMemoryAffinityInfo (OPTIONAL)
+ - EArchCommonObjGenericInitiatorAffinityInfo (OPTIONAL)
+ - EArchCommonObjDeviceHandleAcpi (OPTIONAL)
+ - EArchCommonObjDeviceHandlePci (OPTIONAL)
*/
-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
+ EObjNameSpaceArchCommon,
+ EArchCommonObjMemoryAffinityInfo,
+ CM_ARCH_COMMON_MEMORY_AFFINITY_INFO
);
/**
@@ -72,9 +53,9 @@ GET_OBJECT_LIST (
information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGenericInitiatorAffinityInfo,
- CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjGenericInitiatorAffinityInfo,
+ CM_ARCH_COMMON_GENERIC_INITIATOR_AFFINITY_INFO
);
/**
@@ -82,9 +63,9 @@ GET_OBJECT_LIST (
information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjDeviceHandleAcpi,
- CM_ARM_DEVICE_HANDLE_ACPI
+ EObjNameSpaceArchCommon,
+ EArchCommonObjDeviceHandleAcpi,
+ CM_ARCH_COMMON_DEVICE_HANDLE_ACPI
);
/**
@@ -92,9 +73,9 @@ GET_OBJECT_LIST (
information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjDeviceHandlePci,
- CM_ARM_DEVICE_HANDLE_PCI
+ EObjNameSpaceArchCommon,
+ EArchCommonObjDeviceHandlePci,
+ CM_ARCH_COMMON_DEVICE_HANDLE_PCI
);
/** Return the PCI Device information in BDF format
@@ -110,7 +91,7 @@ GET_OBJECT_LIST (
STATIC
UINT16
GetBdf (
- IN CONST CM_ARM_DEVICE_HANDLE_PCI *DeviceHandlePci
+ IN CONST CM_ARCH_COMMON_DEVICE_HANDLE_PCI *DeviceHandlePci
)
{
UINT16 Bdf;
@@ -121,102 +102,6 @@ GetBdf (
return Bdf;
}
-/** 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
- )
-{
- EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *GicCAff;
-
- ASSERT (Srat != NULL);
- ASSERT (GicCInfo != NULL);
-
- GicCAff = (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *)((UINT8 *)Srat +
- GicCAffOffset);
-
- 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;
-
- // Next
- GicCAff++;
- GicCInfo++;
- }// while
-
- 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
- )
-{
- EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE *GicItsAff;
-
- ASSERT (Srat != NULL);
- ASSERT (GicItsInfo != NULL);
-
- GicItsAff = (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE *)((UINT8 *)Srat +
- GicItsAffOffset);
-
- 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->Reserved[0] = EFI_ACPI_RESERVED_BYTE;
- GicItsAff->Reserved[1] = EFI_ACPI_RESERVED_BYTE;
- GicItsAff->ItsId = GicItsInfo->GicItsId;
-
- // Next
- GicItsAff++;
- GicItsInfo++;
- }// while
-
- return EFI_SUCCESS;
-}
-
/** Add the Memory Affinity Structures in the SRAT Table.
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
@@ -235,7 +120,7 @@ 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 CONST CM_ARCH_COMMON_MEMORY_AFFINITY_INFO *MemAffInfo,
IN UINT32 MemAffCount
)
{
@@ -295,14 +180,14 @@ 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 CONST CM_ARCH_COMMON_GENERIC_INITIATOR_AFFINITY_INFO *GenInitAffInfo,
IN UINT32 GenInitAffCount
)
{
EFI_STATUS Status;
EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE *GenInitAff;
- CM_ARM_DEVICE_HANDLE_ACPI *DeviceHandleAcpi;
- CM_ARM_DEVICE_HANDLE_PCI *DeviceHandlePci;
+ CM_ARCH_COMMON_DEVICE_HANDLE_ACPI *DeviceHandleAcpi;
+ CM_ARCH_COMMON_DEVICE_HANDLE_PCI *DeviceHandlePci;
UINT32 DeviceHandleCount;
ASSERT (Srat != NULL);
@@ -331,7 +216,7 @@ AddGenericInitiatorAffinity (
}
if (GenInitAffInfo->DeviceHandleType == EFI_ACPI_6_3_ACPI_DEVICE_HANDLE) {
- Status = GetEArmObjDeviceHandleAcpi (
+ Status = GetEArchCommonObjDeviceHandleAcpi (
CfgMgrProtocol,
GenInitAffInfo->DeviceHandleToken,
&DeviceHandleAcpi,
@@ -362,7 +247,7 @@ AddGenericInitiatorAffinity (
} else if (GenInitAffInfo->DeviceHandleType ==
EFI_ACPI_6_3_PCI_DEVICE_HANDLE)
{
- Status = GetEArmObjDeviceHandlePci (
+ Status = GetEArchCommonObjDeviceHandlePci (
CfgMgrProtocol,
GenInitAffInfo->DeviceHandleToken,
&DeviceHandlePci,
@@ -455,20 +340,14 @@ BuildSratTable (
{
EFI_STATUS Status;
UINT32 TableSize;
- UINT32 GicCCount;
- UINT32 GicItsCount;
UINT32 MemAffCount;
UINT32 GenInitiatorAffCount;
- UINT32 GicCAffOffset;
- UINT32 GicItsAffOffset;
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;
+ CM_ARCH_COMMON_MEMORY_AFFINITY_INFO *MemAffInfo;
+ CM_ARCH_COMMON_GENERIC_INITIATOR_AFFINITY_INFO *GenInitiatorAffInfo;
EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *Srat;
@@ -497,47 +376,7 @@ BuildSratTable (
*Table = NULL;
- Status = GetEArmObjGicCInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GicCInfo,
- &GicCCount
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SRAT: Failed to get GICC Info. Status = %r\n",
- Status
- ));
- goto error_handler;
- }
-
- if (GicCCount == 0) {
- DEBUG ((
- DEBUG_ERROR,
- "ERROR: SRAT: GIC CPU Interface information not provided.\n"
- ));
- ASSERT (0);
- Status = EFI_INVALID_PARAMETER;
- goto error_handler;
- }
-
- Status = GetEArmObjGicItsInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GicItsInfo,
- &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;
- }
-
- Status = GetEArmObjMemoryAffinityInfo (
+ Status = GetEArchCommonObjMemoryAffinityInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
&MemAffInfo,
@@ -552,7 +391,7 @@ BuildSratTable (
goto error_handler;
}
- Status = GetEArmObjGenericInitiatorAffinityInfo (
+ Status = GetEArchCommonObjGenericInitiatorAffinityInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
&GenInitiatorAffInfo,
@@ -571,13 +410,18 @@ BuildSratTable (
// Calculate the size of the SRAT table
TableSize = sizeof (EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER);
- GicCAffOffset = TableSize;
- TableSize += (sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE) * GicCCount);
-
- if (GicItsCount != 0) {
- GicItsAffOffset = TableSize;
- TableSize += (sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE) *
- GicItsCount);
+ // Place the Arch specific subtables/structures first and
+ // reserve the offsets. The common subtables/structures
+ // are placed next.
+ Status = ArchReserveOffsets (CfgMgrProtocol, &TableSize);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: SRAT: Failed to reserve arch offsets."
+ " Status = %r\n",
+ Status
+ ));
+ goto error_handler;
}
if (MemAffCount != 0) {
@@ -636,40 +480,16 @@ BuildSratTable (
Srat->Reserved1 = 1;
Srat->Reserved2 = EFI_ACPI_RESERVED_QWORD;
- Status = AddGICCAffinity (
- CfgMgrProtocol,
- Srat,
- GicCAffOffset,
- GicCInfo,
- GicCCount
- );
+ Status = AddArchObjects (CfgMgrProtocol, Srat);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
- "ERROR: SRAT: Failed to add GICC Affinity structures. Status = %r\n",
+ "ERROR: SRAT: Failed to add arch objects header. Status = %r\n",
Status
));
goto error_handler;
}
- 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;
- }
- }
-
if (MemAffCount != 0) {
Status = AddMemoryAffinity (
CfgMgrProtocol,
@@ -732,6 +552,7 @@ error_handler:
**/
STATIC
EFI_STATUS
+EFIAPI
FreeSratTableResources (
IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
@@ -778,7 +599,7 @@ ACPI_TABLE_GENERATOR SratGenerator = {
// Minimum supported ACPI Table Revision
EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_REVISION,
// Creator ID
- TABLE_GENERATOR_CREATOR_ID_ARM,
+ TABLE_GENERATOR_CREATOR_ID,
// Creator Revision
SRAT_GENERATOR_REVISION,
// Build Table function
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.h b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.h
new file mode 100644
index 0000000..106d008
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.h
@@ -0,0 +1,59 @@
+/** @file
+ SRAT Table Generator
+
+ Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.3 Specification, January 2019
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+**/
+
+#ifndef SRAT_GENERATOR_H_
+#define SRAT_GENERATOR_H_
+
+/** Reserve arch sub-tables space.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ @param [in, out] ArchOffset On input, contains the offset where arch specific
+ sub-tables can be written. It is expected that
+ there enough space to write all the arch specific
+ sub-tables from this offset onward.
+ On ouput, contains the ending offset of the arch
+ specific sub-tables.
+
+ @retval EFI_SUCCESS Table generated 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
+ArchReserveOffsets (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN OUT UINT32 *ArchOffset
+ );
+
+/** Add the arch specific sub-tables to the SRAT table.
+
+ These sub-tables are written in the space reserved beforehand.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in] Srat Pointer to the SRAT Table.
+
+ @retval EFI_SUCCESS Table generated successfully.
+**/
+EFI_STATUS
+EFIAPI
+AddArchObjects (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST Srat
+ );
+
+#endif // SRAT_GENERATOR_H_
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGeneratorNull.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGeneratorNull.c
new file mode 100644
index 0000000..4ebdf97
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGeneratorNull.c
@@ -0,0 +1,79 @@
+/** @file
+ Common SRAT Table Generator
+
+ Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.3 Specification, January 2019
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+**/
+
+#include <Library/AcpiLib.h>
+#include <Library/BaseLib.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>
+
+#include "SratGenerator.h"
+
+/** Reserve arch sub-tables space.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ @param [in, out] ArchOffset On input, contains the offset where arch specific
+ sub-tables can be written. It is expected that
+ there enough space to write all the arch specific
+ sub-tables from this offset onward.
+ On ouput, contains the ending offset of the arch
+ specific sub-tables.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_UNSUPPORTED Not supported.
+ @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
+ArchReserveOffsets (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN OUT UINT32 *ArchOffset
+ )
+{
+ // Not implemented.
+ return EFI_UNSUPPORTED;
+}
+
+/** Add the arch specific sub-tables to the SRAT table.
+
+ These sub-tables are written in the space reserved beforehand.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in] Srat Pointer to the SRAT Table.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_UNSUPPORTED Not supported.
+**/
+EFI_STATUS
+EFIAPI
+AddArchObjects (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *CONST Srat
+ )
+{
+ // Not implemented.
+ return EFI_UNSUPPORTED;
+}
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/Arm/ArmSsdtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/Arm/ArmSsdtCpuTopologyGenerator.c
new file mode 100644
index 0000000..140a2e4
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/Arm/ArmSsdtCpuTopologyGenerator.c
@@ -0,0 +1,408 @@
+/** @file
+ ARM SSDT Cpu Topology Table Generator Helpers.
+
+ Copyright (c) 2021 - 2023, Arm Limited. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.3 Specification - January 2019 - s8.4 Declaring Processors
+ - ACPI for CoreSight version 1.2 Platform Design Document
+ (https://developer.arm.com/documentation/den0067/a/?lang=en)
+
+ @par Glossary:
+ - ETE - Embedded Trace Extension.
+ - ETM - Embedded Trace Macrocell.
+**/
+
+#include <Library/AcpiLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.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/AcpiHelperLib.h>
+#include <Library/TableHelperLib.h>
+#include <Library/AmlLib/AmlLib.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+
+#include "SsdtCpuTopologyGenerator.h"
+
+/** ARM SSDT Cpu Topology Table Generator.
+
+Requirements:
+ The following Configuration Manager Object(s) are required by
+ this Generator:
+ - EArmObjGicCInfo
+ - EArmObjEtInfo (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 ET device
+ information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArm,
+ EArmObjEtInfo,
+ CM_ARM_ET_INFO
+ );
+
+/** Create an embedded trace device and add it to the Cpu Node in the
+ AML namespace.
+
+ This generates the following ASL code:
+ Device (E002)
+ {
+ Name (_UID, 2)
+ Name (_HID, "ARMHC500")
+ }
+
+ Note: Currently we only support generating ETE nodes. Unlike ETM,
+ ETE has a system register interface and therefore does not need
+ the MMIO range to be described.
+
+ @param [in] Generator The SSDT Cpu Topology generator.
+ @param [in] ParentNode Parent node to attach the Cpu node to.
+ @param [in] AcpiProcessorUid ACPI Processor UID of the CPU.
+ @param [in] CpuName Value used to generate the node name.
+ @param [out] EtNodePtr If not NULL, return the created Cpu node.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+CreateAmlEtd (
+ IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
+ IN AML_NODE_HANDLE ParentNode,
+ IN UINT32 AcpiProcessorUid,
+ IN UINT32 CpuName,
+ OUT AML_OBJECT_NODE_HANDLE *EtNodePtr OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ AML_OBJECT_NODE_HANDLE EtNode;
+ CHAR8 AslName[AML_NAME_SEG_SIZE + 1];
+
+ ASSERT (Generator != NULL);
+ ASSERT (ParentNode != NULL);
+
+ Status = WriteAslName ('E', CpuName, AslName);
+ if (EFI_ERROR (Status)) {
+ ASSERT (0);
+ return Status;
+ }
+
+ Status = AmlCodeGenDevice (AslName, ParentNode, &EtNode);
+ if (EFI_ERROR (Status)) {
+ ASSERT (0);
+ return Status;
+ }
+
+ Status = AmlCodeGenNameInteger (
+ "_UID",
+ AcpiProcessorUid,
+ EtNode,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT (0);
+ return Status;
+ }
+
+ Status = AmlCodeGenNameString (
+ "_HID",
+ ACPI_HID_ET_DEVICE,
+ EtNode,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT (0);
+ return Status;
+ }
+
+ // If requested, return the handle to the EtNode.
+ if (EtNodePtr != NULL) {
+ *EtNodePtr = EtNode;
+ }
+
+ return Status;
+}
+
+/** Create and add an Embedded trace device to the Cpu Node.
+
+ @param [in] Generator The SSDT Cpu Topology generator.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in] AcpiProcessorUid ACPI processor Uid of the local intc (gicc, other)
+ describing the Cpu.
+ @param [in] EtToken Embedded Trace Token of the CPU.
+ @param [in] CpuName Value used to generate the CPU node name.
+ @param [in] CpuNode CPU Node to which the ET device node is
+ attached.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_UNSUPPORTED Feature Unsupported.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+CreateAmlEtNode (
+ IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN UINT32 AcpiProcessorUid,
+ IN CM_OBJECT_TOKEN EtToken,
+ IN UINT32 CpuName,
+ IN AML_OBJECT_NODE_HANDLE *CpuNode
+ )
+{
+ EFI_STATUS Status;
+ CM_ARM_ET_INFO *EtInfo;
+
+ Status = GetEArmObjEtInfo (
+ CfgMgrProtocol,
+ EtToken,
+ &EtInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT (0);
+ return Status;
+ }
+
+ // Currently we only support creation of a ETE Node.
+ if (EtInfo->EtType != ArmEtTypeEte) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = CreateAmlEtd (
+ Generator,
+ CpuNode,
+ AcpiProcessorUid,
+ CpuName,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+/** Create the processor hierarchy AML tree from arch specific CM objects.
+
+ The Arm architecture will use the CM_ARM_GICC_INFO CM objects for instance.
+ A processor container is by extension any non-leave device in the cpu topology.
+
+ @param [in] Generator The SSDT Cpu Topology generator.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in] ScopeNode Scope node handle ('\_SB' scope).
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+CreateTopologyFromIntC (
+ IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN AML_OBJECT_NODE_HANDLE ScopeNode
+ )
+{
+ EFI_STATUS Status;
+ CM_ARM_GICC_INFO *GicCInfo;
+ UINT32 GicCInfoCount;
+ UINT32 Index;
+ AML_OBJECT_NODE_HANDLE CpuNode;
+
+ ASSERT (Generator != NULL);
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (ScopeNode != NULL);
+
+ Status = GetEArmObjGicCInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &GicCInfo,
+ &GicCInfoCount
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT (0);
+ return Status;
+ }
+
+ // For each CM_ARM_GICC_INFO object, create an AML node.
+ for (Index = 0; Index < GicCInfoCount; Index++) {
+ Status = CreateAmlCpu (
+ Generator,
+ ScopeNode,
+ GicCInfo[Index].AcpiProcessorUid,
+ Index,
+ &CpuNode
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT (0);
+ break;
+ }
+
+ // If a CPC info is associated with the
+ // GicCinfo, create an _CPC method returning them.
+ if (GicCInfo[Index].CpcToken != CM_NULL_TOKEN) {
+ Status = CreateAmlCpcNode (Generator, CfgMgrProtocol, GicCInfo[Index].CpcToken, CpuNode);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ break;
+ }
+ }
+
+ if (GicCInfo[Index].EtToken != CM_NULL_TOKEN) {
+ Status = CreateAmlEtNode (
+ Generator,
+ CfgMgrProtocol,
+ GicCInfo[Index].AcpiProcessorUid,
+ GicCInfo[Index].EtToken,
+ Index,
+ CpuNode
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+ }
+ }
+ } // for
+
+ return Status;
+}
+
+/** Get generic interrupt information from arch specific CM objects.
+
+ The AcpiProcessorUid, CpcToken, etc. are held in arch specific CM objects,
+ in the CM_ARM_GICC_INFO CM object for Arm for instance.
+ This wrapper allows to get this information from each arch object.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in] AcpiIdObjectToken AcpiIdObjectToken identifying the CPU to fetch the
+ other fields from.
+ @param [out] AcpiProcessorUid AcpiProcessorUid of the CPU identified by
+ the AcpiIdObjectToken.
+ @param [out] CpcToken CpcToken of the CPU identified by
+ the AcpiIdObjectToken.
+ @param [out] PsdToken PsdToken of the CPU identified by
+ the AcpiIdObjectToken.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_NOT_FOUND Not found.
+**/
+EFI_STATUS
+EFIAPI
+GetIntCInfo (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN CM_OBJECT_TOKEN AcpiIdObjectToken,
+ OUT UINT32 *AcpiProcessorUid,
+ OUT CM_OBJECT_TOKEN *CpcToken,
+ OUT CM_OBJECT_TOKEN *PsdToken
+ )
+{
+ EFI_STATUS Status;
+ CM_ARM_GICC_INFO *GicCInfo;
+
+ Status = GetEArmObjGicCInfo (
+ CfgMgrProtocol,
+ AcpiIdObjectToken,
+ &GicCInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (AcpiProcessorUid != NULL) {
+ *AcpiProcessorUid = GicCInfo->AcpiProcessorUid;
+ }
+
+ if (CpcToken != NULL) {
+ *CpcToken = GicCInfo->CpcToken;
+ }
+
+ if (PsdToken != NULL) {
+ *PsdToken = GicCInfo->PsdToken;
+ }
+
+ return Status;
+}
+
+/** Add arch specific information to a CPU node in the asl description.
+
+ @param [in] Generator The SSDT Cpu Topology generator.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in] AcpiIdObjectToken AcpiIdObjectToken identifying the CPU to fetch the
+ other fields from.
+ @param [in] CpuName Value used to generate the CPU node name.
+ @param [out] CpuNode CPU Node to which the ET device node is
+ attached.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_NOT_FOUND Not found.
+ @retval EFI_UNSUPPORTED Feature Unsupported.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AddArchAmlCpuInfo (
+ IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN CM_OBJECT_TOKEN AcpiIdObjectToken,
+ IN UINT32 CpuName,
+ OUT AML_OBJECT_NODE_HANDLE *CpuNode
+ )
+{
+ EFI_STATUS Status;
+ CM_ARM_GICC_INFO *GicCInfo;
+
+ Status = GetEArmObjGicCInfo (
+ CfgMgrProtocol,
+ AcpiIdObjectToken,
+ &GicCInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ // Add an Embedded Trace node if present.
+ if (GicCInfo->EtToken != CM_NULL_TOKEN) {
+ Status = CreateAmlEtNode (
+ Generator,
+ CfgMgrProtocol,
+ GicCInfo->AcpiProcessorUid,
+ GicCInfo->EtToken,
+ CpuName,
+ CpuNode
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+ }
+ }
+
+ return Status;
+}
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyGenerator.c
index 40ed10e..3bb0c2f 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyGenerator.c
@@ -32,36 +32,25 @@
#include "SsdtCpuTopologyGenerator.h"
-/** ARM standard SSDT Cpu Topology Table Generator.
+/** SSDT Cpu Topology Table Generator.
Requirements:
The following Configuration Manager Object(s) are required by
this Generator:
- - EArmObjGicCInfo
- - EArmObjProcHierarchyInfo (OPTIONAL) along with
- - EArmObjCmRef (OPTIONAL)
- - EArmObjLpiInfo (OPTIONAL)
- - GetEArmObjEtInfo (OPTIONAL)
- - EArmObjPsdInfo (OPTIONAL)
+ - EArchCommonObjProcHierarchyInfo (OPTIONAL) along with
+ - EArchCommonObjCmRef (OPTIONAL)
+ - EArchCommonObjLpiInfo (OPTIONAL)
+ - EArchCommonObjPsdInfo (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 Processor Hierarchy
information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjProcHierarchyInfo,
- CM_ARM_PROC_HIERARCHY_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjProcHierarchyInfo,
+ CM_ARCH_COMMON_PROC_HIERARCHY_INFO
);
/**
@@ -69,9 +58,9 @@ GET_OBJECT_LIST (
reference information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjCmRef,
- CM_ARM_OBJ_REF
+ EObjNameSpaceArchCommon,
+ EArchCommonObjCmRef,
+ CM_ARCH_COMMON_OBJ_REF
);
/**
@@ -79,9 +68,9 @@ GET_OBJECT_LIST (
information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjLpiInfo,
- CM_ARM_LPI_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjLpiInfo,
+ CM_ARCH_COMMON_LPI_INFO
);
/**
@@ -89,19 +78,9 @@ GET_OBJECT_LIST (
information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjCpcInfo,
- CM_ARM_CPC_INFO
- );
-
-/**
- This macro expands to a function that retrieves the ET device
- information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjEtInfo,
- CM_ARM_ET_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjCpcInfo,
+ CM_ARCH_COMMON_CPC_INFO
);
/**
@@ -109,19 +88,19 @@ GET_OBJECT_LIST (
information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPsdInfo,
- CM_ARM_PSD_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjPsdInfo,
+ CM_ARCH_COMMON_PSD_INFO
);
/** Initialize the TokenTable.
- One entry should be allocated for each CM_ARM_PROC_HIERARCHY_INFO
+ One entry should be allocated for each CM_ARCH_COMMON_PROC_HIERARCHY_INFO
structure of the platform. The TokenTable allows to have a mapping:
- Index <-> CM_OBJECT_TOKEN (to CM_ARM_LPI_INFO structures).
+ Index <-> CM_OBJECT_TOKEN (to CM_ARCH_COMMON_LPI_INFO structures).
- There will always be less sets of Lpi states (CM_ARM_OBJ_REF)
- than the number of cpus/clusters (CM_ARM_PROC_HIERARCHY_INFO).
+ There will always be less sets of Lpi states (CM_ARCH_COMMON_OBJ_REF)
+ than the number of cpus/clusters (CM_ARCH_COMMON_PROC_HIERARCHY_INFO).
@param [in] Generator The SSDT Cpu Topology generator.
@param [in] Count Number of entries to allocate in the TokenTable.
@@ -238,7 +217,6 @@ TokenTableAdd (
@retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER Invalid parameter.
**/
-STATIC
EFI_STATUS
EFIAPI
WriteAslName (
@@ -294,8 +272,7 @@ WriteAslName (
@param [in] Generator The SSDT Cpu Topology generator.
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
Protocol Interface.
- @param [in] GicCInfo Pointer to the CM_ARM_GICC_INFO object
- describing the Cpu.
+ @param [in] PsdToken Token to identify the Psd information.
@param [in] Node CPU Node to which the _CPC node is
attached.
@@ -309,16 +286,16 @@ EFIAPI
CreateAmlPsdNode (
IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
- IN CM_ARM_GICC_INFO *GicCInfo,
+ IN CM_OBJECT_TOKEN PsdToken,
IN AML_OBJECT_NODE_HANDLE *Node
)
{
- EFI_STATUS Status;
- CM_ARM_PSD_INFO *PsdInfo;
+ EFI_STATUS Status;
+ CM_ARCH_COMMON_PSD_INFO *PsdInfo;
- Status = GetEArmObjPsdInfo (
+ Status = GetEArchCommonObjPsdInfo (
CfgMgrProtocol,
- GicCInfo->PsdToken,
+ PsdToken,
&PsdInfo,
NULL
);
@@ -381,7 +358,7 @@ CreateAmlPsdNode (
@param [in] Generator The SSDT Cpu Topology generator.
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
Protocol Interface.
- @param [in] GicCInfo Pointer to the CM_ARM_GICC_INFO object
+ @param [in] CpcToken CPC token of the INTC info
describing the Cpu.
@param [in] Node CPU Node to which the _CPC node is
attached.
@@ -390,22 +367,21 @@ CreateAmlPsdNode (
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
**/
-STATIC
EFI_STATUS
EFIAPI
CreateAmlCpcNode (
IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
- IN CM_ARM_GICC_INFO *GicCInfo,
+ IN CM_OBJECT_TOKEN CpcToken,
IN AML_OBJECT_NODE_HANDLE *Node
)
{
- EFI_STATUS Status;
- CM_ARM_CPC_INFO *CpcInfo;
+ EFI_STATUS Status;
+ CM_ARCH_COMMON_CPC_INFO *CpcInfo;
- Status = GetEArmObjCpcInfo (
+ Status = GetEArchCommonObjCpcInfo (
CfgMgrProtocol,
- GicCInfo->CpcToken,
+ CpcToken,
&CpcInfo,
NULL
);
@@ -423,147 +399,6 @@ CreateAmlCpcNode (
return Status;
}
-/** Create an embedded trace device and add it to the Cpu Node in the
- AML namespace.
-
- This generates the following ASL code:
- Device (E002)
- {
- Name (_UID, 2)
- Name (_HID, "ARMHC500")
- }
-
- Note: Currently we only support generating ETE nodes. Unlike ETM,
- ETE has a system register interface and therefore does not need
- the MMIO range to be described.
-
- @param [in] Generator The SSDT Cpu Topology generator.
- @param [in] ParentNode Parent node to attach the Cpu node to.
- @param [in] GicCInfo CM_ARM_GICC_INFO object used to create the node.
- @param [in] CpuName Value used to generate the node name.
- @param [out] EtNodePtr If not NULL, return the created Cpu node.
-
- @retval EFI_SUCCESS Success.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
- @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-CreateAmlEtd (
- IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
- IN AML_NODE_HANDLE ParentNode,
- IN CM_ARM_GICC_INFO *GicCInfo,
- IN UINT32 CpuName,
- OUT AML_OBJECT_NODE_HANDLE *EtNodePtr OPTIONAL
- )
-{
- EFI_STATUS Status;
- AML_OBJECT_NODE_HANDLE EtNode;
- CHAR8 AslName[AML_NAME_SEG_SIZE + 1];
-
- ASSERT (Generator != NULL);
- ASSERT (ParentNode != NULL);
-
- Status = WriteAslName ('E', CpuName, AslName);
- if (EFI_ERROR (Status)) {
- ASSERT (0);
- return Status;
- }
-
- Status = AmlCodeGenDevice (AslName, ParentNode, &EtNode);
- if (EFI_ERROR (Status)) {
- ASSERT (0);
- return Status;
- }
-
- Status = AmlCodeGenNameInteger (
- "_UID",
- GicCInfo->AcpiProcessorUid,
- EtNode,
- NULL
- );
- if (EFI_ERROR (Status)) {
- ASSERT (0);
- return Status;
- }
-
- Status = AmlCodeGenNameString (
- "_HID",
- ACPI_HID_ET_DEVICE,
- EtNode,
- NULL
- );
- if (EFI_ERROR (Status)) {
- ASSERT (0);
- return Status;
- }
-
- // If requested, return the handle to the EtNode.
- if (EtNodePtr != NULL) {
- *EtNodePtr = EtNode;
- }
-
- return Status;
-}
-
-/** Create and add an Embedded trace device to the Cpu Node.
-
- @param [in] Generator The SSDT Cpu Topology generator.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
- @param [in] GicCInfo Pointer to the CM_ARM_GICC_INFO object
- describing the Cpu.
- @param [in] CpuName Value used to generate the CPU node name.
- @param [in] Node CPU Node to which the ET device node is
- attached.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_UNSUPPORTED Feature Unsupported.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
- @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-CreateAmlEtNode (
- IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
- IN CM_ARM_GICC_INFO *GicCInfo,
- IN UINT32 CpuName,
- IN AML_OBJECT_NODE_HANDLE *Node
- )
-{
- EFI_STATUS Status;
- CM_ARM_ET_INFO *EtInfo;
-
- Status = GetEArmObjEtInfo (
- CfgMgrProtocol,
- GicCInfo->EtToken,
- &EtInfo,
- NULL
- );
- if (EFI_ERROR (Status)) {
- ASSERT (0);
- return Status;
- }
-
- // Currently we only support creation of a ETE Node.
- if (EtInfo->EtType != ArmEtTypeEte) {
- return EFI_UNSUPPORTED;
- }
-
- Status = CreateAmlEtd (
- Generator,
- Node,
- GicCInfo,
- CpuName,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- return Status;
-}
-
/** Create and add an _LPI method to Cpu/Cluster Node.
For instance, transform an AML node from:
@@ -585,8 +420,8 @@ CreateAmlEtNode (
}
@param [in] Generator The SSDT Cpu Topology generator.
- @param [in] ProcHierarchyNodeInfo CM_ARM_PROC_HIERARCHY_INFO describing
- the Cpu.
+ @param [in] ProcHierarchyNodeInfo CM_ARCH_COMMON_PROC_HIERARCHY_INFO
+ describing the Cpu.
@param [in] Node Node to which the _LPI method is
attached. Can represent a Cpu or a
Cluster.
@@ -599,9 +434,9 @@ STATIC
EFI_STATUS
EFIAPI
CreateAmlLpiMethod (
- IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
- IN CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyNodeInfo,
- IN AML_OBJECT_NODE_HANDLE *Node
+ IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
+ IN CM_ARCH_COMMON_PROC_HIERARCHY_INFO *ProcHierarchyNodeInfo,
+ IN AML_OBJECT_NODE_HANDLE *Node
)
{
EFI_STATUS Status;
@@ -696,12 +531,12 @@ GenerateLpiStates (
UINT32 Index;
UINT32 LastIndex;
- AML_OBJECT_NODE_HANDLE LpiNode;
- CM_ARM_OBJ_REF *LpiRefInfo;
- UINT32 LpiRefInfoCount;
- UINT32 LpiRefIndex;
- CM_ARM_LPI_INFO *LpiInfo;
- CHAR8 AslName[AML_NAME_SEG_SIZE + 1];
+ AML_OBJECT_NODE_HANDLE LpiNode;
+ CM_ARCH_COMMON_OBJ_REF *LpiRefInfo;
+ UINT32 LpiRefInfoCount;
+ UINT32 LpiRefIndex;
+ CM_ARCH_COMMON_LPI_INFO *LpiInfo;
+ CHAR8 AslName[AML_NAME_SEG_SIZE + 1];
ASSERT (Generator != NULL);
ASSERT (Generator->TokenTable.Table != NULL);
@@ -727,7 +562,7 @@ GenerateLpiStates (
}
// Fetch the LPI objects referenced by the token.
- Status = GetEArmObjCmRef (
+ Status = GetEArchCommonObjCmRef (
CfgMgrProtocol,
Generator->TokenTable.Table[Index],
&LpiRefInfo,
@@ -739,8 +574,9 @@ GenerateLpiStates (
}
for (LpiRefIndex = 0; LpiRefIndex < LpiRefInfoCount; LpiRefIndex++) {
- // For each CM_ARM_LPI_INFO referenced by the token, add an Lpi state.
- Status = GetEArmObjLpiInfo (
+ // For each CM_ARCH_COMMON_LPI_INFO referenced by the token,
+ // add an Lpi state.
+ Status = GetEArchCommonObjLpiInfo (
CfgMgrProtocol,
LpiRefInfo[LpiRefIndex].ReferenceToken,
&LpiInfo,
@@ -788,23 +624,22 @@ GenerateLpiStates (
Name (_HID, "ACPI0007")
}
- @param [in] Generator The SSDT Cpu Topology generator.
- @param [in] ParentNode Parent node to attach the Cpu node to.
- @param [in] GicCInfo CM_ARM_GICC_INFO object used to create the node.
- @param [in] CpuName Value used to generate the node name.
- @param [out] CpuNodePtr If not NULL, return the created Cpu node.
+ @param [in] Generator The SSDT Cpu Topology generator.
+ @param [in] ParentNode Parent node to attach the Cpu node to.
+ @param [in] AcpiProcessorUid ACPI processor UID of the CPU.
+ @param [in] CpuName Value used to generate the node name.
+ @param [out] CpuNodePtr If not NULL, return the created Cpu node.
@retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
**/
-STATIC
EFI_STATUS
EFIAPI
CreateAmlCpu (
IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN AML_NODE_HANDLE ParentNode,
- IN CM_ARM_GICC_INFO *GicCInfo,
+ IN UINT32 AcpiProcessorUid,
IN UINT32 CpuName,
OUT AML_OBJECT_NODE_HANDLE *CpuNodePtr OPTIONAL
)
@@ -815,7 +650,6 @@ CreateAmlCpu (
ASSERT (Generator != NULL);
ASSERT (ParentNode != NULL);
- ASSERT (GicCInfo != NULL);
Status = WriteAslName ('C', CpuName, AslName);
if (EFI_ERROR (Status)) {
@@ -831,7 +665,7 @@ CreateAmlCpu (
Status = AmlCodeGenNameInteger (
"_UID",
- GicCInfo->AcpiProcessorUid,
+ AcpiProcessorUid,
CpuNode,
NULL
);
@@ -859,7 +693,7 @@ CreateAmlCpu (
return Status;
}
-/** Create a Cpu in the AML namespace from a CM_ARM_PROC_HIERARCHY_INFO
+/** Create a Cpu in the AML namespace from a CM_ARCH_COMMON_PROC_HIERARCHY_INFO
CM object.
@param [in] Generator The SSDT Cpu Topology generator.
@@ -867,8 +701,8 @@ CreateAmlCpu (
Protocol Interface.
@param [in] ParentNode Parent node to attach the Cpu node to.
@param [in] CpuName Value used to generate the node name.
- @param [in] ProcHierarchyNodeInfo CM_ARM_PROC_HIERARCHY_INFO describing
- the Cpu.
+ @param [in] ProcHierarchyNodeInfo CM_ARCH_COMMON_PROC_HIERARCHY_INFO
+ describing the Cpu.
@retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@@ -882,38 +716,41 @@ CreateAmlCpuFromProcHierarchy (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN AML_NODE_HANDLE ParentNode,
IN UINT32 CpuName,
- IN CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyNodeInfo
+ IN CM_ARCH_COMMON_PROC_HIERARCHY_INFO *ProcHierarchyNodeInfo
)
{
EFI_STATUS Status;
- CM_ARM_GICC_INFO *GicCInfo;
AML_OBJECT_NODE_HANDLE CpuNode;
+ UINT32 AcpiProcessorUid;
+ CM_OBJECT_TOKEN CpcToken;
+ CM_OBJECT_TOKEN PsdToken;
ASSERT (Generator != NULL);
ASSERT (CfgMgrProtocol != NULL);
ASSERT (ParentNode != NULL);
ASSERT (ProcHierarchyNodeInfo != NULL);
- ASSERT (ProcHierarchyNodeInfo->GicCToken != CM_NULL_TOKEN);
+ ASSERT (ProcHierarchyNodeInfo->AcpiIdObjectToken != CM_NULL_TOKEN);
- Status = GetEArmObjGicCInfo (
+ Status = GetIntCInfo (
CfgMgrProtocol,
- ProcHierarchyNodeInfo->GicCToken,
- &GicCInfo,
- NULL
+ ProcHierarchyNodeInfo->AcpiIdObjectToken,
+ &AcpiProcessorUid,
+ &CpcToken,
+ &PsdToken
);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
- Status = CreateAmlCpu (Generator, ParentNode, GicCInfo, CpuName, &CpuNode);
+ Status = CreateAmlCpu (Generator, ParentNode, AcpiProcessorUid, CpuName, &CpuNode);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
// If a set of Lpi states is associated with the
- // CM_ARM_PROC_HIERARCHY_INFO, create an _LPI method returning them.
+ // CM_ARCH_COMMON_PROC_HIERARCHY_INFO, create an _LPI method returning them.
if (ProcHierarchyNodeInfo->LpiToken != CM_NULL_TOKEN) {
Status = CreateAmlLpiMethod (Generator, ProcHierarchyNodeInfo, CpuNode);
if (EFI_ERROR (Status)) {
@@ -922,8 +759,8 @@ CreateAmlCpuFromProcHierarchy (
}
}
- if (GicCInfo->PsdToken != CM_NULL_TOKEN) {
- Status = CreateAmlPsdNode (Generator, CfgMgrProtocol, GicCInfo, CpuNode);
+ if (PsdToken != CM_NULL_TOKEN) {
+ Status = CreateAmlPsdNode (Generator, CfgMgrProtocol, PsdToken, CpuNode);
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
return Status;
@@ -931,28 +768,26 @@ CreateAmlCpuFromProcHierarchy (
}
// If a CPC info is associated with the
- // GicCinfo, create an _CPC method returning them.
- if (GicCInfo->CpcToken != CM_NULL_TOKEN) {
- Status = CreateAmlCpcNode (Generator, CfgMgrProtocol, GicCInfo, CpuNode);
+ // IntcInfo, create an _CPC method returning them.
+ if (CpcToken != CM_NULL_TOKEN) {
+ Status = CreateAmlCpcNode (Generator, CfgMgrProtocol, CpcToken, CpuNode);
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
return Status;
}
}
- // Add an Embedded Trace node if present.
- if (GicCInfo->EtToken != CM_NULL_TOKEN) {
- Status = CreateAmlEtNode (
- Generator,
- CfgMgrProtocol,
- GicCInfo,
- CpuName,
- CpuNode
- );
- if (EFI_ERROR (Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
+ // Add arch specific information if necessary.
+ Status = AddArchAmlCpuInfo (
+ Generator,
+ CfgMgrProtocol,
+ ProcHierarchyNodeInfo->AcpiIdObjectToken,
+ CpuName,
+ CpuNode
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ return Status;
}
return Status;
@@ -960,7 +795,7 @@ CreateAmlCpuFromProcHierarchy (
/** Create a Processor Container in the AML namespace.
- Any CM_ARM_PROC_HIERARCHY_INFO object with the following flags is
+ Any CM_ARCH_COMMON_PROC_HIERARCHY_INFO object with the following flags is
assumed to be a processor container:
- EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL
- EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID
@@ -978,9 +813,10 @@ CreateAmlCpuFromProcHierarchy (
Protocol Interface.
@param [in] ParentNode Parent node to attach the processor
container node to.
- @param [in] ProcHierarchyNodeInfo CM_ARM_PROC_HIERARCHY_INFO object used
- to create the node.
- @param [in] ProcContainerIndex Index used to generate the node name.
+ @param [in] ProcHierarchyNodeInfo CM_ARCH_COMMON_PROC_HIERARCHY_INFO object
+ used to create the node.
+ @param [in] ProcContainerName Name of the processor container.
+ @param [in] ProcContainerUid Uid of the processor container.
@param [out] ProcContainerNodePtr If success, contains the created processor
container node.
@@ -995,7 +831,7 @@ CreateAmlProcessorContainer (
IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN AML_NODE_HANDLE ParentNode,
- IN CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyNodeInfo,
+ IN CM_ARCH_COMMON_PROC_HIERARCHY_INFO *ProcHierarchyNodeInfo,
IN UINT16 ProcContainerName,
IN UINT32 ProcContainerUid,
OUT AML_OBJECT_NODE_HANDLE *ProcContainerNodePtr
@@ -1048,7 +884,7 @@ CreateAmlProcessorContainer (
}
// If a set of Lpi states are associated with the
- // CM_ARM_PROC_HIERARCHY_INFO, create an _LPI method returning them.
+ // CM_ARCH_COMMON_PROC_HIERARCHY_INFO, create an _LPI method returning them.
if (ProcHierarchyNodeInfo->LpiToken != CM_NULL_TOKEN) {
Status = CreateAmlLpiMethod (
Generator,
@@ -1126,8 +962,7 @@ CheckProcNode (
@param [in] Generator The SSDT Cpu Topology generator.
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
Protocol Interface.
- @param [in] NodeToken Token of the CM_ARM_PROC_HIERARCHY_INFO
- currently handled.
+ @param [in] NodeToken Token of the CM_ARCH_COMMON_PROC_HIERARCHY_INFO currently handled.
@param [in] ParentNode Parent node to attach the created
node to.
@param [in,out] ProcContainerIndex Pointer to the current processor container
@@ -1170,12 +1005,12 @@ CreateAmlCpuTopologyTree (
ProcContainerName = 0;
for (Index = 0; Index < Generator->ProcNodeCount; Index++) {
- // Find the children of the CM_ARM_PROC_HIERARCHY_INFO
+ // Find the children of the CM_ARCH_COMMON_PROC_HIERARCHY_INFO
// currently being handled (i.e. ParentToken == NodeToken).
if (Generator->ProcNodeList[Index].ParentToken == NodeToken) {
- // Only Cpus (leaf nodes in this tree) have a GicCToken.
+ // Only Cpus (leaf nodes in this tree) have a AcpiIdObjectToken.
// Create a Cpu node.
- if (Generator->ProcNodeList[Index].GicCToken != CM_NULL_TOKEN) {
+ if (Generator->ProcNodeList[Index].AcpiIdObjectToken != CM_NULL_TOKEN) {
Status = CheckProcNode (
Generator->ProcNodeList[Index].Flags,
TRUE,
@@ -1191,7 +1026,8 @@ CreateAmlCpuTopologyTree (
if (Generator->ProcNodeList[Index].OverrideNameUidEnabled) {
Name = Generator->ProcNodeList[Index].OverrideName;
} else {
- Name = CpuIndex;
+ ASSERT ((CpuIndex & ~MAX_UINT16) == 0);
+ Name = (UINT16)CpuIndex;
}
Status = CreateAmlCpuFromProcHierarchy (
@@ -1226,7 +1062,8 @@ CreateAmlCpuTopologyTree (
Name = Generator->ProcNodeList[Index].OverrideName;
Uid = Generator->ProcNodeList[Index].OverrideUid;
} else {
- Name = ProcContainerName;
+ ASSERT ((ProcContainerName & ~MAX_UINT16) == 0);
+ Name = (UINT16)ProcContainerName;
Uid = *ProcContainerIndex;
}
@@ -1279,8 +1116,8 @@ CreateAmlCpuTopologyTree (
return EFI_SUCCESS;
}
-/** Create the processor hierarchy AML tree from CM_ARM_PROC_HIERARCHY_INFO
- CM objects.
+/** Create the processor hierarchy AML tree from
+ CM_ARCH_COMMON_PROC_HIERARCHY_INFO CM objects.
@param [in] Generator The SSDT Cpu Topology generator.
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
@@ -1341,100 +1178,6 @@ exit_handler:
return Status;
}
-/** Create the processor hierarchy AML tree from CM_ARM_GICC_INFO
- CM objects.
-
- A processor container is by extension any non-leave device in the cpu topology.
-
- @param [in] Generator The SSDT Cpu Topology generator.
- @param [in] CfgMgrProtocol Pointer to the Configuration Manager
- Protocol Interface.
- @param [in] ScopeNode Scope node handle ('\_SB' scope).
-
- @retval EFI_SUCCESS Success.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
- @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-CreateTopologyFromGicC (
- IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
- IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
- IN AML_OBJECT_NODE_HANDLE ScopeNode
- )
-{
- EFI_STATUS Status;
- CM_ARM_GICC_INFO *GicCInfo;
- UINT32 GicCInfoCount;
- UINT32 Index;
- AML_OBJECT_NODE_HANDLE CpuNode;
-
- ASSERT (Generator != NULL);
- ASSERT (CfgMgrProtocol != NULL);
- ASSERT (ScopeNode != NULL);
-
- Status = GetEArmObjGicCInfo (
- CfgMgrProtocol,
- CM_NULL_TOKEN,
- &GicCInfo,
- &GicCInfoCount
- );
- if (EFI_ERROR (Status)) {
- ASSERT (0);
- return Status;
- }
-
- // For each CM_ARM_GICC_INFO object, create an AML node.
- for (Index = 0; Index < GicCInfoCount; Index++) {
- Status = CreateAmlCpu (
- Generator,
- ScopeNode,
- &GicCInfo[Index],
- Index,
- &CpuNode
- );
- if (EFI_ERROR (Status)) {
- ASSERT (0);
- break;
- }
-
- if (GicCInfo->PsdToken != CM_NULL_TOKEN) {
- Status = CreateAmlPsdNode (Generator, CfgMgrProtocol, GicCInfo, CpuNode);
- if (EFI_ERROR (Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
- }
-
- // If a CPC info is associated with the
- // GicCinfo, create an _CPC method returning them.
- if (GicCInfo[Index].CpcToken != CM_NULL_TOKEN) {
- Status = CreateAmlCpcNode (Generator, CfgMgrProtocol, &GicCInfo[Index], CpuNode);
- if (EFI_ERROR (Status)) {
- ASSERT_EFI_ERROR (Status);
- break;
- }
- }
-
- if (GicCInfo[Index].EtToken != CM_NULL_TOKEN) {
- Status = CreateAmlEtNode (
- Generator,
- CfgMgrProtocol,
- &GicCInfo[Index],
- Index,
- CpuNode
- );
- if (EFI_ERROR (Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
- }
- } // for
-
- return Status;
-}
-
/** Construct the SSDT Cpu Topology ACPI table.
This function invokes the Configuration Manager protocol interface
@@ -1467,12 +1210,12 @@ BuildSsdtCpuTopologyTable (
OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
)
{
- EFI_STATUS Status;
- AML_ROOT_NODE_HANDLE RootNode;
- AML_OBJECT_NODE_HANDLE ScopeNode;
- CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyNodeList;
- UINT32 ProcHierarchyNodeCount;
- ACPI_CPU_TOPOLOGY_GENERATOR *Generator;
+ EFI_STATUS Status;
+ AML_ROOT_NODE_HANDLE RootNode;
+ AML_OBJECT_NODE_HANDLE ScopeNode;
+ CM_ARCH_COMMON_PROC_HIERARCHY_INFO *ProcHierarchyNodeList;
+ UINT32 ProcHierarchyNodeCount;
+ ACPI_CPU_TOPOLOGY_GENERATOR *Generator;
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
@@ -1500,7 +1243,7 @@ BuildSsdtCpuTopologyTable (
// Get the processor hierarchy info and update the processor topology
// structure count with Processor Hierarchy Nodes (Type 0)
- Status = GetEArmObjProcHierarchyInfo (
+ Status = GetEArchCommonObjProcHierarchyInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
&ProcHierarchyNodeList,
@@ -1513,9 +1256,8 @@ BuildSsdtCpuTopologyTable (
}
if (Status == EFI_NOT_FOUND) {
- // If hierarchy information is not found generate a flat topology
- // using CM_ARM_GICC_INFO objects.
- Status = CreateTopologyFromGicC (
+ // If hierarchy information is not found generate a flat topology.
+ Status = CreateTopologyFromIntC (
Generator,
CfgMgrProtocol,
ScopeNode
@@ -1524,7 +1266,7 @@ BuildSsdtCpuTopologyTable (
goto exit_handler;
}
} else {
- // Generate the topology from CM_ARM_PROC_HIERARCHY_INFO objects.
+ // Generate the topology from CM_ARCH_COMMON_PROC_HIERARCHY_INFO objects.
Generator->ProcNodeList = ProcHierarchyNodeList;
Generator->ProcNodeCount = ProcHierarchyNodeCount;
@@ -1571,6 +1313,7 @@ exit_handler:
**/
STATIC
EFI_STATUS
+EFIAPI
FreeSsdtCpuTopologyTableResources (
IN CONST ACPI_TABLE_GENERATOR *CONST This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
@@ -1616,7 +1359,7 @@ ACPI_CPU_TOPOLOGY_GENERATOR SsdtCpuTopologyGenerator = {
// Minimum ACPI Table Revision - Unused
0,
// Creator ID
- TABLE_GENERATOR_CREATOR_ID_ARM,
+ TABLE_GENERATOR_CREATOR_ID,
// Creator Revision
SSDT_CPU_TOPOLOGY_GENERATOR_REVISION,
// Build Table function
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyGenerator.h b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyGenerator.h
new file mode 100644
index 0000000..a5d8017
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyGenerator.h
@@ -0,0 +1,343 @@
+/** @file
+ SSDT Cpu Topology Table Generator.
+
+ Copyright (c) 2021 - 2023, Arm Limited. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.3 Specification - January 2019 - s8.4 Declaring Processors
+ - ACPI for CoreSight version 1.2 Platform Design Document
+ (https://developer.arm.com/documentation/den0067/a/?lang=en)
+
+ @par Glossary:
+ - ETE - Embedded Trace Extension.
+ - ETM - Embedded Trace Macrocell.
+**/
+
+#ifndef SSDT_CPU_TOPOLOGY_GENERATOR_H_
+#define SSDT_CPU_TOPOLOGY_GENERATOR_H_
+
+#pragma pack(1)
+
+// Mask for the flags that need to be checked.
+#define PPTT_PROCESSOR_MASK ( \
+ (EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) | \
+ (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
+ (EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
+
+// Mask for the cpu flags.
+#define PPTT_CPU_PROCESSOR_MASK ( \
+ (EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \
+ (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
+ (EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
+
+// Mask for the cluster flags.
+// Even though a _UID is generated for clusters, it is simpler to use
+// EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID and to not match the cluster id of
+// the PPTT table (not sure the PPTT table is generated).
+#define PPTT_CLUSTER_PROCESSOR_MASK ( \
+ (EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \
+ (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID << 1) | \
+ (EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF << 3))
+
+// Leaf nodes specific mask.
+#define PPTT_LEAF_MASK ((EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
+ (EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
+
+/** LPI states are stored in the ASL namespace at '\_SB_.Lxxx',
+ with xxx being the node index of the LPI state.
+*/
+#define SB_SCOPE "\\_SB_"
+#define SB_SCOPE_PREFIX SB_SCOPE "."
+/// Size of the SB_SCOPE_PREFIX string.
+#define SB_SCOPE_PREFIX_SIZE sizeof (SB_SCOPE_PREFIX)
+
+/// HID for a processor device.
+#define ACPI_HID_PROCESSOR_DEVICE "ACPI0007"
+
+/// HID for a ETM/ETE device.
+#define ACPI_HID_ET_DEVICE "ARMHC500"
+
+/// HID for a processor container device.
+#define ACPI_HID_PROCESSOR_CONTAINER_DEVICE "ACPI0010"
+
+/** Node names of Cpus and Clusters are 'Cxxx', and 'Lxxx' for LPI states.
+ The 'xxx' is an index on 12 bits is given to node name,
+ thus the limitation in the number of nodes.
+*/
+#define MAX_NODE_COUNT (1 << 12)
+
+/** A structure used to handle the Lpi structures referencing.
+
+ A CM_ARCH_COMMON_PROC_HIERARCHY_INFO structure references a CM_ARCH_COMMON_OBJ_REF.
+ This CM_ARCH_COMMON_OBJ_REF references CM_ARCH_COMMON_LPI_INFO structures.
+
+ Example:
+ (Cpu0) (Cpu1)
+ CM_ARCH_COMMON_PROC_HIERARCHY_INFO CM_ARCH_COMMON_PROC_HIERARCHY_INFO
+ | |
+ +----------------------------------------
+ |
+ v
+ (List of references to Lpi states)
+ CM_ARCH_COMMON_OBJ_REF
+ |
+ +----------------------------------------
+ | |
+ v v
+ (A first Lpi state) (A second Lpi state)
+ CM_ARCH_COMMON_LPI_INFO[0] CM_ARCH_COMMON_LPI_INFO[1]
+
+ Here, Cpu0 and Cpu1 have the same Lpi states. Both CM_ARCH_COMMON_PROC_HIERARCHY_INFO
+ structures reference the same CM_ARCH_COMMON_OBJ_REF. An entry is created in the
+ TokenTable such as:
+ 0 <-> CM_ARCH_COMMON_OBJ_REF
+
+ This will lead to the creation of this pseudo-ASL code where Cpu0 and Cpu1
+ return the same object at \_SB.L000:
+ Scope (\_SB) {
+ Device (C000) {
+ [...]
+ Method (_LPI) {
+ Return (\_SB.L000)
+ }
+ } // C000
+
+ Device (C001) {
+ [...]
+ Method (_LPI) {
+ Return (\_SB.L000)
+ }
+ } // C001
+
+ // Lpi states
+ Name (L000, Package (0x05) {
+ [...]
+ }
+ }
+*/
+typedef struct TokenTable {
+ /// TokenTable, a table allowing to map:
+ /// Index <-> CM_OBJECT_TOKEN (to CM_ARCH_COMMON_LPI_INFO structures).
+ CM_OBJECT_TOKEN *Table;
+
+ /// Last used index of the TokenTable.
+ /// LastIndex is bound by ProcNodeCount.
+ UINT32 LastIndex;
+} TOKEN_TABLE;
+
+/** A structure holding the Cpu topology generator and additional private data.
+*/
+typedef struct AcpiCpuTopologyGenerator {
+ /// ACPI Table generator header
+ ACPI_TABLE_GENERATOR Header;
+
+ // Private fields are defined from here.
+
+ /// Private object used to handle token referencing.
+ TOKEN_TABLE TokenTable;
+ /// List of CM_ARCH_COMMON_PROC_HIERARCHY_INFO CM objects.
+ CM_ARCH_COMMON_PROC_HIERARCHY_INFO *ProcNodeList;
+ /// Count of CM_ARCH_COMMON_PROC_HIERARCHY_INFO CM objects.
+ UINT32 ProcNodeCount;
+} ACPI_CPU_TOPOLOGY_GENERATOR;
+
+#pragma pack()
+
+/** Write a string 'Xxxx\0' in AslName (5 bytes long),
+ with 'X' being the leading char of the name, and
+ with 'xxx' being Value in hexadecimal.
+
+ As 'xxx' in hexadecimal represents a number on 12 bits,
+ we have Value < (1 << 12).
+
+ @param [in] LeadChar Leading char of the name.
+ @param [in] Value Hex value of the name.
+ Must be lower than (2 << 12).
+ @param [in, out] AslName Pointer to write the 'Xxxx' string to.
+ Must be at least 5 bytes long.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+WriteAslName (
+ IN CHAR8 LeadChar,
+ IN UINT32 Value,
+ IN OUT CHAR8 *AslName
+ );
+
+/** Get generic interrupt information from arch specific CM objects.
+
+ The AcpiProcessorUid, CpcToken, etc. are held in arch specific CM objects,
+ in the CM_ARM_GICC_INFO CM object for Arm for instance.
+ This wrapper allows to get this information from each arch object.
+
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in] AcpiProcessorUid ACPI processor Uid of the local intc (gicc, other)
+ other fields from.
+ @param [out] AcpiProcessorUid AcpiProcessorUid of the CPU identified by
+ the AcpiIdObjectToken.
+ @param [out] CpcToken CpcToken of the CPU identified by
+ the AcpiIdObjectToken.
+ @param [out] PsdToken PsdToken of the CPU identified by
+ the AcpiIdObjectToken.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_NOT_FOUND Not found.
+**/
+EFI_STATUS
+EFIAPI
+GetIntCInfo (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN CM_OBJECT_TOKEN AcpiIdObjectToken,
+ OUT UINT32 *AcpiProcessorUid,
+ OUT CM_OBJECT_TOKEN *CpcToken,
+ OUT CM_OBJECT_TOKEN *PsdToken
+ );
+
+/** Create and add an _CPC Node to Cpu Node.
+
+ For instance, transform an AML node from:
+ Device (C002)
+ {
+ Name (_UID, 2)
+ Name (_HID, "ACPI0007")
+ }
+
+ To:
+ Device (C002)
+ {
+ Name (_UID, 2)
+ Name (_HID, "ACPI0007")
+ Name(_CPC, Package()
+ {
+ NumEntries, // Integer
+ Revision, // Integer
+ HighestPerformance, // Integer or Buffer (Resource Descriptor)
+ NominalPerformance, // Integer or Buffer (Resource Descriptor)
+ LowestNonlinearPerformance, // Integer or Buffer (Resource Descriptor)
+ LowestPerformance, // Integer or Buffer (Resource Descriptor)
+ GuaranteedPerformanceRegister, // Buffer (Resource Descriptor)
+ DesiredPerformanceRegister , // Buffer (Resource Descriptor)
+ MinimumPerformanceRegister , // Buffer (Resource Descriptor)
+ MaximumPerformanceRegister , // Buffer (Resource Descriptor)
+ PerformanceReductionToleranceRegister, // Buffer (Resource Descriptor)
+ TimeWindowRegister, // Buffer (Resource Descriptor)
+ CounterWraparoundTime, // Integer or Buffer (Resource Descriptor)
+ ReferencePerformanceCounterRegister, // Buffer (Resource Descriptor)
+ DeliveredPerformanceCounterRegister, // Buffer (Resource Descriptor)
+ PerformanceLimitedRegister, // Buffer (Resource Descriptor)
+ CPPCEnableRegister // Buffer (Resource Descriptor)
+ AutonomousSelectionEnable, // Integer or Buffer (Resource Descriptor)
+ AutonomousActivityWindowRegister, // Buffer (Resource Descriptor)
+ EnergyPerformancePreferenceRegister, // Buffer (Resource Descriptor)
+ ReferencePerformance // Integer or Buffer (Resource Descriptor)
+ LowestFrequency, // Integer or Buffer (Resource Descriptor)
+ NominalFrequency // Integer or Buffer (Resource Descriptor)
+ })
+ }
+
+ @param [in] Generator The SSDT Cpu Topology generator.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in] CpcToken CPC token of the INTC info
+ describing the Cpu.
+ @param [in] Node CPU Node to which the _CPC node is
+ attached.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+CreateAmlCpcNode (
+ IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN CM_OBJECT_TOKEN CpcToken,
+ IN AML_OBJECT_NODE_HANDLE *Node
+ );
+
+/** Create a Cpu in the AML namespace.
+
+ This generates the following ASL code:
+ Device (C002)
+ {
+ Name (_UID, 2)
+ Name (_HID, "ACPI0007")
+ }
+
+ @param [in] Generator The SSDT Cpu Topology generator.
+ @param [in] ParentNode Parent node to attach the Cpu node to.
+ @param [in] AcpiProcessorUid ACPI processor UID of the CPU.
+ @param [in] CpuName Value used to generate the node name.
+ @param [out] CpuNodePtr If not NULL, return the created Cpu node.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+CreateAmlCpu (
+ IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
+ IN AML_NODE_HANDLE ParentNode,
+ IN UINT32 AcpiProcessorUid,
+ IN UINT32 CpuName,
+ OUT AML_OBJECT_NODE_HANDLE *CpuNodePtr OPTIONAL
+ );
+
+/** Create the processor hierarchy AML tree from arch specific CM objects.
+
+ The Arm architecture will use the CM_ARM_GICC_INFO CM objects for instance.
+ A processor container is by extension any non-leave device in the cpu topology.
+
+ @param [in] Generator The SSDT Cpu Topology generator.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in] ScopeNode Scope node handle ('\_SB' scope).
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+CreateTopologyFromIntC (
+ IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN AML_OBJECT_NODE_HANDLE ScopeNode
+ );
+
+/** Add arch specific information to a CPU node in the asl description.
+
+ @param [in] Generator The SSDT Cpu Topology generator.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in] AcpiIdObjectToken AcpiIdObjectToken identifying the CPU to fetch the
+ other fields from.
+ @param [in] CpuName Value used to generate the CPU node name.
+ @param [out] CpuNode CPU Node to which the ET device node is
+ attached.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_NOT_FOUND Not found.
+ @retval EFI_UNSUPPORTED Feature Unsupported.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+AddArchAmlCpuInfo (
+ IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN CM_OBJECT_TOKEN AcpiIdObjectToken,
+ IN UINT32 CpuName,
+ OUT AML_OBJECT_NODE_HANDLE *CpuNode
+ );
+
+#endif // SSDT_CPU_TOPOLOGY_GENERATOR_H_
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyLibArm.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyLib.inf
index 3e2d154..93ede69 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyLib.inf
@@ -8,7 +8,7 @@
[Defines]
INF_VERSION = 0x0001001B
- BASE_NAME = SsdtCpuTopologyLibArm
+ BASE_NAME = SsdtCpuTopologyLib
FILE_GUID = F2835EB6-4B05-48D4-A475-147DA0F3755C
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
@@ -20,11 +20,16 @@
SsdtCpuTopologyGenerator.c
SsdtCpuTopologyGenerator.h
+[Sources.ARM, Sources.AARCH64]
+ Arm/ArmSsdtCpuTopologyGenerator.c
+
+[Packages.ARM, Packages.AARCH64]
+ ArmPlatformPkg/ArmPlatformPkg.dec
+
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
DynamicTablesPkg/DynamicTablesPkg.dec
[LibraryClasses]
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerator.c
index 7287370..7fe780d 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerator.c
@@ -42,46 +42,46 @@
Requirements:
The following Configuration Manager Object(s) are required by
this Generator:
- - EArmObjCmRef
- - EArmObjPciConfigSpaceInfo
- - EArmObjPciAddressMapInfo
- - EArmObjPciInterruptMapInfo
+ - EArchCommonObjCmRef
+ - EArchCommonObjPciConfigSpaceInfo
+ - EArchCommonObjPciAddressMapInfo
+ - EArchCommonObjPciInterruptMapInfo
*/
/** 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
+ EObjNameSpaceArchCommon,
+ EArchCommonObjCmRef,
+ CM_ARCH_COMMON_OBJ_REF
);
/** This macro expands to a function that retrieves the Pci
Configuration Space Information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPciConfigSpaceInfo,
- CM_ARM_PCI_CONFIG_SPACE_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjPciConfigSpaceInfo,
+ CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO
);
/** This macro expands to a function that retrieves the Pci
Address Mapping Information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPciAddressMapInfo,
- CM_ARM_PCI_ADDRESS_MAP_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjPciAddressMapInfo,
+ CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO
);
/** This macro expands to a function that retrieves the Pci
Interrupt Mapping Information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjPciInterruptMapInfo,
- CM_ARM_PCI_INTERRUPT_MAP_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjPciInterruptMapInfo,
+ CM_ARCH_COMMON_PCI_INTERRUPT_MAP_INFO
);
/** Initialize the MappingTable.
@@ -208,9 +208,9 @@ STATIC
EFI_STATUS
EFIAPI
GeneratePciDeviceInfo (
- IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo,
- IN UINT32 Uid,
- IN OUT AML_OBJECT_NODE_HANDLE PciNode
+ IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciInfo,
+ IN UINT32 Uid,
+ IN OUT AML_OBJECT_NODE_HANDLE PciNode
)
{
EFI_STATUS Status;
@@ -305,17 +305,17 @@ EFIAPI
GeneratePrt (
IN ACPI_PCI_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
- IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo,
+ IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciInfo,
IN UINT32 Uid,
IN OUT AML_OBJECT_NODE_HANDLE PciNode
)
{
- EFI_STATUS Status;
- INT32 Index;
- AML_OBJECT_NODE_HANDLE PrtNode;
- CM_ARM_OBJ_REF *RefInfo;
- UINT32 RefCount;
- CM_ARM_PCI_INTERRUPT_MAP_INFO *IrqMapInfo;
+ EFI_STATUS Status;
+ UINT32 Index;
+ AML_OBJECT_NODE_HANDLE PrtNode;
+ CM_ARCH_COMMON_OBJ_REF *RefInfo;
+ UINT32 RefCount;
+ CM_ARCH_COMMON_PCI_INTERRUPT_MAP_INFO *IrqMapInfo;
ASSERT (Generator != NULL);
ASSERT (CfgMgrProtocol != NULL);
@@ -324,9 +324,9 @@ GeneratePrt (
PrtNode = NULL;
- // Get the array of CM_ARM_OBJ_REF referencing the
- // CM_ARM_PCI_INTERRUPT_MAP_INFO objects.
- Status = GetEArmObjCmRef (
+ // Get the array of CM_ARCH_COMMON_OBJ_REF referencing the
+ // CM_ARCH_COMMON_PCI_INTERRUPT_MAP_INFO objects.
+ Status = GetEArchCommonObjCmRef (
CfgMgrProtocol,
PciInfo->InterruptMapToken,
&RefInfo,
@@ -352,8 +352,8 @@ GeneratePrt (
}
for (Index = 0; Index < RefCount; Index++) {
- // Get CM_ARM_PCI_INTERRUPT_MAP_INFO structures one by one.
- Status = GetEArmObjPciInterruptMapInfo (
+ // Get CM_ARCH_COMMON_PCI_INTERRUPT_MAP_INFO structures one by one.
+ Status = GetEArchCommonObjPciInterruptMapInfo (
CfgMgrProtocol,
RefInfo[Index].ReferenceToken,
&IrqMapInfo,
@@ -451,18 +451,18 @@ EFIAPI
GeneratePciCrs (
IN ACPI_PCI_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
- IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo,
+ IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciInfo,
IN OUT AML_OBJECT_NODE_HANDLE PciNode
)
{
- EFI_STATUS Status;
- BOOLEAN Translation;
- UINT32 Index;
- CM_ARM_OBJ_REF *RefInfo;
- UINT32 RefCount;
- CM_ARM_PCI_ADDRESS_MAP_INFO *AddrMapInfo;
- AML_OBJECT_NODE_HANDLE CrsNode;
- BOOLEAN IsPosDecode;
+ EFI_STATUS Status;
+ BOOLEAN Translation;
+ UINT32 Index;
+ CM_ARCH_COMMON_OBJ_REF *RefInfo;
+ UINT32 RefCount;
+ CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO *AddrMapInfo;
+ AML_OBJECT_NODE_HANDLE CrsNode;
+ BOOLEAN IsPosDecode;
ASSERT (Generator != NULL);
ASSERT (CfgMgrProtocol != NULL);
@@ -505,9 +505,9 @@ GeneratePciCrs (
return Status;
}
- // Get the array of CM_ARM_OBJ_REF referencing the
- // CM_ARM_PCI_ADDRESS_MAP_INFO objects.
- Status = GetEArmObjCmRef (
+ // Get the array of CM_ARCH_COMMON_OBJ_REF referencing the
+ // CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO objects.
+ Status = GetEArchCommonObjCmRef (
CfgMgrProtocol,
PciInfo->AddressMapToken,
&RefInfo,
@@ -519,8 +519,8 @@ GeneratePciCrs (
}
for (Index = 0; Index < RefCount; Index++) {
- // Get CM_ARM_PCI_ADDRESS_MAP_INFO structures one by one.
- Status = GetEArmObjPciAddressMapInfo (
+ // Get CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO structures one by one.
+ Status = GetEArchCommonObjPciAddressMapInfo (
CfgMgrProtocol,
RefInfo[Index].ReferenceToken,
&AddrMapInfo,
@@ -561,6 +561,11 @@ GeneratePciCrs (
break;
case PCI_SS_M32:
+ ASSERT ((AddrMapInfo->PciAddress & ~MAX_UINT32) == 0);
+ ASSERT (((AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1) & ~MAX_UINT32) == 0);
+ ASSERT (((Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0) & ~MAX_UINT32) == 0);
+ ASSERT ((AddrMapInfo->AddressSize & ~MAX_UINT32) == 0);
+
Status = AmlCodeGenRdDWordMemory (
FALSE,
IsPosDecode,
@@ -569,10 +574,10 @@ GeneratePciCrs (
AmlMemoryCacheable,
TRUE,
0,
- AddrMapInfo->PciAddress,
- AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
- Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,
- AddrMapInfo->AddressSize,
+ (UINT32)(AddrMapInfo->PciAddress),
+ (UINT32)(AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1),
+ (UINT32)(Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0),
+ (UINT32)(AddrMapInfo->AddressSize),
0,
NULL,
AmlAddressRangeMemory,
@@ -693,7 +698,7 @@ EFIAPI
ReserveEcamSpace (
IN ACPI_PCI_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
- IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo,
+ IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciInfo,
IN OUT AML_OBJECT_NODE_HANDLE PciNode
)
{
@@ -760,7 +765,7 @@ EFIAPI
GeneratePciDevice (
IN ACPI_PCI_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
- IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo,
+ IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciInfo,
IN UINT32 Uid,
IN OUT AML_ROOT_NODE_HANDLE *RootNode
)
@@ -863,7 +868,7 @@ BuildSsdtPciTable (
IN ACPI_PCI_GENERATOR *Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
- IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo,
+ IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciInfo,
IN UINT32 Uid,
OUT EFI_ACPI_DESCRIPTION_HEADER **Table
)
@@ -971,13 +976,13 @@ BuildSsdtPciTableEx (
OUT UINTN *CONST TableCount
)
{
- EFI_STATUS Status;
- CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo;
- UINT32 PciCount;
- UINTN Index;
- EFI_ACPI_DESCRIPTION_HEADER **TableList;
- ACPI_PCI_GENERATOR *Generator;
- UINT32 Uid;
+ EFI_STATUS Status;
+ CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciInfo;
+ UINT32 PciCount;
+ UINT32 Index;
+ EFI_ACPI_DESCRIPTION_HEADER **TableList;
+ ACPI_PCI_GENERATOR *Generator;
+ UINT32 Uid;
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
@@ -990,7 +995,7 @@ BuildSsdtPciTableEx (
*TableCount = 0;
Generator = (ACPI_PCI_GENERATOR *)This;
- Status = GetEArmObjPciConfigSpaceInfo (
+ Status = GetEArchCommonObjPciConfigSpaceInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
&PciInfo,
@@ -1163,7 +1168,7 @@ ACPI_PCI_GENERATOR SsdtPcieGenerator = {
// Minimum ACPI Table Revision - Unused
0,
// Creator ID
- TABLE_GENERATOR_CREATOR_ID_ARM,
+ TABLE_GENERATOR_CREATOR_ID,
// Creator Revision
SSDT_PCI_GENERATOR_REVISION,
// Build table function. Use the extended version instead.
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerator.h
index 7410f9f..7410f9f 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerator.h
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieLib.inf
index c2a1acb..440b0d7 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieLib.inf
@@ -8,7 +8,7 @@
[Defines]
INF_VERSION = 0x0001001B
- BASE_NAME = SsdtPcieLibArm
+ BASE_NAME = SsdtPcieLib
FILE_GUID = E431D7FD-26BF-4E3D-9064-5B13B0439057
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtSerialPortLib/SsdtSerialPortGenerator.c
index b850320..bbd8b65 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtSerialPortLib/SsdtSerialPortGenerator.c
@@ -29,16 +29,16 @@
Requirements:
The following Configuration Manager Object(s) are required by
this Generator:
- - EArmObjSerialPortInfo
+ - EArchCommonObjSerialPortInfo
*/
/** This macro expands to a function that retrieves the Serial-port
information from the Configuration Manager.
*/
GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjSerialPortInfo,
- CM_ARM_SERIAL_PORT_INFO
+ EObjNameSpaceArchCommon,
+ EArchCommonObjSerialPortInfo,
+ CM_ARCH_COMMON_SERIAL_PORT_INFO
);
/** Starting value for the UID to represent the serial ports.
@@ -167,13 +167,13 @@ BuildSsdtSerialPortTableEx (
OUT UINTN *CONST TableCount
)
{
- EFI_STATUS Status;
- CM_ARM_SERIAL_PORT_INFO *SerialPortInfo;
- UINT32 SerialPortCount;
- UINTN Index;
- CHAR8 NewName[AML_NAME_SEG_SIZE + 1];
- UINT64 Uid;
- EFI_ACPI_DESCRIPTION_HEADER **TableList;
+ EFI_STATUS Status;
+ CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo;
+ UINT32 SerialPortCount;
+ UINTN Index;
+ CHAR8 NewName[AML_NAME_SEG_SIZE + 1];
+ UINT64 Uid;
+ EFI_ACPI_DESCRIPTION_HEADER **TableList;
ASSERT (This != NULL);
ASSERT (AcpiTableInfo != NULL);
@@ -185,7 +185,7 @@ BuildSsdtSerialPortTableEx (
*Table = NULL;
- Status = GetEArmObjSerialPortInfo (
+ Status = GetEArchCommonObjSerialPortInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
&SerialPortInfo,
@@ -301,7 +301,7 @@ ACPI_TABLE_GENERATOR SsdtSerialPortGenerator = {
// Minimum ACPI Table Revision - Unused
0,
// Creator ID
- TABLE_GENERATOR_CREATOR_ID_ARM,
+ TABLE_GENERATOR_CREATOR_ID,
// Creator Revision
SSDT_SERIAL_GENERATOR_REVISION,
// Build table function. Use the extended version instead.
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtSerialPortLib/SsdtSerialPortLib.inf
index 36e61ea..24d7db5 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtSerialPortLib/SsdtSerialPortLib.inf
@@ -8,7 +8,7 @@
[Defines]
INF_VERSION = 0x0001001B
- BASE_NAME = SsdtSerialPortLibArm
+ BASE_NAME = SsdtSerialPortLib
FILE_GUID = D1F92325-2DFB-435C-9B4C-A6B864F19230
VERSION_STRING = 1.0
MODULE_TYPE = DXE_DRIVER
@@ -19,11 +19,13 @@
[Sources]
SsdtSerialPortGenerator.c
+[Packages.ARM, Packages.AARCH64]
+ ArmPlatformPkg/ArmPlatformPkg.dec
+
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
- ArmPlatformPkg/ArmPlatformPkg.dec
DynamicTablesPkg/DynamicTablesPkg.dec
[LibraryClasses]
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/AcpiTpm2Lib.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/AcpiTpm2Lib.inf
new file mode 100644
index 0000000..ee50fc6
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/AcpiTpm2Lib.inf
@@ -0,0 +1,29 @@
+## @file
+# TPM2 Table Generator
+#
+# Copyright (c) 2022, ARM Limited. All rights reserved.
+# Copyright (c) 2023 - 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION = 0x0001001B
+ BASE_NAME = AcpiTpm2Lib
+ FILE_GUID = 968fa07a-9076-11ed-8041-9bd740d3d45d
+ VERSION_STRING = 1.0
+ MODULE_TYPE = DXE_DRIVER
+ LIBRARY_CLASS = NULL|DXE_DRIVER
+ CONSTRUCTOR = AcpiTpm2LibConstructor
+ DESTRUCTOR = AcpiTpm2LibDestructor
+
+[Sources]
+ Tpm2Generator.c
+
+[Packages]
+ EmbeddedPkg/EmbeddedPkg.dec
+ DynamicTablesPkg/DynamicTablesPkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ BaseLib
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/Tpm2Generator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/Tpm2Generator.c
new file mode 100644
index 0000000..7255c93
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiTpm2Lib/Tpm2Generator.c
@@ -0,0 +1,405 @@
+/** @file
+ TPM2 Table Generator
+
+ Copyright (c) 2022, ARM Limited. All rights reserved.
+ Copyright (c) 2023 - 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - TCG ACPI Specification Family for TPM 1.2 and 2.0 Version 1.3 Revision 8'
+ (https://trustedcomputinggroup.org/wp-content/uploads/TCG_ACPIGeneralSpec_v1p3_r8_pub.pdf)
+
+ @par Glossary:
+ - Cm or CM - Configuration Manager
+ - Obj or OBJ - Object
+**/
+
+#include <Library/AcpiLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.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>
+
+#include <IndustryStandard/Tpm2Acpi.h>
+
+#define START_METHOD_ACPI_PARAM_SIZE_MIN 4
+#define START_METHOD_CRB_WITH_SMC_PARAM_SIZE 12
+
+/**
+ ARM standard TPM2 Generator
+
+ Requirements:
+ The following Configuration Manager Object(s) are used by this Generator:
+ - EArchCommonObjTpm2InterfaceInfo
+*/
+
+/**
+ This macro expands to a function that retrieves the Processor Hierarchy
+ information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArchCommon,
+ EArchCommonObjTpm2InterfaceInfo,
+ CM_ARCH_COMMON_TPM2_INTERFACE_INFO
+ );
+
+/**
+ Sanity check Start Method Specific Parameters field
+
+ @param [in] TpmInfo Pointer to the CM TPM2 object
+
+ @retval EFI_SUCCESS No failure
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+**/
+STATIC
+EFI_STATUS
+AcpiTpm2CheckStartMethodParameters (
+ CM_ARCH_COMMON_TPM2_INTERFACE_INFO *TpmInfo
+ )
+{
+ ASSERT (TpmInfo != NULL);
+
+ if (sizeof (TpmInfo->StartMethodParameters) < TpmInfo->StartMethodParametersSize) {
+ ASSERT (FALSE);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ // LAML and LASA are either both set or both zeros
+ if (((TpmInfo->Laml > 0) && (TpmInfo->Lasa == 0)) ||
+ ((TpmInfo->Laml == 0) && (TpmInfo->Lasa != 0)))
+ {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ // Verify StartMethodParametersSize based on StartMethod
+ switch (TpmInfo->StartMethod) {
+ case EFI_TPM2_ACPI_TABLE_START_METHOD_ACPI:
+ // If the Start Method value is 2, then this field is at least four
+ // bytes in size and the first four bytes must be all zero.
+ if (TpmInfo->StartMethodParametersSize < START_METHOD_ACPI_PARAM_SIZE_MIN) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (((UINT32 *)TpmInfo->StartMethodParameters)[0] != 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ break;
+
+ case EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE_WITH_SMC:
+ // If the Start Method value is 11 then this field is 12 bytes in size
+ if (TpmInfo->StartMethodParametersSize != START_METHOD_CRB_WITH_SMC_PARAM_SIZE) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ break;
+
+ case EFI_TPM2_ACPI_TABLE_START_METHOD_TIS:
+ case EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE:
+ case EFI_TPM2_ACPI_TABLE_START_METHOD_COMMAND_RESPONSE_BUFFER_INTERFACE_WITH_ACPI:
+ break;
+
+ default:
+ return EFI_INVALID_PARAMETER;
+ break;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/** Construct the TPM2 ACPI table.
+
+ Called by the Dynamic Table Manager, this function invokes the
+ Configuration Manager protocol interface to get the required hardware
+ information for generating the ACPI table.
+
+ If this function allocates any resources then they must be freed
+ in the FreeTpm2TableResources function.
+
+ @param [in] This Pointer to the table generator.
+ @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [out] Table Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object was not found.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
+ Manager is less than the Object size for the
+ requested object.
+ @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+BuildTpm2Table (
+ IN CONST ACPI_TABLE_GENERATOR *CONST This,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
+ )
+{
+ EFI_STATUS Status;
+ UINT32 TableSize;
+ CM_ARCH_COMMON_TPM2_INTERFACE_INFO *TpmInfo;
+ EFI_TPM2_ACPI_TABLE *Tpm2;
+ UINT32 *Laml;
+ UINT64 *Lasa;
+
+ *Table = NULL;
+
+ ASSERT (
+ (This != NULL) &&
+ (AcpiTableInfo != NULL) &&
+ (CfgMgrProtocol != NULL) &&
+ (Table != NULL) &&
+ (AcpiTableInfo->TableGeneratorId == This->GeneratorID) &&
+ (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature)
+ );
+
+ if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
+ (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+ {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: TPM2: Requested table revision = %d is not supported. "
+ "Supported table revisions: Minimum = %d. Maximum = %d\n",
+ AcpiTableInfo->AcpiTableRevision,
+ This->MinAcpiTableRevision,
+ This->AcpiTableRevision
+ ));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = GetEArchCommonObjTpm2InterfaceInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &TpmInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Failed to get TPM interface CM Object %r\n",
+ __func__,
+ Status
+ ));
+ return Status;
+ }
+
+ // Sanity check Start Method Specific Parameters field
+ Status = AcpiTpm2CheckStartMethodParameters (TpmInfo);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: TPM2: Unexpected StartMethod %u with parameters size %u\n",
+ TpmInfo->StartMethod,
+ TpmInfo->StartMethodParametersSize
+ ));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ // Calculate the size of the TPM2 table
+ TableSize = sizeof (EFI_TPM2_ACPI_TABLE);
+ if (TpmInfo->Laml == 0) {
+ TableSize += TpmInfo->StartMethodParametersSize;
+ } else {
+ // If LAML and LASA are present, then StartMethodParameters field would get
+ // max size regardless of StartMethod value
+ TableSize += EFI_TPM2_ACPI_TABLE_START_METHOD_SPECIFIC_PARAMETERS_MAX_SIZE_REVISION_4;
+ TableSize += sizeof (TpmInfo->Laml) + sizeof (TpmInfo->Lasa);
+ }
+
+ // Allocate the Buffer for TPM2 table
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize);
+ if (*Table == NULL) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: TPM2: Failed to allocate memory for TPM2 Table, Size = %d," \
+ " Status = %r\n",
+ TableSize,
+ Status
+ ));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Tpm2 = (EFI_TPM2_ACPI_TABLE *)*Table;
+
+ Status = AddAcpiHeader (
+ CfgMgrProtocol,
+ This,
+ &Tpm2->Header,
+ AcpiTableInfo,
+ TableSize
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: TPM2: Failed to add ACPI header. Status = %r\n",
+ Status
+ ));
+ goto error_handler;
+ }
+
+ Tpm2->Flags = TpmInfo->PlatformClass;
+ Tpm2->AddressOfControlArea = TpmInfo->AddressOfControlArea;
+ Tpm2->StartMethod = TpmInfo->StartMethod;
+
+ CopyMem (
+ Tpm2 + 1,
+ TpmInfo->StartMethodParameters,
+ TpmInfo->StartMethodParametersSize
+ );
+
+ if (TpmInfo->Laml > 0) {
+ Laml = (UINT32 *)((UINT8 *)Tpm2 + sizeof (EFI_TPM2_ACPI_TABLE) +
+ EFI_TPM2_ACPI_TABLE_START_METHOD_SPECIFIC_PARAMETERS_MAX_SIZE_REVISION_4);
+ Lasa = (UINT64 *)((UINT8 *)Laml + sizeof (TpmInfo->Laml));
+ *Laml = TpmInfo->Laml;
+ *Lasa = TpmInfo->Lasa;
+ }
+
+ return EFI_SUCCESS;
+
+error_handler:
+
+ if (*Table != NULL) {
+ FreePool (*Table);
+ *Table = NULL;
+ }
+
+ return Status;
+}
+
+/** Free any resources allocated for constructing the TPM2.
+
+ @param [in] This Pointer to the table generator.
+ @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in, out] Table Pointer to the ACPI Table.
+
+ @retval EFI_SUCCESS The resources were freed successfully.
+ @retval EFI_INVALID_PARAMETER The table pointer is NULL or invalid.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+FreeTpm2TableResources (
+ IN CONST ACPI_TABLE_GENERATOR *CONST This,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
+ )
+{
+ ASSERT (
+ (This != NULL) &&
+ (AcpiTableInfo != NULL) &&
+ (CfgMgrProtocol != NULL) &&
+ (AcpiTableInfo->TableGeneratorId == This->GeneratorID) &&
+ (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature)
+ );
+
+ if ((Table == NULL) || (*Table == NULL)) {
+ DEBUG ((DEBUG_ERROR, "ERROR: TPM2: Invalid Table Pointer\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ FreePool (*Table);
+ *Table = NULL;
+
+ return EFI_SUCCESS;
+}
+
+/** The TPM2 Table Generator revision.
+*/
+#define TPM2_GENERATOR_REVISION CREATE_REVISION (1, 0)
+
+/** The interface for the TPM2 Table Generator.
+*/
+STATIC
+CONST
+ACPI_TABLE_GENERATOR Tpm2Generator = {
+ // Generator ID
+ CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdTpm2),
+ // Generator Description
+ L"ACPI.STD.TPM2.GENERATOR",
+ // ACPI Table Signature
+ EFI_ACPI_6_4_TRUSTED_COMPUTING_PLATFORM_2_TABLE_SIGNATURE,
+ // ACPI Table Revision supported by this Generator
+ EFI_TPM2_ACPI_TABLE_REVISION_4,
+ // Minimum supported ACPI Table Revision
+ EFI_TPM2_ACPI_TABLE_REVISION_4,
+ // Creator ID
+ TABLE_GENERATOR_CREATOR_ID,
+ // Creator Revision
+ TPM2_GENERATOR_REVISION,
+ // Build Table function
+ BuildTpm2Table,
+ // Free Resource function
+ FreeTpm2TableResources,
+ // Extended build function not needed
+ NULL,
+ // Extended build function not implemented by the generator.
+ // Hence extended free resource function is not required.
+ NULL
+};
+
+/** Register the Generator with the ACPI Table Factory.
+
+ @param [in] ImageHandle The handle to the image.
+ @param [in] SystemTable Pointer to the System Table.
+
+ @retval EFI_SUCCESS The Generator is registered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_ALREADY_STARTED The Generator for the Table ID
+ is already registered.
+**/
+EFI_STATUS
+EFIAPI
+AcpiTpm2LibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = RegisterAcpiTableGenerator (&Tpm2Generator);
+ DEBUG ((DEBUG_INFO, "TPM2: Register Generator. Status = %r\n", Status));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+/** Deregister the Generator from the ACPI Table Factory.
+
+ @param [in] ImageHandle The handle to the image.
+ @param [in] SystemTable Pointer to the System Table.
+
+ @retval EFI_SUCCESS The Generator is deregistered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The Generator is not registered.
+**/
+EFI_STATUS
+EFIAPI
+AcpiTpm2LibDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = DeregisterAcpiTableGenerator (&Tpm2Generator);
+ DEBUG ((DEBUG_INFO, "TPM2: Deregister Generator. Status = %r\n", Status));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
diff --git a/DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/AcpiWsmtLib.inf b/DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/AcpiWsmtLib.inf
new file mode 100644
index 0000000..06e8f8c
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/AcpiWsmtLib.inf
@@ -0,0 +1,35 @@
+## @file
+# WSMT Table Generator
+#
+# Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION = 1.30
+ BASE_NAME = AcpiWsmtLib
+ FILE_GUID = FA6B175A-0AAF-4BFA-843A-1D885206C070
+ VERSION_STRING = 1.0
+ MODULE_TYPE = DXE_DRIVER
+ LIBRARY_CLASS = NULL|DXE_DRIVER
+ CONSTRUCTOR = AcpiWsmtLibConstructor
+ DESTRUCTOR = AcpiWsmtLibDestructor
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources.IA32, Sources.X64]
+ WsmtGenerator.c
+
+[Packages]
+ DynamicTablesPkg/DynamicTablesPkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ DebugLib
diff --git a/DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/WsmtGenerator.c b/DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/WsmtGenerator.c
new file mode 100644
index 0000000..9762294
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/X64/AcpiWsmtLib/WsmtGenerator.c
@@ -0,0 +1,288 @@
+/** @file
+ WSMT Table Generator Implementation.
+
+ This file implements the WSMT Table Generator.
+ The WSMT table is used to specify the security mitigation
+ that are enabled in the Windows OS.
+
+ Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <AcpiTableGenerator.h>
+#include <ConfigurationManagerHelper.h>
+#include <ConfigurationManagerObject.h>
+#include <IndustryStandard/WindowsSmmSecurityMitigationTable.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/TableHelperLib.h>
+#include <Protocol/AcpiTable.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+#include <X64NameSpaceObjects.h>
+
+#define WSMT_PROTECTION_VALID_FLAGS \
+ (EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS | \
+ EFI_WSMT_PROTECTION_FLAGS_COMM_BUFFER_NESTED_PTR_PROTECTION | \
+ EFI_WSMT_PROTECTION_FLAGS_SYSTEM_RESOURCE_PROTECTION)
+
+/** This macro expands to a function that retrieves the
+ WSMT protection flags information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceX64,
+ EX64ObjWsmtFlagsInfo,
+ CM_X64_WSMT_FLAGS_INFO
+ );
+
+/** The ACPI WSMT Table.
+*/
+STATIC
+EFI_ACPI_WSMT_TABLE AcpiWsmt = {
+ ACPI_HEADER (
+ EFI_ACPI_WINDOWS_SMM_SECURITY_MITIGATION_TABLE_SIGNATURE,
+ EFI_ACPI_WSMT_TABLE,
+ EFI_WSMT_TABLE_REVISION
+ ),
+ // ProtectionFlags
+ 0
+};
+
+/** Update the protection flags information in the WSMT 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.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
+ Manager is less than the Object size for the
+ requested object.
+ @retval EFI_UNSUPPORTED If invalid protection flags provided.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+WsmtAddProtectionFlagsInfo (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol
+ )
+{
+ EFI_STATUS Status;
+ CM_X64_WSMT_FLAGS_INFO *WsmtFlagInfo;
+
+ ASSERT (CfgMgrProtocol != NULL);
+
+ // Get the WSMT protection flag from the Platform Configuration Manager
+ Status = GetEX64ObjWsmtFlagsInfo (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &WsmtFlagInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: WSMT: Failed to get WSMT protection flag information." \
+ " Status = %r\n",
+ Status
+ ));
+ return Status;
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "WSMT: Protection flags = 0x%x\n",
+ WsmtFlagInfo->ProtectionFlags
+ ));
+
+ // Validate the protection flags
+ if ((WsmtFlagInfo->ProtectionFlags & ~WSMT_PROTECTION_VALID_FLAGS) != 0) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: WSMT: Invalid protection flags = 0x%x\n",
+ WsmtFlagInfo->ProtectionFlags
+ ));
+ return EFI_UNSUPPORTED;
+ }
+
+ if ((WsmtFlagInfo->ProtectionFlags & EFI_WSMT_PROTECTION_FLAGS_COMM_BUFFER_NESTED_PTR_PROTECTION) != 0) {
+ if ((WsmtFlagInfo->ProtectionFlags & EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS) == 0) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: WSMT: Invalid protection flags. EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS not set.\n"
+ ));
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ AcpiWsmt.ProtectionFlags = WsmtFlagInfo->ProtectionFlags;
+ return Status;
+}
+
+/** Construct the WSMT table.
+
+ This function invokes the Configuration Manager protocol interface
+ to get the required information for generating the ACPI table.
+
+ If this function allocates any resources then they must be freed
+ in the FreeXXXXTableResources function.
+
+ @param [in] This Pointer to the table generator.
+ @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [out] Table Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object was not found.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
+ Manager is less than the Object size for the
+ requested object.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+BuildWsmtTable (
+ IN CONST ACPI_TABLE_GENERATOR *CONST This,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
+ OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
+ )
+{
+ EFI_STATUS Status;
+
+ ASSERT (This != NULL);
+ ASSERT (AcpiTableInfo != NULL);
+ ASSERT (CfgMgrProtocol != NULL);
+ ASSERT (Table != NULL);
+ ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
+ ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
+
+ if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
+ (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+ {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: WSMT: Requested table revision = %d, is not supported."
+ "Supported table revision: Minimum = %d, Maximum = %d\n",
+ AcpiTableInfo->AcpiTableRevision,
+ This->MinAcpiTableRevision,
+ This->AcpiTableRevision
+ ));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *Table = NULL;
+
+ Status = AddAcpiHeader (
+ CfgMgrProtocol,
+ This,
+ (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiWsmt,
+ AcpiTableInfo,
+ sizeof (EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE)
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: WSMT: Failed to add ACPI header. Status = %r\n",
+ Status
+ ));
+ goto error_handler;
+ }
+
+ // Update protection flags Info
+ Status = WsmtAddProtectionFlagsInfo (CfgMgrProtocol);
+ if (EFI_ERROR (Status)) {
+ goto error_handler;
+ }
+
+ *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiWsmt;
+error_handler:
+ return Status;
+}
+
+/** This macro defines the WSMT Table Generator revision.
+*/
+#define WSMT_GENERATOR_REVISION CREATE_REVISION (1, 0)
+
+/** The interface for the WSMT Table Generator.
+*/
+STATIC
+CONST
+ACPI_TABLE_GENERATOR WsmtGenerator = {
+ // Generator ID
+ CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdWsmt),
+ // Generator Description
+ L"ACPI.STD.WSMT.GENERATOR",
+ // ACPI Table Signature
+ EFI_ACPI_WINDOWS_SMM_SECURITY_MITIGATION_TABLE_SIGNATURE,
+ // ACPI Table Revision supported by this Generator
+ EFI_WSMT_TABLE_REVISION,
+ // Minimum supported ACPI Table Revision
+ EFI_WSMT_TABLE_REVISION,
+ // Creator ID
+ TABLE_GENERATOR_CREATOR_ID_ARM,
+ // Creator Revision
+ WSMT_GENERATOR_REVISION,
+ // Build Table function
+ BuildWsmtTable,
+ // No additional resources are allocated by the generator.
+ // Hence the Free Resource function is not required.
+ NULL,
+ // Extended build function not needed
+ NULL,
+ // Extended build function not implemented by the generator.
+ // Hence extended free resource function is not required.
+ NULL
+};
+
+/** Register the Generator with the ACPI Table Factory.
+
+ @param [in] ImageHandle The handle to the image.
+ @param [in] SystemTable Pointer to the System Table.
+
+ @retval EFI_SUCCESS The Generator is registered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_ALREADY_STARTED The Generator for the Table ID
+ is already registered.
+**/
+EFI_STATUS
+EFIAPI
+AcpiWsmtLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = RegisterAcpiTableGenerator (&WsmtGenerator);
+ DEBUG ((DEBUG_INFO, "WSMT: Register Generator. Status = %r\n", Status));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+/** Deregister the Generator from the ACPI Table Factory.
+
+ @param [in] ImageHandle The handle to the image.
+ @param [in] SystemTable Pointer to the System Table.
+
+ @retval EFI_SUCCESS The Generator is deregistered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The Generator is not registered.
+**/
+EFI_STATUS
+EFIAPI
+AcpiWsmtLibDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = DeregisterAcpiTableGenerator (&WsmtGenerator);
+ DEBUG ((DEBUG_INFO, "WSMT: Deregister Generator. Status = %r\n", Status));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
index f433a46..35ec2aa 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
@@ -116,7 +116,7 @@ AmlCodeGenDefinitionBlock (
CopyMem (&AcpiHeader.OemId, OemId, 6);
CopyMem (&AcpiHeader.OemTableId, OemTableId, 8);
AcpiHeader.OemRevision = OemRevision;
- AcpiHeader.CreatorId = TABLE_GENERATOR_CREATOR_ID_ARM;
+ AcpiHeader.CreatorId = TABLE_GENERATOR_CREATOR_ID;
AcpiHeader.CreatorRevision = CREATE_REVISION (1, 0);
Status = AmlCreateRootNode (&AcpiHeader, NewRootNode);
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c
index 46243f9..3db536d 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c
@@ -1475,6 +1475,89 @@ AmlCodeGenRdRegister (
return LinkRdNode (RdNode, NameOpNode, NewRdNode);
}
+/** Code generation for the "IO ()" ASL function.
+
+ The Resource Data effectively created is a IO Resource
+ Data. Cf ACPI 6.5:
+ - s19.6.65 IO (IO Resource Descriptor Macro)
+ - s6.4.2.5 I/O Port Descriptor
+
+ The created resource data node can be:
+ - appended to the list of resource data elements of the NameOpNode.
+ In such case NameOpNode must be defined by a the "Name ()" ASL statement
+ and initially contain a "ResourceTemplate ()".
+ - returned through the NewRdNode parameter.
+
+ @param [in] IsDecoder16 Decoder parameter.
+ TRUE if 16-bit decoder.
+ FALSE if 10-bit decoder.
+ @param [in] AddressMinimum Minimum address.
+ @param [in] AddressMaximum Maximum address.
+ @param [in] Alignment Alignment.
+ @param [in] RangeLength Range length.
+ @param [in] NameOpNode NameOp object node defining a named object.
+ If provided, append the new resource data
+ node to the list of resource data elements
+ of this node.
+ @param [out] NewRdNode If provided and success,
+ contain the created node.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+AmlCodeGenRdIo (
+ IN BOOLEAN IsDecoder16,
+ IN UINT16 AddressMinimum,
+ IN UINT16 AddressMaximum,
+ IN UINT8 Alignment,
+ IN UINT8 RangeLength,
+ IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL
+ OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_IO_PORT_DESCRIPTOR IoDesc;
+ AML_DATA_NODE *IoNode;
+
+ if (AddressMinimum > AddressMaximum) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Alignment != 0) {
+ /// check the alignment
+ if ((AddressMinimum % Alignment) != 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((AddressMaximum % Alignment) != 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ IoDesc.Header.Byte = ACPI_IO_PORT_DESCRIPTOR;
+ IoDesc.Information = IsDecoder16 ? BIT0 : 0;
+
+ IoDesc.BaseAddressMin = AddressMinimum;
+ IoDesc.BaseAddressMax = AddressMaximum;
+ IoDesc.Alignment = Alignment;
+ IoDesc.Length = RangeLength;
+
+ Status = AmlCreateDataNode (
+ EAmlNodeDataTypeResourceData,
+ (UINT8 *)&IoDesc,
+ sizeof (IoDesc),
+ &IoNode
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT (0);
+ return Status;
+ }
+
+ return LinkRdNode (IoNode, NameOpNode, NewRdNode);
+}
+
/** Code generation for the EndTag resource data.
The EndTag resource data is automatically generated by the ASL compiler
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c
index d3a51a9..3762441 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c
@@ -330,7 +330,7 @@ AmlParseString (
StrSize = 0;
// AML String is NULL terminated.
do {
- // Reading the stream moves the stream forward aswell.
+ // Reading the stream moves the stream forward as well.
Status = AmlStreamReadByte (FStream, &Byte);
if (EFI_ERROR (Status)) {
ASSERT (0);
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c
index 1404a21..0a744f1 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c
@@ -573,7 +573,7 @@ AmlIsMethodDefinitionNode (
{
AML_DATA_NODE *ObjectType;
- // Node is checked to be an object node aswell.
+ // Node is checked to be an object node as well.
if (AmlNodeCompareOpCode (Node, AML_METHOD_OP, 0)) {
return TRUE;
} else if (AmlNodeCompareOpCode (Node, AML_EXTERNAL_OP, 0)) {
diff --git a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c
index 345acab..5325b20 100644
--- a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c
+++ b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/CmObjectTokenFixer.c
@@ -145,44 +145,28 @@ CONST
CM_OBJECT_TOKEN_FIXER TokenFixer[EArmObjMax] = {
NULL, ///< 0 - Reserved
NULL, ///< 1 - Boot Architecture Info
- NULL, ///< 2 - CPU Info
- NULL, ///< 3 - Power Management Profile Info
- NULL, ///< 4 - GIC CPU Interface Info
- NULL, ///< 5 - GIC Distributor Info
- NULL, ///< 6 - GIC MSI Frame Info
- NULL, ///< 7 - GIC Redistributor Info
- NULL, ///< 8 - GIC ITS Info
- NULL, ///< 9 - Serial Console Port Info
- NULL, ///< 10 - Serial Debug Port Info
- NULL, ///< 11 - Generic Timer Info
- NULL, ///< 12 - Platform GT Block Info
- NULL, ///< 13 - Generic Timer Block Frame Info
- NULL, ///< 14 - Platform Generic Watchdog
- NULL, ///< 15 - PCI Configuration Space Info
- NULL, ///< 16 - Hypervisor Vendor Id
- NULL, ///< 17 - Fixed feature flags for FADT
- TokenFixerItsGroup, ///< 18 - ITS Group
- TokenFixerNamedComponentNode, ///< 19 - Named Component
- TokenFixerRootComplexNode, ///< 20 - Root Complex
- TokenFixerNotImplemented, ///< 21 - SMMUv1 or SMMUv2
- TokenFixerSmmuV3Node, ///< 22 - SMMUv3
- TokenFixerNotImplemented, ///< 23 - PMCG
- NULL, ///< 24 - GIC ITS Identifier Array
- NULL, ///< 25 - ID Mapping Array
- NULL, ///< 26 - SMMU Interrupt Array
- TokenFixerNotImplemented, ///< 27 - Processor Hierarchy Info
- TokenFixerNotImplemented, ///< 28 - Cache Info
- TokenFixerNotImplemented, ///< 29 - Processor Node ID Info
- NULL, ///< 30 - CM Object Reference
- NULL, ///< 31 - Memory Affinity Info
- NULL, ///< 32 - Device Handle Acpi
- NULL, ///< 33 - Device Handle Pci
- NULL, ///< 34 - Generic Initiator Affinity
- NULL, ///< 35 - Generic Serial Port Info
- NULL, ///< 36 - CMN-600 Info
- NULL, ///< 37 - Lpi Info
- NULL, ///< 38 - Pci Address Map Info
- NULL, ///< 39 - Pci Interrupt Map Info
+ NULL, ///< 2 - GIC CPU Interface Info
+ NULL, ///< 3 - GIC Distributor Info
+ NULL, ///< 4 - GIC MSI Frame Info
+ NULL, ///< 5 - GIC Redistributor Info
+ NULL, ///< 6 - GIC ITS Info
+ NULL, ///< 7 - Generic Timer Info
+ NULL, ///< 8 - Platform GT Block Info
+ NULL, ///< 9 - Generic Timer Block Frame Info
+ NULL, ///< 10 - Platform Generic Watchdog
+ TokenFixerItsGroup, ///< 11 - ITS Group
+ TokenFixerNamedComponentNode, ///< 12 - Named Component
+ TokenFixerRootComplexNode, ///< 13 - Root Complex
+ TokenFixerNotImplemented, ///< 14 - SMMUv1 or SMMUv2
+ TokenFixerSmmuV3Node, ///< 15 - SMMUv3
+ TokenFixerNotImplemented, ///< 16 - PMCG
+ NULL, ///< 17 - GIC ITS Identifier Array
+ NULL, ///< 18 - ID Mapping Array
+ NULL, ///< 19 - SMMU Interrupt Array
+ NULL, ///< 20 - CMN-600 Info
+ NULL, ///< 21 - Reserved Memory Range Node
+ NULL, ///< 22 - Memory Range Descriptor
+ NULL ///< 23 - Embedded Trace Extension/Module Info
};
/** CmObj token fixer.
@@ -209,14 +193,17 @@ FixupCmObjectSelfToken (
CM_OBJECT_TOKEN_FIXER TokenFixerFunc;
CM_OBJECT_ID ArmNamespaceObjId;
- // Only support Arm objects for now.
- if ((CmObjDesc == NULL) ||
- (GET_CM_NAMESPACE_ID (CmObjDesc->ObjectId) != EObjNameSpaceArm))
- {
+ if (CmObjDesc == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
+ // Only support Arm objects for now.
+ if (GET_CM_NAMESPACE_ID (CmObjDesc->ObjectId) != EObjNameSpaceArm) {
+ ASSERT (0);
+ return EFI_UNSUPPORTED;
+ }
+
ArmNamespaceObjId = GET_CM_OBJECT_ID (CmObjDesc->ObjectId);
if (ArmNamespaceObjId >= EArmObjMax) {
ASSERT (0);
diff --git a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepo.c b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepo.c
index bdeb5c7..08d11ac 100644
--- a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepo.c
+++ b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepo.c
@@ -127,10 +127,12 @@ DynPlatRepoAddObject (
OUT CM_OBJECT_TOKEN *Token OPTIONAL
)
{
- EFI_STATUS Status;
- CM_OBJ_NODE *ObjNode;
- CM_OBJECT_ID ArmNamespaceObjId;
- CM_OBJECT_TOKEN NewToken;
+ EFI_STATUS Status;
+ CM_OBJ_NODE *ObjNode;
+ CM_OBJECT_ID ObjId;
+ CM_OBJECT_TOKEN NewToken;
+ LIST_ENTRY *ObjList;
+ EOBJECT_NAMESPACE_ID NamespaceId;
// The dynamic repository must be able to receive objects.
if ((This == NULL) ||
@@ -142,15 +144,33 @@ DynPlatRepoAddObject (
}
// Check the CmObjDesc:
- // - only Arm objects are supported for now.
- // - only EArmObjCmRef objects can be added as arrays.
- ArmNamespaceObjId = GET_CM_OBJECT_ID (CmObjDesc->ObjectId);
- if ((CmObjDesc->Size == 0) ||
- (CmObjDesc->Count == 0) ||
- (ArmNamespaceObjId >= EArmObjMax) ||
- ((CmObjDesc->Count > 1) && (ArmNamespaceObjId != EArmObjCmRef)) ||
- (GET_CM_NAMESPACE_ID (CmObjDesc->ObjectId) != EObjNameSpaceArm))
- {
+ // - only Arm objects and Arch Common objects are supported for now.
+ // - only EArchCommonObjCmRef objects can be added as arrays.
+ if ((CmObjDesc->Size == 0) || (CmObjDesc->Count == 0)) {
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ObjId = GET_CM_OBJECT_ID (CmObjDesc->ObjectId);
+ NamespaceId = GET_CM_NAMESPACE_ID (CmObjDesc->ObjectId);
+
+ if (EObjNameSpaceArm == NamespaceId) {
+ if (ObjId >= EArmObjMax) {
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ObjList = &This->ArmCmObjList[ObjId];
+ } else if (EObjNameSpaceArchCommon == NamespaceId) {
+ if ((ObjId >= EArchCommonObjMax) ||
+ ((CmObjDesc->Count > 1) && (ObjId != EArchCommonObjCmRef)))
+ {
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ObjList = &This->ArchCommonCmObjList[ObjId];
+ } else {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -166,15 +186,17 @@ DynPlatRepoAddObject (
}
// Fixup self-token if necessary.
- Status = FixupCmObjectSelfToken (&ObjNode->CmObjDesc, NewToken);
- if (EFI_ERROR (Status)) {
- FreeCmObjNode (ObjNode);
- ASSERT (0);
- return Status;
+ if (EObjNameSpaceArm == NamespaceId) {
+ Status = FixupCmObjectSelfToken (&ObjNode->CmObjDesc, NewToken);
+ if (EFI_ERROR (Status)) {
+ FreeCmObjNode (ObjNode);
+ ASSERT (0);
+ return Status;
+ }
}
// Add to link list.
- InsertTailList (&This->ArmCmObjList[ArmNamespaceObjId], &ObjNode->Link);
+ InsertTailList (ObjList, &ObjNode->Link);
This->ObjectCount += 1;
if (Token != NULL) {
@@ -184,11 +206,14 @@ DynPlatRepoAddObject (
return EFI_SUCCESS;
}
-/** Group lists of CmObjNode from the ArmNameSpace to one array.
+/** Group lists of CmObjNode from the Arm Namespace or ArchCommon namespace
+ to one array.
@param [in] This This dynamic platform repository.
- @param [in] ArmObjIndex Index in EARM_OBJECT_ID
- (must be < EArmObjMax).
+ @param [in] NamespaceId The namespace ID which can be EObjNameSpaceArm or
+ EObjNameSpaceArchCommon.
+ @param [in] ObjIndex Index in EARM_OBJECT_ID (must be < EArmObjMax) or
+ EARCH_COMMON_OBJECT_ID (must be <EArchCommonObjMax).
@retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER A parameter is invalid.
@@ -200,7 +225,8 @@ EFI_STATUS
EFIAPI
GroupCmObjNodes (
IN DYNAMIC_PLATFORM_REPOSITORY_INFO *This,
- IN UINT32 ArmObjIndex
+ IN EOBJECT_NAMESPACE_ID NamespaceId,
+ IN UINT32 ObjIndex
)
{
EFI_STATUS Status;
@@ -212,19 +238,38 @@ GroupCmObjNodes (
CM_OBJ_DESCRIPTOR *CmObjDesc;
LIST_ENTRY *ListHead;
LIST_ENTRY *Link;
+ CM_OBJ_DESCRIPTOR *ObjArray;
- if ((This == NULL) ||
- (ArmObjIndex >= EArmObjMax))
- {
+ if (This == NULL) {
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (NamespaceId == EObjNameSpaceArm) {
+ if (ObjIndex >= EArmObjMax) {
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ListHead = &This->ArmCmObjList[ObjIndex];
+ ObjArray = &This->ArmCmObjArray[ObjIndex];
+ } else if (NamespaceId == EObjNameSpaceArchCommon) {
+ if (ObjIndex >= EArchCommonObjMax) {
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ListHead = &This->ArchCommonCmObjList[ObjIndex];
+ ObjArray = &This->ArchCommonCmObjArray[ObjIndex];
+ } else {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- Count = 0;
- Size = 0;
- CmObjId = CREATE_CM_ARM_OBJECT_ID (ArmObjIndex);
- ListHead = &This->ArmCmObjList[ArmObjIndex];
- Link = GetFirstNode (ListHead);
+ Count = 0;
+ Size = 0;
+ CmObjId = CREATE_CM_OBJECT_ID (NamespaceId, ObjIndex);
+ Link = GetFirstNode (ListHead);
// Compute the total count and size of the CmObj in the list.
while (Link != ListHead) {
@@ -235,9 +280,12 @@ GroupCmObjNodes (
return EFI_INVALID_PARAMETER;
}
- if ((CmObjDesc->Count != 1) && (ArmObjIndex != EArmObjCmRef)) {
+ if ((CmObjDesc->Count != 1) &&
+ ((NamespaceId != EObjNameSpaceArchCommon) ||
+ (ObjIndex != EArchCommonObjCmRef)))
+ {
// We expect each descriptor to contain an individual object.
- // EArmObjCmRef objects are counted as groups, so +1 as well.
+ // EArchCommonObjCmRef objects are counted as groups, so +1 as well.
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -286,7 +334,7 @@ GroupCmObjNodes (
Link = GetNextNode (ListHead, Link);
} // while
- CmObjDesc = &This->ArmCmObjArray[ArmObjIndex];
+ CmObjDesc = ObjArray;
CmObjDesc->ObjectId = CmObjId;
CmObjDesc->Size = (UINT32)Size;
CmObjDesc->Count = (UINT32)Count;
@@ -317,7 +365,7 @@ DynamicPlatRepoFinalise (
)
{
EFI_STATUS Status;
- UINTN ArmObjIndex;
+ UINTN ObjIndex;
if ((This == NULL) ||
(This->RepoState != DynRepoTransient))
@@ -340,18 +388,29 @@ DynamicPlatRepoFinalise (
// - Convert the list of nodes to an array
// (the array is wrapped in a CmObjDesc).
// - Add the Token/CmObj binding to the token mapper.
- for (ArmObjIndex = 0; ArmObjIndex < EArmObjMax; ArmObjIndex++) {
- Status = GroupCmObjNodes (This, (UINT32)ArmObjIndex);
+ for (ObjIndex = 0; ObjIndex < EArmObjMax; ObjIndex++) {
+ Status = GroupCmObjNodes (This, EObjNameSpaceArm, (UINT32)ObjIndex);
if (EFI_ERROR (Status)) {
ASSERT (0);
- // Free the TokenMapper.
- // Ignore the returned Status since we already failed.
- TokenMapperShutdown (&This->TokenMapper);
- return Status;
+ goto error_handler;
+ }
+ } // for
+
+ for (ObjIndex = 0; ObjIndex < EArchCommonObjMax; ObjIndex++) {
+ Status = GroupCmObjNodes (This, EObjNameSpaceArchCommon, (UINT32)ObjIndex);
+ if (EFI_ERROR (Status)) {
+ ASSERT (0);
+ goto error_handler;
}
} // for
return EFI_SUCCESS;
+
+error_handler:
+ // Free the TokenMapper.
+ // Ignore the returned Status since we already failed.
+ TokenMapperShutdown (&This->TokenMapper);
+ return Status;
}
/** Get a CmObj from the dynamic repository.
@@ -376,9 +435,10 @@ DynamicPlatRepoGetObject (
IN OUT CM_OBJ_DESCRIPTOR *CmObjDesc
)
{
- EFI_STATUS Status;
- CM_OBJ_DESCRIPTOR *Desc;
- CM_OBJECT_ID ArmNamespaceObjId;
+ EFI_STATUS Status;
+ CM_OBJ_DESCRIPTOR *Desc;
+ CM_OBJECT_ID ObjId;
+ EOBJECT_NAMESPACE_ID NamespaceId;
if ((This == NULL) ||
(CmObjDesc == NULL) ||
@@ -388,8 +448,28 @@ DynamicPlatRepoGetObject (
return EFI_INVALID_PARAMETER;
}
- ArmNamespaceObjId = GET_CM_OBJECT_ID (CmObjectId);
- if (ArmNamespaceObjId >= EArmObjMax) {
+ NamespaceId = GET_CM_NAMESPACE_ID (CmObjectId);
+ ObjId = GET_CM_OBJECT_ID (CmObjectId);
+
+ if (NamespaceId == EObjNameSpaceArm) {
+ if (ObjId >= EArmObjMax) {
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Desc = &This->ArmCmObjArray[ObjId];
+ } else if (NamespaceId == EObjNameSpaceArchCommon) {
+ if ((ObjId >= EArchCommonObjMax) ||
+ ((ObjId == EArchCommonObjCmRef) &&
+ (Token == CM_NULL_TOKEN)))
+ {
+ // EArchCommonObjCmRef object must be requested using a valid token.
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Desc = &This->ArchCommonCmObjArray[ObjId];
+ } else {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
@@ -406,14 +486,6 @@ DynamicPlatRepoGetObject (
return Status;
}
- if (ArmNamespaceObjId == EArmObjCmRef) {
- // EArmObjCmRef object must be requested using a valid token.
- ASSERT (0);
- return EFI_INVALID_PARAMETER;
- }
-
- Desc = &This->ArmCmObjArray[ArmNamespaceObjId];
-
// Nothing here.
if (Desc->Count == 0) {
return EFI_NOT_FOUND;
@@ -462,6 +534,10 @@ DynamicPlatRepoInit (
InitializeListHead (&Repo->ArmCmObjList[Index]);
}
+ for (Index = 0; Index < EArchCommonObjMax; Index++) {
+ InitializeListHead (&Repo->ArchCommonCmObjList[Index]);
+ }
+
Repo->ObjectCount = 0;
Repo->RepoState = DynRepoTransient;
@@ -470,31 +546,27 @@ DynamicPlatRepoInit (
return EFI_SUCCESS;
}
-/** Shutdown the dynamic platform repository.
+/** Free Arm Namespace objects.
- Free all the memory allocated for the dynamic platform repository.
+ Free all the memory allocated for the Arm namespace objects in the
+ dynamic platform repository.
@param [in] DynPlatRepo The dynamic platform repository.
- @retval EFI_INVALID_PARAMETER A parameter is invalid.
- @retval EFI_SUCCESS Success.
**/
-EFI_STATUS
+STATIC
+VOID
EFIAPI
-DynamicPlatRepoShutdown (
+DynamicPlatRepoFreeArmObjects (
IN DYNAMIC_PLATFORM_REPOSITORY_INFO *DynPlatRepo
)
{
- EFI_STATUS Status;
UINT32 Index;
LIST_ENTRY *ListHead;
CM_OBJ_DESCRIPTOR *CmObjDesc;
VOID *Data;
- if (DynPlatRepo == NULL) {
- ASSERT (0);
- return EFI_INVALID_PARAMETER;
- }
+ ASSERT (DynPlatRepo != NULL);
// Free the list of objects.
for (Index = 0; Index < EArmObjMax; Index++) {
@@ -513,6 +585,73 @@ DynamicPlatRepoShutdown (
FreePool (Data);
}
} // for
+}
+
+/** Free Arch Common Namespace objects.
+
+ Free all the memory allocated for the Arch Common namespace objects in the
+ dynamic platform repository.
+
+ @param [in] DynPlatRepo The dynamic platform repository.
+
+**/
+STATIC
+VOID
+EFIAPI
+DynamicPlatRepoFreeArchCommonObjects (
+ IN DYNAMIC_PLATFORM_REPOSITORY_INFO *DynPlatRepo
+ )
+{
+ UINT32 Index;
+ LIST_ENTRY *ListHead;
+ CM_OBJ_DESCRIPTOR *CmObjDesc;
+ VOID *Data;
+
+ ASSERT (DynPlatRepo != NULL);
+
+ // Free the list of objects.
+ for (Index = 0; Index < EArchCommonObjMax; Index++) {
+ // Free all the nodes with this object Id.
+ ListHead = &DynPlatRepo->ArchCommonCmObjList[Index];
+ while (!IsListEmpty (ListHead)) {
+ FreeCmObjNode ((CM_OBJ_NODE *)GetFirstNode (ListHead));
+ } // while
+ } // for
+
+ // Free the arrays.
+ CmObjDesc = DynPlatRepo->ArchCommonCmObjArray;
+ for (Index = 0; Index < EArchCommonObjMax; Index++) {
+ Data = CmObjDesc[Index].Data;
+ if (Data != NULL) {
+ FreePool (Data);
+ }
+ } // for
+}
+
+/** Shutdown the dynamic platform repository.
+
+ Free all the memory allocated for the dynamic platform repository.
+
+ @param [in] DynPlatRepo The dynamic platform repository.
+
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_SUCCESS Success.
+**/
+EFI_STATUS
+EFIAPI
+DynamicPlatRepoShutdown (
+ IN DYNAMIC_PLATFORM_REPOSITORY_INFO *DynPlatRepo
+ )
+{
+ EFI_STATUS Status;
+
+ if (DynPlatRepo == NULL) {
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ DynamicPlatRepoFreeArmObjects (DynPlatRepo);
+ DynamicPlatRepoFreeArchCommonObjects (DynPlatRepo);
// Free the TokenMapper
Status = TokenMapperShutdown (&DynPlatRepo->TokenMapper);
diff --git a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoInternal.h b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoInternal.h
index eaee5d4..0c842bc 100644
--- a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoInternal.h
+++ b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoInternal.h
@@ -67,7 +67,16 @@ typedef struct DynamicPlatformRepositoryInfo {
/// This array is populated when the Repo is finalized.
CM_OBJ_DESCRIPTOR ArmCmObjArray[EArmObjMax];
- /// A token mapper for the objects in the ArmNamespaceObjectArray
+ /// Link lists of CmObj from the ArchCommon Namespace
+ /// that are added in the Transient state.
+ LIST_ENTRY ArchCommonCmObjList[EArchCommonObjMax];
+
+ /// Structure Members used in Finalized state.
+ /// An array of CmObj Descriptors from the ArchCommon Namespace
+ /// This array is populated when the Repo is finalized.
+ CM_OBJ_DESCRIPTOR ArchCommonCmObjArray[EArchCommonObjMax];
+
+ /// A token mapper for the objects in the <Arm|ArchCommon>CmObjArray
/// The Token mapper is populated when the Repo is finalized in
/// a call to DynamicPlatRepoFinalise ().
TOKEN_MAPPER TokenMapper;
diff --git a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenMapper.c b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenMapper.c
index 9391e93..2300375 100644
--- a/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenMapper.c
+++ b/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenMapper.c
@@ -66,11 +66,12 @@ TokenMapperAddObject (
// Point inside the finalized array.
CmObjDesc->Data = Data;
- // Only EArmObjCmRef CmObj can be added as arrays (more than 1 elements).
- if ((GET_CM_NAMESPACE_ID (ObjectId) == EObjNameSpaceArm) &&
- (GET_CM_OBJECT_ID (ObjectId) == EArmObjCmRef))
+ // Only EArchCommonObjCmRef CmObj can be added as
+ // arrays (more than 1 elements).
+ if ((GET_CM_NAMESPACE_ID (ObjectId) == EObjNameSpaceArchCommon) &&
+ (GET_CM_OBJECT_ID (ObjectId) == EArchCommonObjCmRef))
{
- CmObjDesc->Count = Size / sizeof (CM_ARM_OBJ_REF);
+ CmObjDesc->Count = Size / sizeof (CM_ARCH_COMMON_OBJ_REF);
} else {
CmObjDesc->Count = 1;
}
diff --git a/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.c b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.c
index b35fb6a..3f8aae4 100644
--- a/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.c
+++ b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.c
@@ -53,10 +53,10 @@
EFI_STATUS
EFIAPI
GeneratePciSlots (
- IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo,
- IN CONST MAPPING_TABLE *MappingTable,
- IN UINT32 Uid,
- IN OUT AML_OBJECT_NODE_HANDLE PciNode
+ IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciInfo,
+ IN CONST MAPPING_TABLE *MappingTable,
+ IN UINT32 Uid,
+ IN OUT AML_OBJECT_NODE_HANDLE PciNode
)
{
EFI_STATUS Status;
@@ -132,8 +132,8 @@ GeneratePciSlots (
EFI_STATUS
EFIAPI
AddOscMethod (
- IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo,
- IN OUT AML_OBJECT_NODE_HANDLE PciNode
+ IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciInfo,
+ IN OUT AML_OBJECT_NODE_HANDLE PciNode
)
{
EFI_STATUS Status;
diff --git a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c
index f2594de..e8eef40 100644
--- a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c
+++ b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c
@@ -46,7 +46,7 @@ extern CHAR8 ssdtserialporttemplate_aml_code[];
/** Validate the Serial Port Information.
- @param [in] SerialPortInfoTable Table of CM_ARM_SERIAL_PORT_INFO.
+ @param [in] SerialPortInfoTable Table of CM_ARCH_COMMON_SERIAL_PORT_INFO.
@param [in] SerialPortCount Count of SerialPort in the table.
@retval EFI_SUCCESS Success.
@@ -55,12 +55,12 @@ extern CHAR8 ssdtserialporttemplate_aml_code[];
EFI_STATUS
EFIAPI
ValidateSerialPortInfo (
- IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfoTable,
- IN UINT32 SerialPortCount
+ IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfoTable,
+ IN UINT32 SerialPortCount
)
{
- UINT32 Index;
- CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo;
+ UINT32 Index;
+ CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo;
if ((SerialPortInfoTable == NULL) ||
(SerialPortCount == 0))
@@ -163,9 +163,9 @@ STATIC
EFI_STATUS
EFIAPI
FixupIds (
- IN AML_ROOT_NODE_HANDLE RootNodeHandle,
- IN CONST UINT64 Uid,
- IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo
+ IN AML_ROOT_NODE_HANDLE RootNodeHandle,
+ IN CONST UINT64 Uid,
+ IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo
)
{
EFI_STATUS Status;
@@ -290,8 +290,8 @@ STATIC
EFI_STATUS
EFIAPI
FixupCrs (
- IN AML_ROOT_NODE_HANDLE RootNodeHandle,
- IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo
+ IN AML_ROOT_NODE_HANDLE RootNodeHandle,
+ IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo
)
{
EFI_STATUS Status;
@@ -366,9 +366,9 @@ STATIC
EFI_STATUS
EFIAPI
FixupName (
- IN AML_ROOT_NODE_HANDLE RootNodeHandle,
- IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo,
- IN CONST CHAR8 *Name
+ IN AML_ROOT_NODE_HANDLE RootNodeHandle,
+ IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo,
+ IN CONST CHAR8 *Name
)
{
EFI_STATUS Status;
@@ -410,11 +410,11 @@ STATIC
EFI_STATUS
EFIAPI
FixupSerialPortInfo (
- IN AML_ROOT_NODE_HANDLE RootNodeHandle,
- IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo,
- IN CONST CHAR8 *Name,
- IN CONST UINT64 Uid,
- OUT EFI_ACPI_DESCRIPTION_HEADER **Table
+ IN AML_ROOT_NODE_HANDLE RootNodeHandle,
+ IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo,
+ IN CONST CHAR8 *Name,
+ IN CONST UINT64 Uid,
+ OUT EFI_ACPI_DESCRIPTION_HEADER **Table
)
{
EFI_STATUS Status;
@@ -480,11 +480,11 @@ FreeSsdtSerialPortTable (
EFI_STATUS
EFIAPI
BuildSsdtSerialPortTable (
- IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *AcpiTableInfo,
- IN CONST CM_ARM_SERIAL_PORT_INFO *SerialPortInfo,
- IN CONST CHAR8 *Name,
- IN CONST UINT64 Uid,
- OUT EFI_ACPI_DESCRIPTION_HEADER **Table
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *AcpiTableInfo,
+ IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo,
+ IN CONST CHAR8 *Name,
+ IN CONST UINT64 Uid,
+ OUT EFI_ACPI_DESCRIPTION_HEADER **Table
)
{
EFI_STATUS Status;
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
index 69b6eba..c9737f6 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
@@ -2,6 +2,8 @@
Configuration Manager Object parser.
Copyright (c) 2021 - 2023, ARM Limited. All rights reserved.<BR>
+ Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+ Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -16,7 +18,8 @@ VOID
EFIAPI
PrintString (
CONST CHAR8 *Format,
- UINT8 *Ptr
+ UINT8 *Ptr,
+ UINT32 Length
);
STATIC
@@ -24,31 +27,26 @@ VOID
EFIAPI
PrintStringPtr (
CONST CHAR8 *Format,
- UINT8 *Ptr
+ UINT8 *Ptr,
+ UINT32 Length
);
STATIC
VOID
EFIAPI
-PrintChar4 (
+PrintChars (
CONST CHAR8 *Format,
- UINT8 *Ptr
+ UINT8 *Ptr,
+ UINT32 Length
);
STATIC
VOID
EFIAPI
-PrintChar6 (
+HexDump (
CONST CHAR8 *Format,
- UINT8 *Ptr
- );
-
-STATIC
-VOID
-EFIAPI
-PrintChar8 (
- CONST CHAR8 *Format,
- UINT8 *Ptr
+ UINT8 *Ptr,
+ UINT32 Length
);
/** A parser for EArmObjBootArchInfo.
@@ -57,9 +55,9 @@ STATIC CONST CM_OBJ_PARSER CmArmBootArchInfoParser[] = {
{ "BootArchFlags", 2, "0x%x", NULL }
};
-/** A parser for EArmObjPowerManagementProfileInfo.
+/** A parser for EArchCommonObjPowerManagementProfileInfo.
*/
-STATIC CONST CM_OBJ_PARSER CmArmPowerManagementProfileInfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonPowerManagementProfileInfoParser[] = {
{ "PowerManagementProfile", 1, "0x%x", NULL }
};
@@ -122,10 +120,10 @@ STATIC CONST CM_OBJ_PARSER CmArmGicItsInfoParser[] = {
{ "ProximityDomain", 4, "0x%x", NULL }
};
-/** A parser for EArmObjSerialConsolePortInfo,
- EArmObjSerialDebugPortInfo and EArmObjSerialPortInfo.
+/** A parser for EArchCommonObjConsolePortInfo,
+ EArchCommonObjSerialDebugPortInfo and EArchCommonObjSerialPortInfo.
*/
-STATIC CONST CM_OBJ_PARSER CmArmSerialPortInfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonSerialPortInfoParser[] = {
{ "BaseAddress", 8, "0x%llx", NULL },
{ "Interrupt", 4, "0x%x", NULL },
{ "BaudRate", 8, "0x%llx", NULL },
@@ -182,9 +180,9 @@ STATIC CONST CM_OBJ_PARSER CmArmGenericWatchdogInfoParser[] = {
{ "Flags", 4, "0x%x", NULL }
};
-/** A parser for EArmObjPciConfigSpaceInfo.
+/** A parser for EArchCommonObjPciConfigSpaceInfo.
*/
-STATIC CONST CM_OBJ_PARSER CmArmPciConfigSpaceInfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonPciConfigSpaceInfoParser[] = {
{ "BaseAddress", 8, "0x%llx", NULL },
{ "PciSegmentGroupNumber", 2, "0x%x", NULL },
{ "StartBusNumber", 1, "0x%x", NULL },
@@ -193,15 +191,15 @@ STATIC CONST CM_OBJ_PARSER CmArmPciConfigSpaceInfoParser[] = {
{ "InterruptMapToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
};
-/** A parser for EArmObjHypervisorVendorIdentity.
+/** A parser for EArchCommonObjHypervisorVendorIdentity.
*/
-STATIC CONST CM_OBJ_PARSER CmArmHypervisorVendorIdParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonHypervisorVendorIdentityParser[] = {
{ "HypervisorVendorId", 8, "0x%llx", NULL }
};
-/** A parser for EArmObjFixedFeatureFlags.
+/** A parser for EArchCommonObjFixedFeatureFlags.
*/
-STATIC CONST CM_OBJ_PARSER CmArmFixedFeatureFlagsParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonFixedFeatureFlagsParser[] = {
{ "Flags", 4, "0x%x", NULL }
};
@@ -317,18 +315,18 @@ STATIC CONST CM_OBJ_PARSER CmArmIdMappingParser[] = {
/** A parser for EArmObjSmmuInterruptArray.
*/
-STATIC CONST CM_OBJ_PARSER CmArmGenericInterruptParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonGenericInterruptParser[] = {
{ "Interrupt", 4, "0x%x", NULL },
{ "Flags", 4, "0x%x", NULL }
};
-/** A parser for EArmObjProcHierarchyInfo.
+/** A parser for EArchCommonObjProcHierarchyInfo.
*/
-STATIC CONST CM_OBJ_PARSER CmArmProcHierarchyInfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonProcHierarchyInfoParser[] = {
{ "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{ "Flags", 4, "0x%x", NULL },
{ "ParentToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
- { "GicCToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+ { "AcpiIdObjectToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{ "NoOfPrivateResources", 4, "0x%x", NULL },
{ "PrivateResourcesArrayToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{ "LpiToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
@@ -337,9 +335,9 @@ STATIC CONST CM_OBJ_PARSER CmArmProcHierarchyInfoParser[] = {
{ "OverrideUid", 4, "0x%x", NULL }
};
-/** A parser for EArmObjCacheInfo.
+/** A parser for EArchCommonObjCacheInfo.
*/
-STATIC CONST CM_OBJ_PARSER CmArmCacheInfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonCacheInfoParser[] = {
{ "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{ "NextLevelOfCacheToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{ "Size", 4, "0x%x", NULL },
@@ -350,52 +348,40 @@ STATIC CONST CM_OBJ_PARSER CmArmCacheInfoParser[] = {
{ "CacheId", 4, "0x%x", NULL },
};
-/** A parser for EArmObjProcNodeIdInfo.
-*/
-STATIC CONST CM_OBJ_PARSER CmArmProcNodeIdInfoParser[] = {
- { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
- { "VendorId", 4, "0x%p", NULL },
- { "Level1Id", 8, "0x%x", NULL },
- { "Level2Id", 8, "0x%x", NULL },
- { "MajorRev", 2, "0x%x", NULL },
- { "MinorRev", 2, "0x%x", NULL },
- { "SpinRev", 2, "0x%x", NULL }
-};
-
-/** A parser for EArmObjCmRef.
+/** A parser for EArchCommonObjCmRef.
*/
-STATIC CONST CM_OBJ_PARSER CmArmObjRefParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonObjRefParser[] = {
{ "ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
};
-/** A parser for EArmObjMemoryAffinityInfo.
+/** A parser for EArchCommonObjMemoryAffinityInfo.
*/
-STATIC CONST CM_OBJ_PARSER CmArmMemoryAffinityInfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonMemoryAffinityInfoParser[] = {
{ "ProximityDomain", 4, "0x%x", NULL },
{ "BaseAddress", 8, "0x%llx", NULL },
{ "Length", 8, "0x%llx", NULL },
{ "Flags", 4, "0x%x", NULL }
};
-/** A parser for EArmObjDeviceHandleAcpi.
+/** A parser for EArchCommonObjDeviceHandleAcpi.
*/
-STATIC CONST CM_OBJ_PARSER CmArmDeviceHandleAcpiParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonDeviceHandleAcpiParser[] = {
{ "Hid", 8, "0x%llx", NULL },
{ "Uid", 4, "0x%x", NULL }
};
-/** A parser for EArmObjDeviceHandlePci.
+/** A parser for EArchCommonObjDeviceHandlePci.
*/
-STATIC CONST CM_OBJ_PARSER CmArmDeviceHandlePciParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonDeviceHandlePciParser[] = {
{ "SegmentNumber", 2, "0x%x", NULL },
{ "BusNumber", 1, "0x%x", NULL },
{ "DeviceNumber", 1, "0x%x", NULL },
{ "FunctionNumber", 1, "0x%x", NULL }
};
-/** A parser for EArmObjGenericInitiatorAffinityInfo.
+/** A parser for EArchCommonObjGenericInitiatorAffinityInfo.
*/
-STATIC CONST CM_OBJ_PARSER CmArmGenericInitiatorAffinityInfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonGenericInitiatorAffinityInfoParser[] = {
{ "ProximityDomain", 4, "0x%x", NULL },
{ "Flags", 4, "0x%x", NULL },
{ "DeviceHandleType", 1, "0x%x", NULL },
@@ -429,9 +415,9 @@ STATIC CONST CM_OBJ_PARSER AcpiGenericAddressParser[] = {
{ "Address", 8, "0x%llx", NULL },
};
-/** A parser for EArmObjLpiInfo.
+/** A parser for EArchCommonObjLpiInfo.
*/
-STATIC CONST CM_OBJ_PARSER CmArmLpiInfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonLpiInfoParser[] = {
{ "MinResidency", 4, "0x%x", NULL },
{ "WorstCaseWakeLatency", 4, "0x%x", NULL },
{ "Flags", 4, "0x%x", NULL },
@@ -452,24 +438,24 @@ STATIC CONST CM_OBJ_PARSER CmArmLpiInfoParser[] = {
{ "StateName", 16, NULL, PrintString },
};
-/** A parser for EArmObjPciAddressMapInfo.
+/** A parser for EArchCommonObjPciAddressMapInfo.
*/
-STATIC CONST CM_OBJ_PARSER CmArmPciAddressMapInfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonPciAddressMapInfoParser[] = {
{ "SpaceCode", 1, "%d", NULL },
{ "PciAddress", 8, "0x%llx", NULL },
{ "CpuAddress", 8, "0x%llx", NULL },
{ "AddressSize", 8, "0x%llx", NULL },
};
-/** A parser for EArmObjPciInterruptMapInfo.
+/** A parser for EArchCommonObjPciInterruptMapInfo.
*/
-STATIC CONST CM_OBJ_PARSER CmPciInterruptMapInfoParser[] = {
- { "PciBus", 1, "0x%x", NULL },
- { "PciDevice", 1, "0x%x", NULL },
- { "PciInterrupt", 1, "0x%x", NULL },
- { "IntcInterrupt", sizeof (CM_ARM_GENERIC_INTERRUPT),
- NULL, NULL, CmArmGenericInterruptParser,
- ARRAY_SIZE (CmArmGenericInterruptParser) },
+STATIC CONST CM_OBJ_PARSER CmArchCommonPciInterruptMapInfoParser[] = {
+ { "PciBus", 1, "0x%x", NULL },
+ { "PciDevice", 1, "0x%x", NULL },
+ { "PciInterrupt", 1, "0x%x", NULL },
+ { "IntcInterrupt", sizeof (CM_ARCH_COMMON_GENERIC_INTERRUPT),
+ NULL, NULL, CmArchCommonGenericInterruptParser,
+ ARRAY_SIZE (CmArchCommonGenericInterruptParser) },
};
/** A parser for EArmObjRmr.
@@ -491,9 +477,9 @@ STATIC CONST CM_OBJ_PARSER CmArmMemoryRangeDescriptorInfoParser[] = {
{ "Length", 8, "0x%llx", NULL },
};
-/** A parser for EArmObjCpcInfo.
+/** A parser for EArchCommonObjCpcInfo.
*/
-STATIC CONST CM_OBJ_PARSER CmArmCpcInfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonCpcInfoParser[] = {
{ "Revision", 4, "0x%lx", NULL },
{ "HighestPerformanceBuffer", sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE),
NULL, NULL, AcpiGenericAddressParser,
@@ -586,9 +572,9 @@ STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceChannelTimingInfoParser[] = {
{ "MinRequestTurnaroundTime", 2, "0x%x", NULL },
};
-/** A parser for EArmObjPccSubspaceType0Info.
+/** A parser for EArchCommonObjPccSubspaceType0Info.
*/
-STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType0InfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonPccSubspaceType0InfoParser[] = {
{ "SubspaceId", 1, "0x%x", NULL },
{ "Type", 1, "0x%x", NULL },
{ "BaseAddress", 8, "0x%llx", NULL },
@@ -601,38 +587,38 @@ STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType0InfoParser[] = {
ARRAY_SIZE (CmArmPccSubspaceChannelTimingInfoParser) },
};
-/** A parser for EArmObjPccSubspaceType1Info.
+/** A parser for EArchCommonObjPccSubspaceType1Info.
*/
-STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType1InfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonPccSubspaceType1InfoParser[] = {
{ "GenericPccInfo", sizeof (PCC_SUBSPACE_GENERIC_INFO),
- NULL, NULL, CmArmPccSubspaceType0InfoParser,
- ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
- { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT),
- NULL, NULL, CmArmGenericInterruptParser,
- ARRAY_SIZE (CmArmGenericInterruptParser) },
+ NULL, NULL, CmArchCommonPccSubspaceType0InfoParser,
+ ARRAY_SIZE (CmArchCommonPccSubspaceType0InfoParser) },
+ { "PlatIrq", sizeof (CM_ARCH_COMMON_GENERIC_INTERRUPT),
+ NULL, NULL, CmArchCommonGenericInterruptParser,
+ ARRAY_SIZE (CmArchCommonGenericInterruptParser) },
};
-/** A parser for EArmObjPccSubspaceType2Info.
+/** A parser for EArchCommonObjPccSubspaceType2Info.
*/
-STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType2InfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonPccSubspaceType2InfoParser[] = {
{ "GenericPccInfo", sizeof (PCC_SUBSPACE_GENERIC_INFO),
- NULL, NULL, CmArmPccSubspaceType0InfoParser,
- ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
- { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT), NULL,NULL,
- CmArmGenericInterruptParser, ARRAY_SIZE (CmArmGenericInterruptParser) },
+ NULL, NULL, CmArchCommonPccSubspaceType0InfoParser,
+ ARRAY_SIZE (CmArchCommonPccSubspaceType0InfoParser) },
+ { "PlatIrq", sizeof (CM_ARCH_COMMON_GENERIC_INTERRUPT),NULL,NULL,
+ CmArchCommonGenericInterruptParser, ARRAY_SIZE (CmArchCommonGenericInterruptParser) },
{ "PlatIrqAckReg", sizeof (PCC_MAILBOX_REGISTER_INFO),
NULL, NULL, CmArmMailboxRegisterInfoParser,
ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
};
-/** A parser for EArmObjPccSubspaceType3Info or EArmObjPccSubspaceType4Info.
+/** A parser for EArchCommonObjPccSubspaceType3Info or EArchCommonObjPccSubspaceType4Info.
*/
-STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType34InfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonPccSubspaceType34InfoParser[] = {
{ "GenericPccInfo", sizeof (PCC_SUBSPACE_GENERIC_INFO),
- NULL, NULL, CmArmPccSubspaceType0InfoParser,
- ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
- { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT), NULL,NULL,
- CmArmGenericInterruptParser, ARRAY_SIZE (CmArmGenericInterruptParser) },
+ NULL, NULL, CmArchCommonPccSubspaceType0InfoParser,
+ ARRAY_SIZE (CmArchCommonPccSubspaceType0InfoParser) },
+ { "PlatIrq", sizeof (CM_ARCH_COMMON_GENERIC_INTERRUPT),NULL,NULL,
+ CmArchCommonGenericInterruptParser, ARRAY_SIZE (CmArchCommonGenericInterruptParser) },
{ "PlatIrqAckReg", sizeof (PCC_MAILBOX_REGISTER_INFO),
NULL, NULL, CmArmMailboxRegisterInfoParser,
ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
@@ -647,15 +633,15 @@ STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType34InfoParser[] = {
ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
};
-/** A parser for EArmObjPccSubspaceType5Info.
+/** A parser for EArchCommonObjPccSubspaceType5Info.
*/
-STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType5InfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonPccSubspaceType5InfoParser[] = {
{ "GenericPccInfo", sizeof (PCC_SUBSPACE_GENERIC_INFO),
- NULL, NULL, CmArmPccSubspaceType0InfoParser,
- ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
- { "Version", 2, "0x%x",NULL },
- { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT), NULL, NULL,
- CmArmGenericInterruptParser, ARRAY_SIZE (CmArmGenericInterruptParser) },
+ NULL, NULL, CmArchCommonPccSubspaceType0InfoParser,
+ ARRAY_SIZE (CmArchCommonPccSubspaceType0InfoParser) },
+ { "Version", 2, "0x%x",NULL },
+ { "PlatIrq", sizeof (CM_ARCH_COMMON_GENERIC_INTERRUPT),NULL, NULL,
+ CmArchCommonGenericInterruptParser, ARRAY_SIZE (CmArchCommonGenericInterruptParser) },
{ "CmdCompleteCheckReg", sizeof (PCC_MAILBOX_REGISTER_INFO),
NULL, NULL, CmArmMailboxRegisterInfoParser,
ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
@@ -670,135 +656,240 @@ STATIC CONST CM_OBJ_PARSER CmArmEtInfo[] = {
{ "EtType", sizeof (ARM_ET_TYPE), "0x%x", NULL }
};
-/** A parser for EArmObjPsdInfo.
+/** A parser for EArchCommonObjPsdInfo.
*/
-STATIC CONST CM_OBJ_PARSER CmArmPsdInfoParser[] = {
+STATIC CONST CM_OBJ_PARSER CmArchCommonPsdInfoParser[] = {
{ "Revision", 1, "0x%x", NULL },
{ "DomainId", 4, "0x%x", NULL },
{ "CoordType", 4, "0x%x", NULL },
{ "NumProc", 4, "0x%x", NULL },
};
+/** A parser for EArchCommonObjTpm2InterfaceInfo.
+*/
+STATIC CONST CM_OBJ_PARSER CmArchCommonTpm2InterfaceInfo[] = {
+ { "PlatformClass", sizeof (UINT16), "0x%x", NULL },
+ { "AddressOfControlArea", sizeof (UINT64), "0x%llx", NULL },
+ { "StartMethod", sizeof (UINT32), "0x%x", NULL },
+ { "StartMethodParametersSize", sizeof (UINT8), "0x%x", NULL },
+ { "StartMethodParameters", EFI_TPM2_ACPI_TABLE_START_METHOD_SPECIFIC_PARAMETERS_MAX_SIZE, NULL, HexDump },
+ { "Laml", sizeof (UINT32), "0x%x", NULL },
+ { "Lasa", sizeof (UINT64), "0x%llx", NULL },
+};
+
+/** A parser for Arch Common namespace objects.
+*/
+STATIC CONST CM_OBJ_PARSER_ARRAY ArchCommonNamespaceObjectParser[] = {
+ CM_PARSER_ADD_OBJECT_RESERVED (EArchCommonObjReserved),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjPowerManagementProfileInfo, CmArchCommonPowerManagementProfileInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjSerialPortInfo, CmArchCommonSerialPortInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjConsolePortInfo, CmArchCommonSerialPortInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjSerialDebugPortInfo, CmArchCommonSerialPortInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjHypervisorVendorIdentity, CmArchCommonHypervisorVendorIdentityParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjFixedFeatureFlags, CmArchCommonFixedFeatureFlagsParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjCmRef, CmArchCommonObjRefParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjPciConfigSpaceInfo, CmArchCommonPciConfigSpaceInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjPciAddressMapInfo, CmArchCommonPciAddressMapInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjPciInterruptMapInfo, CmArchCommonPciInterruptMapInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjMemoryAffinityInfo, CmArchCommonMemoryAffinityInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjDeviceHandleAcpi, CmArchCommonDeviceHandleAcpiParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjDeviceHandlePci, CmArchCommonDeviceHandlePciParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjGenericInitiatorAffinityInfo,CmArchCommonGenericInitiatorAffinityInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjLpiInfo, CmArchCommonLpiInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjProcHierarchyInfo, CmArchCommonProcHierarchyInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjCacheInfo, CmArchCommonCacheInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjCpcInfo, CmArchCommonCpcInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjPccSubspaceType0Info, CmArchCommonPccSubspaceType0InfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjPccSubspaceType1Info, CmArchCommonPccSubspaceType1InfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjPccSubspaceType2Info, CmArchCommonPccSubspaceType2InfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjPccSubspaceType3Info, CmArchCommonPccSubspaceType34InfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjPccSubspaceType4Info, CmArchCommonPccSubspaceType34InfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjPccSubspaceType5Info, CmArchCommonPccSubspaceType5InfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjPsdInfo, CmArchCommonPsdInfoParser),
+ CM_PARSER_ADD_OBJECT (EArchCommonObjTpm2InterfaceInfo, CmArchCommonTpm2InterfaceInfo),
+ CM_PARSER_ADD_OBJECT_RESERVED (EArchCommonObjMax)
+};
+
/** A parser for Arm namespace objects.
*/
STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectParser[] = {
- { "EArmObjReserved", NULL, 0 },
- { "EArmObjBootArchInfo", CmArmBootArchInfoParser,
- ARRAY_SIZE (CmArmBootArchInfoParser) },
- { "EArmObjCpuInfo", NULL, 0 },
- { "EArmObjPowerManagementProfileInfo", CmArmPowerManagementProfileInfoParser,
- ARRAY_SIZE (CmArmPowerManagementProfileInfoParser) },
- { "EArmObjGicCInfo", CmArmGicCInfoParser, ARRAY_SIZE (CmArmGicCInfoParser) },
- { "EArmObjGicDInfo", CmArmGicDInfoParser, ARRAY_SIZE (CmArmGicDInfoParser) },
- { "EArmObjGicMsiFrameInfo", CmArmGicMsiFrameInfoParser,
- ARRAY_SIZE (CmArmGicMsiFrameInfoParser) },
- { "EArmObjGicRedistributorInfo", CmArmGicRedistInfoParser,
- ARRAY_SIZE (CmArmGicRedistInfoParser) },
- { "EArmObjGicItsInfo", CmArmGicItsInfoParser,
- ARRAY_SIZE (CmArmGicItsInfoParser) },
- { "EArmObjSerialConsolePortInfo", CmArmSerialPortInfoParser,
- ARRAY_SIZE (CmArmSerialPortInfoParser) },
- { "EArmObjSerialDebugPortInfo", CmArmSerialPortInfoParser,
- ARRAY_SIZE (CmArmSerialPortInfoParser) },
- { "EArmObjGenericTimerInfo", CmArmGenericTimerInfoParser,
- ARRAY_SIZE (CmArmGenericTimerInfoParser) },
- { "EArmObjPlatformGTBlockInfo", CmArmGTBlockInfoParser,
- ARRAY_SIZE (CmArmGTBlockInfoParser) },
- { "EArmObjGTBlockTimerFrameInfo", CmArmGTBlockTimerFrameInfoParser,
- ARRAY_SIZE (CmArmGTBlockTimerFrameInfoParser) },
- { "EArmObjPlatformGenericWatchdogInfo", CmArmGenericWatchdogInfoParser,
- ARRAY_SIZE (CmArmGenericWatchdogInfoParser) },
- { "EArmObjPciConfigSpaceInfo", CmArmPciConfigSpaceInfoParser,
- ARRAY_SIZE (CmArmPciConfigSpaceInfoParser) },
- { "EArmObjHypervisorVendorIdentity", CmArmHypervisorVendorIdParser,
- ARRAY_SIZE (CmArmHypervisorVendorIdParser) },
- { "EArmObjFixedFeatureFlags", CmArmFixedFeatureFlagsParser,
- ARRAY_SIZE (CmArmFixedFeatureFlagsParser) },
- { "EArmObjItsGroup", CmArmItsGroupNodeParser,
- ARRAY_SIZE (CmArmItsGroupNodeParser) },
- { "EArmObjNamedComponent", CmArmNamedComponentNodeParser,
- ARRAY_SIZE (CmArmNamedComponentNodeParser) },
- { "EArmObjRootComplex", CmArmRootComplexNodeParser,
- ARRAY_SIZE (CmArmRootComplexNodeParser) },
- { "EArmObjSmmuV1SmmuV2", CmArmSmmuV1SmmuV2NodeParser,
- ARRAY_SIZE (CmArmSmmuV1SmmuV2NodeParser) },
- { "EArmObjSmmuV3", CmArmSmmuV3NodeParser,
- ARRAY_SIZE (CmArmSmmuV3NodeParser) },
- { "EArmObjPmcg", CmArmPmcgNodeParser, ARRAY_SIZE (CmArmPmcgNodeParser) },
- { "EArmObjGicItsIdentifierArray", CmArmGicItsIdentifierParser,
- ARRAY_SIZE (CmArmGicItsIdentifierParser) },
- { "EArmObjIdMappingArray", CmArmIdMappingParser,
- ARRAY_SIZE (CmArmIdMappingParser) },
- { "EArmObjSmmuInterruptArray", CmArmGenericInterruptParser,
- ARRAY_SIZE (CmArmGenericInterruptParser) },
- { "EArmObjProcHierarchyInfo", CmArmProcHierarchyInfoParser,
- ARRAY_SIZE (CmArmProcHierarchyInfoParser) },
- { "EArmObjCacheInfo", CmArmCacheInfoParser,
- ARRAY_SIZE (CmArmCacheInfoParser) },
- { "EArmObjProcNodeIdInfo", CmArmProcNodeIdInfoParser,
- ARRAY_SIZE (CmArmProcNodeIdInfoParser) },
- { "EArmObjCmRef", CmArmObjRefParser, ARRAY_SIZE (CmArmObjRefParser) },
- { "EArmObjMemoryAffinityInfo", CmArmMemoryAffinityInfoParser,
- ARRAY_SIZE (CmArmMemoryAffinityInfoParser) },
- { "EArmObjDeviceHandleAcpi", CmArmDeviceHandleAcpiParser,
- ARRAY_SIZE (CmArmDeviceHandleAcpiParser) },
- { "EArmObjDeviceHandlePci", CmArmDeviceHandlePciParser,
- ARRAY_SIZE (CmArmDeviceHandlePciParser) },
- { "EArmObjGenericInitiatorAffinityInfo",
- CmArmGenericInitiatorAffinityInfoParser,
- ARRAY_SIZE (CmArmGenericInitiatorAffinityInfoParser) },
- { "EArmObjSerialPortInfo", CmArmSerialPortInfoParser,
- ARRAY_SIZE (CmArmSerialPortInfoParser) },
- { "EArmObjCmn600Info", CmArmCmn600InfoParser,
- ARRAY_SIZE (CmArmCmn600InfoParser) },
- { "EArmObjLpiInfo", CmArmLpiInfoParser,
- ARRAY_SIZE (CmArmLpiInfoParser) },
- { "EArmObjPciAddressMapInfo", CmArmPciAddressMapInfoParser,
- ARRAY_SIZE (CmArmPciAddressMapInfoParser) },
- { "EArmObjPciInterruptMapInfo", CmPciInterruptMapInfoParser,
- ARRAY_SIZE (CmPciInterruptMapInfoParser) },
- { "EArmObjRmr", CmArmRmrInfoParser,
- ARRAY_SIZE (CmArmRmrInfoParser) },
- { "EArmObjMemoryRangeDescriptor", CmArmMemoryRangeDescriptorInfoParser,
- ARRAY_SIZE (CmArmMemoryRangeDescriptorInfoParser) },
- { "EArmObjCpcInfo", CmArmCpcInfoParser,
- ARRAY_SIZE (CmArmCpcInfoParser) },
- { "EArmObjPccSubspaceType0Info", CmArmPccSubspaceType0InfoParser,
- ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
- { "EArmObjPccSubspaceType1Info", CmArmPccSubspaceType1InfoParser,
- ARRAY_SIZE (CmArmPccSubspaceType1InfoParser) },
- { "EArmObjPccSubspaceType2Info", CmArmPccSubspaceType2InfoParser,
- ARRAY_SIZE (CmArmPccSubspaceType2InfoParser) },
- { "EArmObjPccSubspaceType3Info", CmArmPccSubspaceType34InfoParser,
- ARRAY_SIZE (CmArmPccSubspaceType34InfoParser) },
- { "EArmObjPccSubspaceType4Info", CmArmPccSubspaceType34InfoParser,
- ARRAY_SIZE (CmArmPccSubspaceType34InfoParser) },
- { "EArmObjPccSubspaceType5Info", CmArmPccSubspaceType5InfoParser,
- ARRAY_SIZE (CmArmPccSubspaceType5InfoParser) },
- { "EArmObjEtInfo", CmArmEtInfo,
- ARRAY_SIZE (CmArmEtInfo) },
- { "EArmObjPsdInfo", CmArmPsdInfoParser,
- ARRAY_SIZE (CmArmPsdInfoParser) },
- { "EArmObjMax", NULL, 0 },
+ CM_PARSER_ADD_OBJECT_RESERVED (EArmObjReserved),
+ CM_PARSER_ADD_OBJECT (EArmObjBootArchInfo, CmArmBootArchInfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjGicCInfo, CmArmGicCInfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjGicDInfo, CmArmGicDInfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjGicMsiFrameInfo, CmArmGicMsiFrameInfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjGicRedistributorInfo, CmArmGicRedistInfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjGicItsInfo, CmArmGicItsInfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjGenericTimerInfo, CmArmGenericTimerInfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjPlatformGTBlockInfo, CmArmGTBlockInfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjGTBlockTimerFrameInfo, CmArmGTBlockTimerFrameInfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjPlatformGenericWatchdogInfo,CmArmGenericWatchdogInfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjItsGroup, CmArmItsGroupNodeParser),
+ CM_PARSER_ADD_OBJECT (EArmObjNamedComponent, CmArmNamedComponentNodeParser),
+ CM_PARSER_ADD_OBJECT (EArmObjRootComplex, CmArmRootComplexNodeParser),
+ CM_PARSER_ADD_OBJECT (EArmObjSmmuV1SmmuV2, CmArmSmmuV1SmmuV2NodeParser),
+ CM_PARSER_ADD_OBJECT (EArmObjSmmuV3, CmArmSmmuV3NodeParser),
+ CM_PARSER_ADD_OBJECT (EArmObjPmcg, CmArmPmcgNodeParser),
+ CM_PARSER_ADD_OBJECT (EArmObjGicItsIdentifierArray, CmArmGicItsIdentifierParser),
+ CM_PARSER_ADD_OBJECT (EArmObjIdMappingArray, CmArmIdMappingParser),
+ CM_PARSER_ADD_OBJECT (EArmObjSmmuInterruptArray, CmArchCommonGenericInterruptParser),
+ CM_PARSER_ADD_OBJECT (EArmObjCmn600Info, CmArmCmn600InfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjRmr, CmArmRmrInfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjMemoryRangeDescriptor, CmArmMemoryRangeDescriptorInfoParser),
+ CM_PARSER_ADD_OBJECT (EArmObjEtInfo, CmArmEtInfo),
+ CM_PARSER_ADD_OBJECT_RESERVED (EArmObjMax)
+};
+
+/** A parser for EX64ObjFadtSciInterrupt.
+*/
+STATIC CONST CM_OBJ_PARSER CmX64ObjFadtSciInterruptParser[] = {
+ { "SciInterrupt", 2, "0x%x", NULL }
+};
+
+/** A parser for EX64ObjFadtSciCmdInfo.
+*/
+STATIC CONST CM_OBJ_PARSER CmX64ObjFadtSciCmdInfoParser[] = {
+ { "SciCmd", 4, "0x%x", NULL },
+ { "AcpiEnable", 1, "0x%x", NULL },
+ { "AcpiDisable", 1, "0x%x", NULL },
+ { "S4BiosReq", 1, "0x%x", NULL },
+ { "PstateCnt", 1, "0x%x", NULL },
+ { "CstCnt", 1, "0x%x", NULL }
+};
+
+/** A parser for EX64ObjFadtPmBlockInfo.
+*/
+STATIC CONST CM_OBJ_PARSER CmX64ObjFadtPmBlockInfoParser[] = {
+ { "Pm1aEvtBlk", 4, "0x%x", NULL },
+ { "Pm1bEvtBlk", 4, "0x%x", NULL },
+ { "Pm1aCntBlk", 4, "0x%x", NULL },
+ { "Pm1bCntBlk", 4, "0x%x", NULL },
+ { "Pm2CntBlk", 4, "0x%x", NULL },
+ { "PmTmrBlk", 4, "0x%x", NULL },
+ { "Pm1EvtLen", 1, "0x%x", NULL },
+ { "Pm1CntLen", 1, "0x%x", NULL },
+ { "Pm2CntLen", 1, "0x%x", NULL },
+ { "PmTmrLen", 1, "0x%x", NULL }
+};
+
+/** A parser for EX64ObjFadtGpeBlockInfo.
+*/
+STATIC CONST CM_OBJ_PARSER CmX64ObjFadtGpeBlockInfoParser[] = {
+ { "Gpe0Blk", 4, "0x%x", NULL },
+ { "Gpe1Blk", 4, "0x%x", NULL },
+ { "Gpe0BlkLen", 1, "0x%x", NULL },
+ { "Gpe1BlkLen", 1, "0x%x", NULL },
+ { "Gpe1Base", 1, "0x%x", NULL }
+};
+
+/** A parser for EX64ObjFadtXpmBlockInfo.
+*/
+STATIC CONST CM_OBJ_PARSER CmX64ObjFadtXpmBlockInfoParser[] = {
+ { "XPm1aEvtBlk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE),
+ NULL, NULL, AcpiGenericAddressParser,
+ ARRAY_SIZE (AcpiGenericAddressParser) },
+ { "XPm1bEvtBlk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE),
+ NULL, NULL, AcpiGenericAddressParser,
+ ARRAY_SIZE (AcpiGenericAddressParser) },
+ { "XPm1aCntBlk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE),
+ NULL, NULL, AcpiGenericAddressParser,
+ ARRAY_SIZE (AcpiGenericAddressParser) },
+ { "XPm1bCntBlk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE),
+ NULL, NULL, AcpiGenericAddressParser,
+ ARRAY_SIZE (AcpiGenericAddressParser) },
+ { "XPm2CntBlk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE),
+ NULL, NULL, AcpiGenericAddressParser,
+ ARRAY_SIZE (AcpiGenericAddressParser) },
+ { "XPmTmrBlk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE),
+ NULL, NULL, AcpiGenericAddressParser,
+ ARRAY_SIZE (AcpiGenericAddressParser) }
+};
+
+/** A parser for EX64ObjFadtXgpeBlockInfo.
+*/
+STATIC CONST CM_OBJ_PARSER CmX64ObjFadtXgpeBlockInfoParser[] = {
+ { "XGpe0Blk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE),
+ NULL, NULL, AcpiGenericAddressParser,
+ ARRAY_SIZE (AcpiGenericAddressParser) },
+ { "XGpe1Blk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE),
+ NULL, NULL, AcpiGenericAddressParser,
+ ARRAY_SIZE (AcpiGenericAddressParser) }
+};
+
+/** A parser for EX64ObjFadtSleepBlockInfo.
+*/
+STATIC CONST CM_OBJ_PARSER CmX64ObjFadtSleepBlockInfoParser[] = {
+ { "SleepControlReg", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE),
+ NULL, NULL, AcpiGenericAddressParser,
+ ARRAY_SIZE (AcpiGenericAddressParser) },
+ { "SleepStatusReg", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE),
+ NULL, NULL, AcpiGenericAddressParser,
+ ARRAY_SIZE (AcpiGenericAddressParser) }
+};
+
+/** A parser for EX64ObjFadtResetBlockInfo.
+*/
+STATIC CONST CM_OBJ_PARSER CmX64ObjFadtResetBlockInfoParser[] = {
+ { "ResetReg", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE),
+ NULL, NULL, AcpiGenericAddressParser,
+ ARRAY_SIZE (AcpiGenericAddressParser) },
+ { "ResetValue", 1, "0x%x",NULL }
+};
+
+/** A parser for EX64ObjFadtMiscInfo.
+*/
+STATIC CONST CM_OBJ_PARSER CmX64ObjFadtMiscInfoParser[] = {
+ { "PLvl2Lat", 2, "0x%x", NULL },
+ { "PLvl3Lat", 2, "0x%x", NULL },
+ { "FlushSize", 2, "0x%x", NULL },
+ { "FlushStride", 2, "0x%x", NULL },
+ { "DutyOffset", 1, "0x%x", NULL },
+ { "DutyWidth", 1, "0x%x", NULL },
+ { "DayAlrm", 1, "0x%x", NULL },
+ { "MonAlrm", 1, "0x%x", NULL },
+ { "Century", 1, "0x%x", NULL }
+};
+
+/** A parser for EX64ObjWsmtFlagsInfo.
+*/
+STATIC CONST CM_OBJ_PARSER CmX64ObjWsmtFlagsInfoParser[] = {
+ { "WsmtFlags", 4, "0x%x", NULL }
+};
+
+/** A parser for X64 namespace objects.
+*/
+STATIC CONST CM_OBJ_PARSER_ARRAY X64NamespaceObjectParser[] = {
+ CM_PARSER_ADD_OBJECT_RESERVED (EX64ObjReserved),
+ CM_PARSER_ADD_OBJECT (EX64ObjFadtSciInterrupt, CmX64ObjFadtSciInterruptParser),
+ CM_PARSER_ADD_OBJECT (EX64ObjFadtSciCmdInfo, CmX64ObjFadtSciCmdInfoParser),
+ CM_PARSER_ADD_OBJECT (EX64ObjFadtPmBlockInfo, CmX64ObjFadtPmBlockInfoParser),
+ CM_PARSER_ADD_OBJECT (EX64ObjFadtGpeBlockInfo, CmX64ObjFadtGpeBlockInfoParser),
+ CM_PARSER_ADD_OBJECT (EX64ObjFadtXpmBlockInfo, CmX64ObjFadtXpmBlockInfoParser),
+ CM_PARSER_ADD_OBJECT (EX64ObjFadtXgpeBlockInfo, CmX64ObjFadtXgpeBlockInfoParser),
+ CM_PARSER_ADD_OBJECT (EX64ObjFadtSleepBlockInfo,CmX64ObjFadtSleepBlockInfoParser),
+ CM_PARSER_ADD_OBJECT (EX64ObjFadtResetBlockInfo,CmX64ObjFadtResetBlockInfoParser),
+ CM_PARSER_ADD_OBJECT (EX64ObjFadtMiscInfo, CmX64ObjFadtMiscInfoParser),
+ CM_PARSER_ADD_OBJECT (EX64ObjWsmtFlagsInfo, CmX64ObjWsmtFlagsInfoParser),
+ CM_PARSER_ADD_OBJECT_RESERVED (EX64ObjMax)
};
/** A parser for EStdObjCfgMgrInfo.
*/
STATIC CONST CM_OBJ_PARSER StdObjCfgMgrInfoParser[] = {
- { "Revision", 4, "0x%x", NULL },
- { "OemId[6]", 6, "%c%c%c%c%c%c", PrintChar6 }
+ { "Revision", 4, "0x%x", NULL },
+ { "OemId[6]", 6, NULL, PrintChars }
};
/** A parser for EStdObjAcpiTableList.
*/
STATIC CONST CM_OBJ_PARSER StdObjAcpiTableInfoParser[] = {
- { "AcpiTableSignature", 4, "%c%c%c%c", PrintChar4 },
- { "AcpiTableRevision", 1, "%d", NULL },
- { "TableGeneratorId", sizeof (ACPI_TABLE_GENERATOR_ID), "0x%x", NULL },
- { "AcpiTableData", sizeof (EFI_ACPI_DESCRIPTION_HEADER *), "0x%p", NULL },
- { "OemTableId", 8, "%c%c%c%c%c%c%c%c", PrintChar8 },
- { "OemRevision", 4, "0x%x", NULL },
- { "MinorRevision", 1, "0x%x", NULL },
+ { "AcpiTableSignature", 4, NULL, PrintChars },
+ { "AcpiTableRevision", 1, "%d", NULL },
+ { "TableGeneratorId", sizeof (ACPI_TABLE_GENERATOR_ID), "0x%x", NULL },
+ { "AcpiTableData", sizeof (EFI_ACPI_DESCRIPTION_HEADER *), "0x%p", NULL },
+ { "OemTableId", 8, NULL, PrintChars },
+ { "OemRevision", 4, "0x%x", NULL },
+ { "MinorRevision", 1, "0x%x", NULL },
};
/** A parser for EStdObjSmbiosTableList.
@@ -811,13 +902,10 @@ STATIC CONST CM_OBJ_PARSER StdObjSmbiosTableInfoParser[] = {
/** A parser for Standard namespace objects.
*/
STATIC CONST CM_OBJ_PARSER_ARRAY StdNamespaceObjectParser[] = {
- { "EStdObjCfgMgrInfo", StdObjCfgMgrInfoParser,
- ARRAY_SIZE (StdObjCfgMgrInfoParser) },
- { "EStdObjAcpiTableList", StdObjAcpiTableInfoParser,
- ARRAY_SIZE (StdObjAcpiTableInfoParser) },
- { "EStdObjSmbiosTableList", StdObjSmbiosTableInfoParser,
- ARRAY_SIZE (StdObjSmbiosTableInfoParser) },
- { "EStdObjMax", NULL, 0}
+ CM_PARSER_ADD_OBJECT (EStdObjCfgMgrInfo, StdObjCfgMgrInfoParser),
+ CM_PARSER_ADD_OBJECT (EStdObjAcpiTableList, StdObjAcpiTableInfoParser),
+ CM_PARSER_ADD_OBJECT (EStdObjSmbiosTableList, StdObjSmbiosTableInfoParser),
+ CM_PARSER_ADD_OBJECT_RESERVED (EStdObjMax)
};
/** Print string data.
@@ -826,13 +914,15 @@ STATIC CONST CM_OBJ_PARSER_ARRAY StdNamespaceObjectParser[] = {
@param [in] Format Format to print the Ptr.
@param [in] Ptr Pointer to the string.
+ @param [in] Length Length of the field
**/
STATIC
VOID
EFIAPI
PrintString (
IN CONST CHAR8 *Format,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Ptr == NULL) {
@@ -840,7 +930,7 @@ PrintString (
return;
}
- DEBUG ((DEBUG_ERROR, "%a", Ptr));
+ DEBUG ((DEBUG_INFO, "%a", Ptr));
}
/** Print string from pointer.
@@ -849,13 +939,15 @@ PrintString (
@param [in] Format Format to print the string.
@param [in] Ptr Pointer to the string pointer.
+ @param [in] Length Length of the field
**/
STATIC
VOID
EFIAPI
PrintStringPtr (
IN CONST CHAR8 *Format,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
UINT8 *String;
@@ -871,82 +963,51 @@ PrintStringPtr (
String = (UINT8 *)"(NULLPTR)";
}
- PrintString (Format, String);
+ PrintString (Format, String, Length);
}
-/** Print 4 characters.
+/** Print characters.
@param [in] Format Format to print the Ptr.
@param [in] Ptr Pointer to the characters.
+ @param [in] Length Length of the field
**/
STATIC
VOID
EFIAPI
-PrintChar4 (
+PrintChars (
IN CONST CHAR8 *Format,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
- DEBUG ((
- DEBUG_ERROR,
- (Format != NULL) ? Format : "%c%c%c%c",
- Ptr[0],
- Ptr[1],
- Ptr[2],
- Ptr[3]
- ));
-}
-
-/** Print 6 characters.
+ UINT32 Index;
- @param [in] Format Format to print the Ptr.
- @param [in] Ptr Pointer to the characters.
-**/
-STATIC
-VOID
-EFIAPI
-PrintChar6 (
- IN CONST CHAR8 *Format,
- IN UINT8 *Ptr
- )
-{
- DEBUG ((
- DEBUG_ERROR,
- (Format != NULL) ? Format : "%c%c%c%c%c%c",
- Ptr[0],
- Ptr[1],
- Ptr[2],
- Ptr[3],
- Ptr[4],
- Ptr[5]
- ));
+ for (Index = 0; Index < Length; Index++) {
+ DEBUG ((DEBUG_INFO, "%c", Ptr[Index]));
+ }
}
-/** Print 8 characters.
+/** Dump data in Hex format
@param [in] Format Format to print the Ptr.
- @param [in] Ptr Pointer to the characters.
+ @param [in] Ptr Pointer to the string.
+ @param [in] Length Length of the field
**/
STATIC
VOID
EFIAPI
-PrintChar8 (
- IN CONST CHAR8 *Format,
- IN UINT8 *Ptr
+HexDump (
+ IN CONST CHAR8 *Format,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
- DEBUG ((
- DEBUG_ERROR,
- (Format != NULL) ? Format : "%c%c%c%c%c%c%c%c",
- Ptr[0],
- Ptr[1],
- Ptr[2],
- Ptr[3],
- Ptr[4],
- Ptr[5],
- Ptr[6],
- Ptr[7]
- ));
+ UINT32 Index;
+
+ for (Index = 0; Index < Length; Index++) {
+ DEBUG ((DEBUG_INFO, "0x%02x ", *Ptr++));
+ }
}
/** Print fields of the objects.
@@ -988,7 +1049,7 @@ PrintCmObjDesc (
*RemainingSize -= Parser[Index].Length;
if (*RemainingSize < 0) {
DEBUG ((
- DEBUG_INFO,
+ DEBUG_ERROR,
"\nERROR: %a: Buffer overrun\n",
Parser[Index].NameStr
));
@@ -1008,7 +1069,7 @@ PrintCmObjDesc (
Parser[Index].NameStr
));
if (Parser[Index].PrintFormatter != NULL) {
- Parser[Index].PrintFormatter (Parser[Index].Format, Data);
+ Parser[Index].PrintFormatter (Parser[Index].Format, Data, Parser[Index].Length);
} else if (Parser[Index].Format != NULL) {
switch (Parser[Index].Length) {
case 1:
@@ -1111,6 +1172,37 @@ ParseCmObjDesc (
ParserArray = &ArmNamespaceObjectParser[ObjId];
break;
+
+ case EObjNameSpaceArchCommon:
+ if (ObjId >= EArchCommonObjMax) {
+ ASSERT (0);
+ return;
+ }
+
+ if (ObjId >= ARRAY_SIZE (ArchCommonNamespaceObjectParser)) {
+ DEBUG ((DEBUG_ERROR, "ObjId 0x%x is missing from the ArchCommonNamespaceObjectParser array\n", ObjId));
+ ASSERT (0);
+ return;
+ }
+
+ ParserArray = &ArchCommonNamespaceObjectParser[ObjId];
+ break;
+
+ case EObjNameSpaceX64:
+ if (ObjId >= EX64ObjMax) {
+ ASSERT (0);
+ return;
+ }
+
+ if (ObjId >= ARRAY_SIZE (X64NamespaceObjectParser)) {
+ DEBUG ((DEBUG_ERROR, "ObjId 0x%x is missing from the X64NamespaceObjectParser array\n", ObjId));
+ ASSERT (0);
+ return;
+ }
+
+ ParserArray = &X64NamespaceObjectParser[ObjId];
+ break;
+
default:
// Not supported
DEBUG ((DEBUG_ERROR, "NameSpaceId 0x%x, ObjId 0x%x is not supported by the parser\n", NameSpaceId, ObjId));
@@ -1131,6 +1223,9 @@ ParseCmObjDesc (
ObjIndex + 1,
ObjectCount
));
+
+ ASSERT (ObjId == ParserArray->ObjectId);
+
if (ParserArray->Parser == NULL) {
DEBUG ((DEBUG_ERROR, "Parser not implemented\n"));
RemainingSize = 0;
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.h b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.h
index 3204f53..3ec82d2 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.h
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.h
@@ -2,6 +2,7 @@
Configuration Manager Object parser.
Copyright (c) 2021, ARM Limited. All rights reserved.<BR>
+ Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -11,13 +12,26 @@
#define OUTPUT_FIELD_COLUMN_WIDTH 32
+/** A helper macro for populating the Reserved objects
+ like EArmObjReserved, EArmObjMax, etc. in the CM_OBJ_PARSER_ARRAY.
+**/
+#define CM_PARSER_ADD_OBJECT_RESERVED(ObjectId) \
+ {ObjectId, #ObjectId, NULL, 0}
+
+/** A helper macro for populating the Cm Arm objects
+ in the CM_OBJ_PARSER_ARRAY.
+**/
+#define CM_PARSER_ADD_OBJECT(ObjectId, Parser) \
+ {ObjectId, #ObjectId, Parser, ARRAY_SIZE(Parser) }
+
/** Function prototype to format a field print.
@param [in] Format Format string for tracing the data as specified by
the 'Format' member of ACPI_PARSER.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field
**/
-typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR8 *Format, UINT8 *Ptr);
+typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR8 *Format, UINT8 *Ptr, UINT32 Length);
/**
The CM_OBJ_PARSER structure describes the fields of an CmObject and
@@ -58,6 +72,9 @@ struct CmObjParser {
with their object names.
*/
typedef struct CmObjParserArray {
+ /// Object ID
+ CONST UINTN ObjectId;
+
/// Object name
CONST CHAR8 *ObjectName;
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtHwInfoParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtHwInfoParser.c
new file mode 100644
index 0000000..2c9105e
--- /dev/null
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtHwInfoParser.c
@@ -0,0 +1,83 @@
+/** @file
+ Arm Flattened Device Tree parser library for KvmTool.
+
+ Copyright (c) 2021, ARM Limited. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include "FdtHwInfoParser.h"
+#include "Arm/BootArch/ArmBootArchParser.h"
+#include "Arm/GenericTimer/ArmGenericTimerParser.h"
+#include "Arm/Gic/ArmGicDispatcher.h"
+#include "Pci/PciConfigSpaceParser.h"
+#include "Serial/SerialPortParser.h"
+
+/** Ordered table of parsers/dispatchers.
+
+ A parser parses a Device Tree to populate a specific CmObj type. None,
+ one or many CmObj can be created by the parser.
+ The created CmObj are then handed to the parser's caller through the
+ HW_INFO_ADD_OBJECT interface.
+ This can also be a dispatcher. I.e. a function that not parsing a
+ Device Tree but calling other parsers.
+*/
+STATIC CONST FDT_HW_INFO_PARSER_FUNC HwInfoParserTable[] = {
+ ArmBootArchInfoParser,
+ ArmGenericTimerInfoParser,
+ ArmGicDispatcher,
+ PciConfigInfoParser,
+ SerialPortDispatcher
+};
+
+/** Main dispatcher: sequentially call the parsers/dispatchers
+ of the HwInfoParserTable.
+
+ A parser parses a Device Tree to populate a specific CmObj type. None,
+ one or many CmObj can be created by the parser.
+ The created CmObj are then handed to the parser's caller through the
+ HW_INFO_ADD_OBJECT interface.
+ This can also be a dispatcher. I.e. a function that not parsing a
+ Device Tree but calling other parsers.
+
+ @param [in] FdtParserHandle A handle to the parser instance.
+ @param [in] FdtBranch When searching for DT node name, restrict
+ the search to this Device Tree branch.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_ABORTED An error occurred.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_NOT_FOUND Not found.
+ @retval EFI_UNSUPPORTED Unsupported.
+**/
+EFI_STATUS
+EFIAPI
+ArchFdtHwInfoMainDispatcher (
+ IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle,
+ IN INT32 FdtBranch
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Index;
+
+ if (fdt_check_header (FdtParserHandle->Fdt) < 0) {
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ for (Index = 0; Index < ARRAY_SIZE (HwInfoParserTable); Index++) {
+ Status = HwInfoParserTable[Index](
+ FdtParserHandle,
+ FdtBranch
+ );
+ if (EFI_ERROR (Status) &&
+ (Status != EFI_NOT_FOUND))
+ {
+ // If EFI_NOT_FOUND, the parser didn't find information in the DT.
+ // Don't trigger an error.
+ ASSERT (0);
+ return Status;
+ }
+ } // for
+
+ return EFI_SUCCESS;
+}
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c
new file mode 100644
index 0000000..71774fa
--- /dev/null
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c
@@ -0,0 +1,118 @@
+/** @file
+ Flattened device tree utility.
+
+ Copyright (c) 2021, ARM Limited. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - Device tree Specification - Release v0.3
+ - linux/Documentation/devicetree/bindings/interrupt-controller/arm%2Cgic.yaml
+ - linux//Documentation/devicetree/bindings/interrupt-controller/arm%2Cgic.yaml
+**/
+
+#include <FdtHwInfoParserInclude.h>
+#include "FdtUtility.h"
+
+/** Get the interrupt Id of an interrupt described in a fdt.
+
+ Data must describe a GIC interrupt. A GIC interrupt is on at least
+ 3 UINT32 cells.
+ This function DOES NOT SUPPORT extended SPI range and extended PPI range.
+
+ @param [in] Data Pointer to the first cell of an "interrupts" property.
+
+ @retval The interrupt id.
+**/
+UINT32
+EFIAPI
+FdtGetInterruptId (
+ UINT32 CONST *Data
+ )
+{
+ UINT32 IrqType;
+ UINT32 IrqId;
+
+ ASSERT (Data != NULL);
+
+ IrqType = fdt32_to_cpu (Data[IRQ_TYPE_OFFSET]);
+ IrqId = fdt32_to_cpu (Data[IRQ_NUMBER_OFFSET]);
+
+ switch (IrqType) {
+ case DT_SPI_IRQ:
+ IrqId += SPI_OFFSET;
+ break;
+
+ case DT_PPI_IRQ:
+ IrqId += PPI_OFFSET;
+ break;
+
+ default:
+ ASSERT (0);
+ IrqId = 0;
+ }
+
+ return IrqId;
+}
+
+/** Get the ACPI interrupt flags of an interrupt described in a fdt.
+
+ Data must describe a GIC interrupt. A GIC interrupt is on at least
+ 3 UINT32 cells.
+
+ PPI interrupt cpu mask on bits [15:8] are ignored.
+
+ @param [in] Data Pointer to the first cell of an "interrupts" property.
+
+ @retval The interrupt flags (for ACPI).
+**/
+UINT32
+EFIAPI
+FdtGetInterruptFlags (
+ UINT32 CONST *Data
+ )
+{
+ UINT32 IrqFlags;
+ UINT32 AcpiIrqFlags;
+
+ ASSERT (Data != NULL);
+
+ IrqFlags = fdt32_to_cpu (Data[IRQ_FLAGS_OFFSET]);
+
+ AcpiIrqFlags = DT_IRQ_IS_EDGE_TRIGGERED (IrqFlags) ? BIT0 : 0;
+ AcpiIrqFlags |= DT_IRQ_IS_ACTIVE_LOW (IrqFlags) ? BIT1 : 0;
+
+ return AcpiIrqFlags;
+}
+
+/** For relevant architectures, get the "#address-cells" and/or "#size-cells"
+ property of the node.
+
+ According to the Device Tree specification, s2.3.5 "#address-cells and
+ #size-cells":
+ "If missing, a client program should assume a default value of 2 for
+ #address-cells, and a value of 1 for #size-cells."
+
+ @param [in] Fdt Pointer to a Flattened Device Tree.
+ @param [in] Node Offset of the node having to get the
+ "#address-cells" and "#size-cells"
+ properties from.
+ @param [out] AddressCells If success, number of address-cells.
+ If the property is not available,
+ default value is 2.
+ @param [out] SizeCells If success, number of size-cells.
+ If the property is not available,
+ default value is 1.
+
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+FdtGetIntcAddressCells (
+ IN CONST VOID *Fdt,
+ IN INT32 Node,
+ OUT INT32 *AddressCells, OPTIONAL
+ OUT INT32 *SizeCells OPTIONAL
+ )
+{
+ return FdtGetAddressInfo (Fdt, Node, AddressCells, SizeCells);
+}
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/BootArch/ArmBootArchParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/BootArch/ArmBootArchParser.c
index b07b6b8..d217e33 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/BootArch/ArmBootArchParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/BootArch/ArmBootArchParser.c
@@ -10,7 +10,7 @@
#include "FdtHwInfoParser.h"
#include "CmObjectDescUtility.h"
-#include "BootArch/ArmBootArchParser.h"
+#include "Arm/BootArch/ArmBootArchParser.h"
/** List of "compatible" property values for Psci nodes.
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/BootArch/ArmBootArchParser.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/BootArch/ArmBootArchParser.h
index 51654f0..51654f0 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/BootArch/ArmBootArchParser.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/BootArch/ArmBootArchParser.h
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/GenericTimer/ArmGenericTimerParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/GenericTimer/ArmGenericTimerParser.c
index 988a812..6488399 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/GenericTimer/ArmGenericTimerParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/GenericTimer/ArmGenericTimerParser.c
@@ -10,8 +10,8 @@
#include "FdtHwInfoParser.h"
#include "CmObjectDescUtility.h"
-#include "GenericTimer/ArmGenericTimerParser.h"
-#include "Gic/ArmGicDispatcher.h"
+#include "Arm/GenericTimer/ArmGenericTimerParser.h"
+#include "Arm/Gic/ArmGicDispatcher.h"
/** List of "compatible" property values for timer nodes.
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/GenericTimer/ArmGenericTimerParser.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/GenericTimer/ArmGenericTimerParser.h
index d7fa278..d7fa278 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/GenericTimer/ArmGenericTimerParser.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/GenericTimer/ArmGenericTimerParser.h
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicCParser.c
index ee82f7a..3955219 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicCParser.c
@@ -11,10 +11,11 @@
- linux/Documentation/devicetree/bindings/arm/pmu.yaml
**/
+#include <Library/ArmLib.h>
#include "FdtHwInfoParser.h"
#include "CmObjectDescUtility.h"
-#include "Gic/ArmGicCParser.h"
-#include "Gic/ArmGicDispatcher.h"
+#include "Arm/Gic/ArmGicCParser.h"
+#include "Arm/Gic/ArmGicDispatcher.h"
/** List of "compatible" property values for CPU nodes.
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicCParser.h
index 539f39c..539f39c 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicCParser.h
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicDParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDParser.c
index b7f5696..906ef8b 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicDParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDParser.c
@@ -11,8 +11,8 @@
#include "CmObjectDescUtility.h"
#include "FdtHwInfoParser.h"
-#include "Gic/ArmGicDispatcher.h"
-#include "Gic/ArmGicDParser.h"
+#include "Arm/Gic/ArmGicDispatcher.h"
+#include "Arm/Gic/ArmGicDParser.h"
/** Parse a Gic compatible interrupt-controller node,
extracting GicD information.
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicDParser.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDParser.h
index b9581f0..b9581f0 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicDParser.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDParser.h
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicDispatcher.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDispatcher.c
index 1f3af1f..ca34d24 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicDispatcher.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDispatcher.c
@@ -10,12 +10,12 @@
**/
#include "FdtHwInfoParser.h"
-#include "Gic/ArmGicCParser.h"
-#include "Gic/ArmGicDispatcher.h"
-#include "Gic/ArmGicDParser.h"
-#include "Gic/ArmGicItsParser.h"
-#include "Gic/ArmGicMsiFrameParser.h"
-#include "Gic/ArmGicRParser.h"
+#include "Arm/Gic/ArmGicCParser.h"
+#include "Arm/Gic/ArmGicDispatcher.h"
+#include "Arm/Gic/ArmGicDParser.h"
+#include "Arm/Gic/ArmGicItsParser.h"
+#include "Arm/Gic/ArmGicMsiFrameParser.h"
+#include "Arm/Gic/ArmGicRParser.h"
/** List of "compatible" property values for GicV2 interrupt nodes.
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicDispatcher.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDispatcher.h
index aa942f7..aa942f7 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicDispatcher.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDispatcher.h
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicItsParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicItsParser.c
index f23818f..6d4bde6 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicItsParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicItsParser.c
@@ -10,8 +10,8 @@
#include "CmObjectDescUtility.h"
#include "FdtHwInfoParser.h"
-#include "Gic/ArmGicDispatcher.h"
-#include "Gic/ArmGicItsParser.h"
+#include "Arm/Gic/ArmGicDispatcher.h"
+#include "Arm/Gic/ArmGicItsParser.h"
/** Parse a Gic compatible interrupt-controller node,
extracting GicIts information.
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicItsParser.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicItsParser.h
index be94449..be94449 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicItsParser.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicItsParser.h
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicMsiFrameParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicMsiFrameParser.c
index c474cb2..dff5bef 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicMsiFrameParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicMsiFrameParser.c
@@ -11,8 +11,8 @@
#include "CmObjectDescUtility.h"
#include "FdtHwInfoParser.h"
-#include "Gic/ArmGicDispatcher.h"
-#include "Gic/ArmGicMsiFrameParser.h"
+#include "Arm/Gic/ArmGicDispatcher.h"
+#include "Arm/Gic/ArmGicMsiFrameParser.h"
/** List of "compatible" property values for Msi-frame nodes.
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicMsiFrameParser.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicMsiFrameParser.h
index 2821a78..2821a78 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicMsiFrameParser.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicMsiFrameParser.h
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicRParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicRParser.c
index 0f9c7bb..de2e1dd 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicRParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicRParser.c
@@ -10,8 +10,8 @@
#include "CmObjectDescUtility.h"
#include "FdtHwInfoParser.h"
-#include "Gic/ArmGicDispatcher.h"
-#include "Gic/ArmGicRParser.h"
+#include "Arm/Gic/ArmGicDispatcher.h"
+#include "Arm/Gic/ArmGicRParser.h"
/** Parse a Gic compatible interrupt-controller node,
extracting GicR information.
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicRParser.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicRParser.h
index c2b7eab..c2b7eab 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicRParser.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicRParser.h
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/CmObjectDescUtility.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/CmObjectDescUtility.c
index 8be1b5b..120a98c 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/CmObjectDescUtility.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/CmObjectDescUtility.c
@@ -219,11 +219,11 @@ AddMultipleCmObj (
/** Add multiple CmObj to the Configuration Manager.
- Get one token referencing a EArmObjCmRef CmObj itself referencing
+ Get one token referencing a EArchCommonObjCmRef CmObj itself referencing
the input CmObj. In the table below, RefToken is returned.
Token referencing an Array of tokens Array of CmObj
- array of EArmObjCmRef referencing each from the input:
+ array of EArchCommonObjCmRef referencing each from the input:
CmObj: CmObj from the input:
RefToken ---> CmObjToken[0] ---> CmObj[0]
@@ -234,7 +234,7 @@ AddMultipleCmObj (
@param [in] CmObjDesc CmObjDesc containing multiple CmObj
to add.
@param [out] Token If success, token referencing an array
- of EArmObjCmRef CmObj, themselves
+ of EArchCommonObjCmRef CmObj, themselves
referencing the input CmObjs.
@retval EFI_SUCCESS The function completed successfully.
@@ -286,12 +286,12 @@ AddMultipleCmObjWithCmObjRef (
goto exit_handler;
}
- CmObjRef.ObjectId = CREATE_CM_ARM_OBJECT_ID (EArmObjCmRef);
+ CmObjRef.ObjectId = CREATE_CM_ARCH_COMMON_OBJECT_ID (EArchCommonObjCmRef);
CmObjRef.Data = TokenTable;
CmObjRef.Count = CmObjDesc->Count;
CmObjRef.Size = TokenTableSize;
- // Add the array of EArmObjCmRef CmObjs.
+ // Add the array of EArchCommonObjCmRef CmObjs.
Status = FdtParserHandle->HwInfoAdd (
FdtParserHandle,
FdtParserHandle->Context,
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/CmObjectDescUtility.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/CmObjectDescUtility.h
index 270e0c3..14e1353 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/CmObjectDescUtility.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/CmObjectDescUtility.h
@@ -98,11 +98,11 @@ AddMultipleCmObj (
/** Add multiple CmObj to the Configuration Manager.
- Get one token referencing a EArmObjCmRef CmObj itself referencing
+ Get one token referencing a EArchCommonObjCmRef CmObj itself referencing
the input CmObj. In the table below, RefToken is returned.
Token referencing an Array of tokens Array of CmObj
- array of EArmObjCmRef referencing each from the input:
+ array of EArchCommonObjCmRef referencing each from the input:
CmObj: CmObj from the input:
RefToken ---> CmObjToken[0] ---> CmObj[0]
@@ -113,7 +113,7 @@ AddMultipleCmObj (
@param [in] CmObjDesc CmObjDesc containing multiple CmObj
to add.
@param [out] Token If success, token referencing an array
- of EArmObjCmRef CmObj, themselves
+ of EArchCommonObjCmRef CmObj, themselves
referencing the input CmObjs.
@retval EFI_SUCCESS The function completed successfully.
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.c
index 376de07..8e980da 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.c
@@ -6,82 +6,6 @@
**/
#include "FdtHwInfoParser.h"
-#include "BootArch/ArmBootArchParser.h"
-#include "GenericTimer/ArmGenericTimerParser.h"
-#include "Gic/ArmGicDispatcher.h"
-#include "Pci/ArmPciConfigSpaceParser.h"
-#include "Serial/ArmSerialPortParser.h"
-
-/** Ordered table of parsers/dispatchers.
-
- A parser parses a Device Tree to populate a specific CmObj type. None,
- one or many CmObj can be created by the parser.
- The created CmObj are then handed to the parser's caller through the
- HW_INFO_ADD_OBJECT interface.
- This can also be a dispatcher. I.e. a function that not parsing a
- Device Tree but calling other parsers.
-*/
-STATIC CONST FDT_HW_INFO_PARSER_FUNC HwInfoParserTable[] = {
- ArmBootArchInfoParser,
- ArmGenericTimerInfoParser,
- ArmGicDispatcher,
- ArmPciConfigInfoParser,
- SerialPortDispatcher
-};
-
-/** Main dispatcher: sequentially call the parsers/dispatchers
- of the HwInfoParserTable.
-
- A parser parses a Device Tree to populate a specific CmObj type. None,
- one or many CmObj can be created by the parser.
- The created CmObj are then handed to the parser's caller through the
- HW_INFO_ADD_OBJECT interface.
- This can also be a dispatcher. I.e. a function that not parsing a
- Device Tree but calling other parsers.
-
- @param [in] FdtParserHandle A handle to the parser instance.
- @param [in] FdtBranch When searching for DT node name, restrict
- the search to this Device Tree branch.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_ABORTED An error occurred.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
- @retval EFI_NOT_FOUND Not found.
- @retval EFI_UNSUPPORTED Unsupported.
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-MainDispatcher (
- IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle,
- IN INT32 FdtBranch
- )
-{
- EFI_STATUS Status;
- UINT32 Index;
-
- if (fdt_check_header (FdtParserHandle->Fdt) < 0) {
- ASSERT (0);
- return EFI_INVALID_PARAMETER;
- }
-
- for (Index = 0; Index < ARRAY_SIZE (HwInfoParserTable); Index++) {
- Status = HwInfoParserTable[Index](
- FdtParserHandle,
- FdtBranch
- );
- if (EFI_ERROR (Status) &&
- (Status != EFI_NOT_FOUND))
- {
- // If EFI_NOT_FOUND, the parser didn't find information in the DT.
- // Don't trigger an error.
- ASSERT (0);
- return Status;
- }
- } // for
-
- return EFI_SUCCESS;
-}
/** Initialise the HwInfoParser.
@@ -159,7 +83,7 @@ HwInfoParse (
}
// Call all the parsers from the root node (-1).
- Status = MainDispatcher (
+ Status = ArchFdtHwInfoMainDispatcher (
(FDT_HW_INFO_PARSER_HANDLE)ParserHandle,
-1
);
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.h
index 8a8cf38..90850b3 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.h
@@ -60,4 +60,31 @@ EFI_STATUS
IN INT32 FdtBranch
);
+/** Main dispatcher: sequentially call the parsers/dispatchers
+ of the HwInfoParserTable.
+
+ A parser parses a Device Tree to populate a specific CmObj type. None,
+ one or many CmObj can be created by the parser.
+ The created CmObj are then handed to the parser's caller through the
+ HW_INFO_ADD_OBJECT interface.
+ This can also be a dispatcher. I.e. a function that not parsing a
+ Device Tree but calling other parsers.
+
+ @param [in] FdtParserHandle A handle to the parser instance.
+ @param [in] FdtBranch When searching for DT node name, restrict
+ the search to this Device Tree branch.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_ABORTED An error occurred.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_NOT_FOUND Not found.
+ @retval EFI_UNSUPPORTED Unsupported.
+**/
+EFI_STATUS
+EFIAPI
+ArchFdtHwInfoMainDispatcher (
+ IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle,
+ IN INT32 FdtBranch
+ );
+
#endif // FDT_HW_INFO_PARSER_H_
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserInclude.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserInclude.h
index 583f290..60f671e 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserInclude.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserInclude.h
@@ -10,7 +10,6 @@
#include <Base.h>
#include <libfdt.h>
-#include <Library/ArmLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf
index d2c171a..c8511ab 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf
@@ -22,29 +22,35 @@
FdtHwInfoParser.h
FdtUtility.c
FdtUtility.h
- BootArch/ArmBootArchParser.c
- BootArch/ArmBootArchParser.h
- GenericTimer/ArmGenericTimerParser.c
- GenericTimer/ArmGenericTimerParser.h
- Gic/ArmGicCParser.c
- Gic/ArmGicCParser.h
- Gic/ArmGicDispatcher.c
- Gic/ArmGicDispatcher.h
- Gic/ArmGicDParser.c
- Gic/ArmGicDParser.h
- Gic/ArmGicItsParser.c
- Gic/ArmGicItsParser.h
- Gic/ArmGicMsiFrameParser.c
- Gic/ArmGicMsiFrameParser.h
- Gic/ArmGicRParser.c
- Gic/ArmGicRParser.h
- Pci/ArmPciConfigSpaceParser.c
- Pci/ArmPciConfigSpaceParser.h
- Serial/ArmSerialPortParser.c
- Serial/ArmSerialPortParser.h
+ Pci/PciConfigSpaceParser.c
+ Pci/PciConfigSpaceParser.h
+ Serial/SerialPortParser.c
+ Serial/SerialPortParser.h
-[Packages]
+[Sources.ARM, Sources.AARCH64]
+ Arm/ArmFdtInterrupt.c
+ Arm/ArmFdtHwInfoParser.c
+ Arm/BootArch/ArmBootArchParser.c
+ Arm/BootArch/ArmBootArchParser.h
+ Arm/GenericTimer/ArmGenericTimerParser.c
+ Arm/GenericTimer/ArmGenericTimerParser.h
+ Arm/Gic/ArmGicCParser.c
+ Arm/Gic/ArmGicCParser.h
+ Arm/Gic/ArmGicDispatcher.c
+ Arm/Gic/ArmGicDispatcher.h
+ Arm/Gic/ArmGicDParser.c
+ Arm/Gic/ArmGicDParser.h
+ Arm/Gic/ArmGicItsParser.c
+ Arm/Gic/ArmGicItsParser.h
+ Arm/Gic/ArmGicMsiFrameParser.c
+ Arm/Gic/ArmGicMsiFrameParser.h
+ Arm/Gic/ArmGicRParser.c
+ Arm/Gic/ArmGicRParser.h
+
+[Packages.ARM, Packages.AARCH64]
ArmPkg/ArmPkg.dec
+
+[Packages]
DynamicTablesPkg/DynamicTablesPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdeModulePkg/MdeModulePkg.dec
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c
index 5314cf3..bab2285 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c
@@ -13,77 +13,6 @@
#include <FdtHwInfoParserInclude.h>
#include "FdtUtility.h"
-/** Get the interrupt Id of an interrupt described in a fdt.
-
- Data must describe a GIC interrupt. A GIC interrupt is on at least
- 3 UINT32 cells.
- This function DOES NOT SUPPORT extended SPI range and extended PPI range.
-
- @param [in] Data Pointer to the first cell of an "interrupts" property.
-
- @retval The interrupt id.
-**/
-UINT32
-EFIAPI
-FdtGetInterruptId (
- UINT32 CONST *Data
- )
-{
- UINT32 IrqType;
- UINT32 IrqId;
-
- ASSERT (Data != NULL);
-
- IrqType = fdt32_to_cpu (Data[IRQ_TYPE_OFFSET]);
- IrqId = fdt32_to_cpu (Data[IRQ_NUMBER_OFFSET]);
-
- switch (IrqType) {
- case DT_SPI_IRQ:
- IrqId += SPI_OFFSET;
- break;
-
- case DT_PPI_IRQ:
- IrqId += PPI_OFFSET;
- break;
-
- default:
- ASSERT (0);
- IrqId = 0;
- }
-
- return IrqId;
-}
-
-/** Get the ACPI interrupt flags of an interrupt described in a fdt.
-
- Data must describe a GIC interrupt. A GIC interrupt is on at least
- 3 UINT32 cells.
-
- PPI interrupt cpu mask on bits [15:8] are ignored.
-
- @param [in] Data Pointer to the first cell of an "interrupts" property.
-
- @retval The interrupt flags (for ACPI).
-**/
-UINT32
-EFIAPI
-FdtGetInterruptFlags (
- UINT32 CONST *Data
- )
-{
- UINT32 IrqFlags;
- UINT32 AcpiIrqFlags;
-
- ASSERT (Data != NULL);
-
- IrqFlags = fdt32_to_cpu (Data[IRQ_FLAGS_OFFSET]);
-
- AcpiIrqFlags = DT_IRQ_IS_EDGE_TRIGGERED (IrqFlags) ? BIT0 : 0;
- AcpiIrqFlags |= DT_IRQ_IS_ACTIVE_LOW (IrqFlags) ? BIT1 : 0;
-
- return AcpiIrqFlags;
-}
-
/** Check whether a node has the input name.
@param [in] Fdt Pointer to a Flattened Device Tree.
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h
index 3f5d131..2d70487 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h
@@ -455,4 +455,34 @@ FdtGetParentAddressInfo (
OUT INT32 *SizeCells OPTIONAL
);
+/** For relevant architectures, get the "#address-cells" and/or "#size-cells"
+ property of the node.
+
+ According to the Device Tree specification, s2.3.5 "#address-cells and
+ #size-cells":
+ "If missing, a client program should assume a default value of 2 for
+ #address-cells, and a value of 1 for #size-cells."
+
+ @param [in] Fdt Pointer to a Flattened Device Tree.
+ @param [in] Node Offset of the node having to get the
+ "#address-cells" and "#size-cells"
+ properties from.
+ @param [out] AddressCells If success, number of address-cells.
+ If the property is not available,
+ default value is 2.
+ @param [out] SizeCells If success, number of size-cells.
+ If the property is not available,
+ default value is 1.
+
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+FdtGetIntcAddressCells (
+ IN CONST VOID *Fdt,
+ IN INT32 Node,
+ OUT INT32 *AddressCells, OPTIONAL
+ OUT INT32 *SizeCells OPTIONAL
+ );
+
#endif // FDT_UTILITY_H_
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/ArmPciConfigSpaceParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c
index 2ffff1c..7f536c0 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/ArmPciConfigSpaceParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c
@@ -1,5 +1,5 @@
/** @file
- Arm PCI Configuration Space Parser.
+ PCI Configuration Space Parser.
Copyright (c) 2021, ARM Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -16,8 +16,7 @@
#include <Library/DebugLib.h>
#include "FdtHwInfoParser.h"
-#include "Pci/ArmPciConfigSpaceParser.h"
-#include "Gic/ArmGicDispatcher.h"
+#include "Pci/PciConfigSpaceParser.h"
/** List of "compatible" property values for host PCIe bridges nodes.
@@ -188,8 +187,8 @@ ParseAddressMap (
UINT32 Count;
UINT32 PciAddressAttr;
- CM_ARM_PCI_ADDRESS_MAP_INFO *PciAddressMapInfo;
- UINT32 BufferSize;
+ CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO *PciAddressMapInfo;
+ UINT32 BufferSize;
// The mapping is done on AddressMapSize bytes.
AddressMapSize = (PCI_ADDRESS_CELLS + AddressCells + PCI_SIZE_CELLS) *
@@ -208,7 +207,7 @@ ParseAddressMap (
Count = DataSize / AddressMapSize;
// Allocate a buffer to store each address mapping.
- BufferSize = Count * sizeof (CM_ARM_PCI_ADDRESS_MAP_INFO);
+ BufferSize = Count * sizeof (CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO);
PciAddressMapInfo = AllocateZeroPool (BufferSize);
if (PciAddressMapInfo == NULL) {
ASSERT (0);
@@ -246,9 +245,9 @@ ParseAddressMap (
} // for
PciInfo->Mapping[PciMappingTableAddress].ObjectId =
- CREATE_CM_ARM_OBJECT_ID (EArmObjPciAddressMapInfo);
+ CREATE_CM_ARCH_COMMON_OBJECT_ID (EArchCommonObjPciAddressMapInfo);
PciInfo->Mapping[PciMappingTableAddress].Size =
- sizeof (CM_ARM_PCI_ADDRESS_MAP_INFO) * Count;
+ sizeof (CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO) * Count;
PciInfo->Mapping[PciMappingTableAddress].Data = PciAddressMapInfo;
PciInfo->Mapping[PciMappingTableAddress].Count = Count;
@@ -306,13 +305,12 @@ ParseIrqMap (
CONST UINT8 *IrqMapMask;
INT32 IrqMapMaskSize;
- INT32 PHandleOffset;
- UINT32 GicVersion;
+ INT32 PHandleOffset;
UINT32 PciAddressAttr;
- CM_ARM_PCI_INTERRUPT_MAP_INFO *PciInterruptMapInfo;
- UINT32 BufferSize;
+ CM_ARCH_COMMON_PCI_INTERRUPT_MAP_INFO *PciInterruptMapInfo;
+ UINT32 BufferSize;
Data = fdt_getprop (Fdt, HostPciNode, "interrupt-map", &DataSize);
if ((Data == NULL) || (DataSize <= 0)) {
@@ -366,15 +364,8 @@ ParseIrqMap (
return EFI_ABORTED;
}
- // Only support Gic(s) for now.
- Status = GetGicVersion (Fdt, IntcNode, &GicVersion);
- if (EFI_ERROR (Status)) {
- ASSERT (0);
- return Status;
- }
-
// Get the "address-cells" property of the IntcNode.
- Status = FdtGetAddressInfo (Fdt, IntcNode, &IntcAddressCells, NULL);
+ Status = FdtGetIntcAddressCells (Fdt, IntcNode, &IntcAddressCells, NULL);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
@@ -413,7 +404,7 @@ ParseIrqMap (
// Allocate a buffer to store each interrupt mapping.
IrqMapCount = DataSize / IrqMapSize;
- BufferSize = IrqMapCount * sizeof (CM_ARM_PCI_ADDRESS_MAP_INFO);
+ BufferSize = IrqMapCount * sizeof (CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO);
PciInterruptMapInfo = AllocateZeroPool (BufferSize);
if (PciInterruptMapInfo == NULL) {
ASSERT (0);
@@ -455,9 +446,9 @@ ParseIrqMap (
} // for
PciInfo->Mapping[PciMappingTableInterrupt].ObjectId =
- CREATE_CM_ARM_OBJECT_ID (EArmObjPciInterruptMapInfo);
+ CREATE_CM_ARCH_COMMON_OBJECT_ID (EArchCommonObjPciInterruptMapInfo);
PciInfo->Mapping[PciMappingTableInterrupt].Size =
- sizeof (CM_ARM_PCI_INTERRUPT_MAP_INFO) * IrqMapCount;
+ sizeof (CM_ARCH_COMMON_PCI_INTERRUPT_MAP_INFO) * IrqMapCount;
PciInfo->Mapping[PciMappingTableInterrupt].Data = PciInterruptMapInfo;
PciInfo->Mapping[PciMappingTableInterrupt].Count = IrqMapCount;
@@ -468,7 +459,7 @@ ParseIrqMap (
@param [in] Fdt Pointer to a Flattened Device Tree (Fdt).
@param [in] HostPciNode Offset of a host-pci node.
- @param [in, out] PciInfo The CM_ARM_PCI_CONFIG_SPACE_INFO to populate.
+ @param [in, out] PciInfo The CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO to populate.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_ABORTED An error occurred.
@@ -579,9 +570,9 @@ PciNodeParser (
/** Add the parsed Pci information to the Configuration Manager.
CmObj of the following types are concerned:
- - EArmObjPciConfigSpaceInfo
- - EArmObjPciAddressMapInfo
- - EArmObjPciInterruptMapInfo
+ - EArchCommonObjPciConfigSpaceInfo
+ - EArchCommonObjPciAddressMapInfo
+ - EArchCommonObjPciInterruptMapInfo
@param [in] FdtParserHandle A handle to the parser instance.
@param [in] PciTableInfo PCI_PARSER_TABLE structure containing the
@@ -599,8 +590,8 @@ PciInfoAdd (
IN PCI_PARSER_TABLE *PciTableInfo
)
{
- EFI_STATUS Status;
- CM_ARM_PCI_CONFIG_SPACE_INFO *PciConfigSpaceInfo;
+ EFI_STATUS Status;
+ CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciConfigSpaceInfo;
if ((FdtParserHandle == NULL) ||
(PciTableInfo == NULL))
@@ -640,9 +631,11 @@ PciInfoAdd (
// Add the configuration space CmObj to the Configuration Manager.
Status = AddSingleCmObj (
FdtParserHandle,
- CREATE_CM_ARM_OBJECT_ID (EArmObjPciConfigSpaceInfo),
+ CREATE_CM_ARCH_COMMON_OBJECT_ID (
+ EArchCommonObjPciConfigSpaceInfo
+ ),
&PciTableInfo->PciConfigSpaceInfo,
- sizeof (CM_ARM_PCI_CONFIG_SPACE_INFO),
+ sizeof (CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO),
NULL
);
ASSERT_EFI_ERROR (Status);
@@ -682,29 +675,29 @@ FreeParserTable (
return EFI_SUCCESS;
}
-/** CM_ARM_PCI_CONFIG_SPACE_INFO parser function.
+/** CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO parser function.
The following structure is populated:
- typedef struct CmArmPciConfigSpaceInfo {
+ typedef struct CmArchCommonPciConfigSpaceInfo {
UINT64 BaseAddress; // {Populated}
UINT16 PciSegmentGroupNumber; // {Populated}
UINT8 StartBusNumber; // {Populated}
UINT8 EndBusNumber; // {Populated}
- } CM_ARM_PCI_CONFIG_SPACE_INFO;
+ } CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO;
- typedef struct CmArmPciAddressMapInfo {
+ typedef struct CmArchCommonPciAddressMapInfo {
UINT8 SpaceCode; // {Populated}
UINT64 PciAddress; // {Populated}
UINT64 CpuAddress; // {Populated}
UINT64 AddressSize; // {Populated}
- } CM_ARM_PCI_ADDRESS_MAP_INFO;
+ } CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO;
- typedef struct CmArmPciInterruptMapInfo {
- UINT8 PciBus; // {Populated}
- UINT8 PciDevice; // {Populated}
- UINT8 PciInterrupt; // {Populated}
- CM_ARM_GENERIC_INTERRUPT IntcInterrupt; // {Populated}
- } CM_ARM_PCI_INTERRUPT_MAP_INFO;
+ typedef struct CmArchCommonPciInterruptMapInfo {
+ UINT8 PciBus; // {Populated}
+ UINT8 PciDevice; // {Populated}
+ UINT8 PciInterrupt; // {Populated}
+ CM_ARCH_COMMON_GENERIC_INTERRUPT IntcInterrupt; // {Populated}
+ } CM_ARCH_COMMON_PCI_INTERRUPT_MAP_INFO;
A parser parses a Device Tree to populate a specific CmObj type. None,
one or many CmObj can be created by the parser.
@@ -725,7 +718,7 @@ FreeParserTable (
**/
EFI_STATUS
EFIAPI
-ArmPciConfigInfoParser (
+PciConfigInfoParser (
IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle,
IN INT32 FdtBranch
)
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/ArmPciConfigSpaceParser.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.h
index 6e0027a..aeffe7a 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/ArmPciConfigSpaceParser.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.h
@@ -1,5 +1,5 @@
/** @file
- Arm PCI Configuration Space Parser.
+ PCI Configuration Space Parser.
Copyright (c) 2021, ARM Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -12,8 +12,8 @@
- linux kernel code
**/
-#ifndef ARM_PCI_CONFIG_SPACE_PARSER_H_
-#define ARM_PCI_CONFIG_SPACE_PARSER_H_
+#ifndef PCI_CONFIG_SPACE_PARSER_H_
+#define PCI_CONFIG_SPACE_PARSER_H_
/** Read LEN bits at OFF offsets bits of the ADDR.
@@ -83,38 +83,38 @@ typedef enum PciMappingTable {
*/
typedef struct PciParserTable {
/// PCI Configuration Space Info
- CM_ARM_PCI_CONFIG_SPACE_INFO PciConfigSpaceInfo;
+ CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO PciConfigSpaceInfo;
/// Store the address mapping and interrupt mapping as CmObjDesc
/// before adding them to the Configuration Manager.
- CM_OBJ_DESCRIPTOR Mapping[PciMappingTableMax];
+ CM_OBJ_DESCRIPTOR Mapping[PciMappingTableMax];
} PCI_PARSER_TABLE;
#pragma pack()
-/** CM_ARM_PCI_CONFIG_SPACE_INFO parser function.
+/** CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO parser function.
The following structure is populated:
- typedef struct CmArmPciConfigSpaceInfo {
+ typedef struct CmArchCommonPciConfigSpaceInfo {
UINT64 BaseAddress; // {Populated}
UINT16 PciSegmentGroupNumber; // {Populated}
UINT8 StartBusNumber; // {Populated}
UINT8 EndBusNumber; // {Populated}
- } CM_ARM_PCI_CONFIG_SPACE_INFO;
+ } CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO;
- typedef struct CmArmPciAddressMapInfo {
+ typedef struct CmArchCommonPciAddressMapInfo {
UINT8 SpaceCode; // {Populated}
UINT64 PciAddress; // {Populated}
UINT64 CpuAddress; // {Populated}
UINT64 AddressSize; // {Populated}
- } CM_ARM_PCI_ADDRESS_MAP_INFO;
+ } CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO;
- typedef struct CmArmPciInterruptMapInfo {
- UINT8 PciBus; // {Populated}
- UINT8 PciDevice; // {Populated}
- UINT8 PciInterrupt; // {Populated}
- CM_ARM_GENERIC_INTERRUPT IntcInterrupt; // {Populated}
- } CM_ARM_PCI_INTERRUPT_MAP_INFO;
+ typedef struct CmArchCommonPciInterruptMapInfo {
+ UINT8 PciBus; // {Populated}
+ UINT8 PciDevice; // {Populated}
+ UINT8 PciInterrupt; // {Populated}
+ CM_ARCH_COMMON_GENERIC_INTERRUPT IntcInterrupt; // {Populated}
+ } CM_ARCH_COMMON_PCI_INTERRUPT_MAP_INFO;
A parser parses a Device Tree to populate a specific CmObj type. None,
one or many CmObj can be created by the parser.
@@ -135,9 +135,9 @@ typedef struct PciParserTable {
**/
EFI_STATUS
EFIAPI
-ArmPciConfigInfoParser (
+PciConfigInfoParser (
IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle,
IN INT32 FdtBranch
);
-#endif // ARM_PCI_CONFIG_SPACE_PARSER_H_
+#endif // PCI_CONFIG_SPACE_PARSER_H_
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/ArmSerialPortParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c
index 732b482..2d0dcce 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/ArmSerialPortParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c
@@ -1,5 +1,5 @@
/** @file
- Arm Serial Port Parser.
+ Serial Port Parser.
Copyright (c) 2021 - 2023, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -15,7 +15,7 @@
#include "CmObjectDescUtility.h"
#include "FdtHwInfoParser.h"
-#include "Serial/ArmSerialPortParser.h"
+#include "Serial/SerialPortParser.h"
/** List of "compatible" property values for serial port nodes.
@@ -71,7 +71,7 @@ CONST COMPATIBILITY_INFO SerialSbsaCompatibleInfo = {
@param [in] Fdt Pointer to a Flattened Device Tree (Fdt).
@param [in] SerialPortNode Offset of a serial-port node.
- @param [in] SerialPortInfo The CM_ARM_SERIAL_PORT_INFO to populate.
+ @param [in] SerialPortInfo The CM_ARCH_COMMON_SERIAL_PORT_INFO to populate.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_ABORTED An error occurred.
@@ -82,9 +82,9 @@ STATIC
EFI_STATUS
EFIAPI
SerialPortNodeParser (
- IN CONST VOID *Fdt,
- IN INT32 SerialPortNode,
- IN CM_ARM_SERIAL_PORT_INFO *SerialPortInfo
+ IN CONST VOID *Fdt,
+ IN INT32 SerialPortNode,
+ IN CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo
)
{
EFI_STATUS Status;
@@ -313,7 +313,7 @@ GetSerialConsoleNode (
return EFI_SUCCESS;
}
-/** CM_ARM_SERIAL_PORT_INFO dispatcher function (for a generic serial-port).
+/** CM_ARCH_COMMON_SERIAL_PORT_INFO dispatcher function (for a generic serial-port).
@param [in] FdtParserHandle A handle to the parser instance.
@param [in] GenericSerialInfo Pointer to a serial port info list.
@@ -329,11 +329,11 @@ GetSerialConsoleNode (
STATIC
EFI_STATUS
EFIAPI
-ArmSerialPortInfoDispatch (
+SerialPortInfoDispatch (
IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle,
- IN CM_ARM_SERIAL_PORT_INFO *GenericSerialInfo,
+ IN CM_ARCH_COMMON_SERIAL_PORT_INFO *GenericSerialInfo,
IN INT32 NodeCount,
- IN EARM_OBJECT_ID SerialObjectId
+ IN EARCH_COMMON_OBJECT_ID SerialObjectId
)
{
EFI_STATUS Status;
@@ -344,9 +344,9 @@ ArmSerialPortInfoDispatch (
return EFI_INVALID_PARAMETER;
}
- if ((SerialObjectId != EArmObjSerialPortInfo) &&
- (SerialObjectId != EArmObjSerialDebugPortInfo) &&
- (SerialObjectId != EArmObjSerialConsolePortInfo))
+ if ((SerialObjectId != EArchCommonObjSerialPortInfo) &&
+ (SerialObjectId != EArchCommonObjSerialDebugPortInfo) &&
+ (SerialObjectId != EArchCommonObjConsolePortInfo))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -354,10 +354,10 @@ ArmSerialPortInfoDispatch (
// Dispatch the Generic Serial ports
Status = CreateCmObjDesc (
- CREATE_CM_ARM_OBJECT_ID (SerialObjectId),
+ CREATE_CM_ARCH_COMMON_OBJECT_ID (SerialObjectId),
NodeCount,
GenericSerialInfo,
- sizeof (CM_ARM_SERIAL_PORT_INFO) * NodeCount,
+ sizeof (CM_ARCH_COMMON_SERIAL_PORT_INFO) * NodeCount,
&NewCmObjDesc
);
if (EFI_ERROR (Status)) {
@@ -372,19 +372,19 @@ ArmSerialPortInfoDispatch (
return Status;
}
-/** CM_ARM_SERIAL_PORT_INFO parser function (for debug/console serial-port).
+/** CM_ARCH_COMMON_SERIAL_PORT_INFO parser function (for debug/console serial-port).
This parser expects FdtBranch to be the debug serial-port node.
At most one CmObj is created.
The following structure is populated:
- typedef struct CmArmSerialPortInfo {
+ typedef struct EArchCommonSerialPortInfo {
UINT64 BaseAddress; // {Populated}
UINT32 Interrupt; // {Populated}
UINT64 BaudRate; // {default}
UINT32 Clock; // {Populated}
UINT16 PortSubtype; // {Populated}
UINT64 BaseAddressLength // {Populated}
- } CM_ARM_SERIAL_PORT_INFO;
+ } CM_ARCH_COMMON_SERIAL_PORT_INFO;
A parser parses a Device Tree to populate a specific CmObj type. None,
one or many CmObj can be created by the parser.
@@ -396,7 +396,8 @@ ArmSerialPortInfoDispatch (
@param [in] FdtParserHandle A handle to the parser instance.
@param [in] FdtBranch When searching for DT node name, restrict
the search to this Device Tree branch.
- @param [in] SerialObjectId ArmNamespace Object ID for the serial port.
+ @param [in] SerialObjectId ArchCommon Namespace Object ID for the serial
+ port.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_ABORTED An error occurred.
@@ -407,17 +408,17 @@ ArmSerialPortInfoDispatch (
STATIC
EFI_STATUS
EFIAPI
-ArmSerialPortInfoParser (
+SerialPortInfoParser (
IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle,
IN INT32 FdtBranch,
- IN EARM_OBJECT_ID SerialObjectId
+ IN EARCH_COMMON_OBJECT_ID SerialObjectId
)
{
- EFI_STATUS Status;
- CM_ARM_SERIAL_PORT_INFO SerialInfo;
+ EFI_STATUS Status;
+ CM_ARCH_COMMON_SERIAL_PORT_INFO SerialInfo;
- if ((SerialObjectId != EArmObjSerialDebugPortInfo) &&
- (SerialObjectId != EArmObjSerialConsolePortInfo))
+ if ((SerialObjectId != EArchCommonObjSerialDebugPortInfo) &&
+ (SerialObjectId != EArchCommonObjConsolePortInfo))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -435,7 +436,7 @@ ArmSerialPortInfoParser (
return Status;
}
- Status = ArmSerialPortInfoDispatch (
+ Status = SerialPortInfoDispatch (
FdtParserHandle,
&SerialInfo,
1,
@@ -447,11 +448,11 @@ ArmSerialPortInfoParser (
/** SerialPort dispatcher.
- This disptacher populates the CM_ARM_SERIAL_PORT_INFO structure for
+ This disptacher populates the CM_ARCH_COMMON_SERIAL_PORT_INFO structure for
the following CM_OBJ_ID:
- - EArmObjSerialConsolePortInfo
- - EArmObjSerialDebugPortInfo
- - EArmObjSerialPortInfo
+ - EArchCommonObjConsolePortInfo
+ - EArchCommonObjSerialDebugPortInfo
+ - EArchCommonObjSerialPortInfo
A parser parses a Device Tree to populate a specific CmObj type. None,
one or many CmObj can be created by the parser.
@@ -477,16 +478,16 @@ SerialPortDispatcher (
IN INT32 FdtBranch
)
{
- EFI_STATUS Status;
- INT32 SerialConsoleNode;
- INT32 SerialDebugNode;
- INT32 SerialNode;
- UINT32 Index;
- UINT32 SerialNodeCount;
- UINT32 SerialNodesRemaining;
- CM_ARM_SERIAL_PORT_INFO *GenericSerialInfo;
- UINT32 GenericSerialIndex;
- VOID *Fdt;
+ EFI_STATUS Status;
+ INT32 SerialConsoleNode;
+ INT32 SerialDebugNode;
+ INT32 SerialNode;
+ UINT32 Index;
+ UINT32 SerialNodeCount;
+ UINT32 SerialNodesRemaining;
+ CM_ARCH_COMMON_SERIAL_PORT_INFO *GenericSerialInfo;
+ UINT32 GenericSerialIndex;
+ VOID *Fdt;
if (FdtParserHandle == NULL) {
ASSERT (0);
@@ -528,10 +529,10 @@ SerialPortDispatcher (
return Status;
} else {
// Parse the console serial-port.
- Status = ArmSerialPortInfoParser (
+ Status = SerialPortInfoParser (
FdtParserHandle,
SerialConsoleNode,
- EArmObjSerialConsolePortInfo
+ EArchCommonObjConsolePortInfo
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -550,7 +551,7 @@ SerialPortDispatcher (
SerialNodesRemaining--;
GenericSerialInfo = AllocateZeroPool (
SerialNodesRemaining *
- sizeof (CM_ARM_SERIAL_PORT_INFO)
+ sizeof (CM_ARCH_COMMON_SERIAL_PORT_INFO)
);
if (GenericSerialInfo == NULL) {
ASSERT (0);
@@ -586,10 +587,10 @@ SerialPortDispatcher (
// The first serial-port node, not being the console serial-port,
// will be the debug serial-port.
SerialDebugNode = SerialNode;
- Status = ArmSerialPortInfoParser (
+ Status = SerialPortInfoParser (
FdtParserHandle,
SerialDebugNode,
- EArmObjSerialDebugPortInfo
+ EArchCommonObjSerialDebugPortInfo
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -616,11 +617,11 @@ SerialPortDispatcher (
} // for
if (GenericSerialIndex > 0) {
- Status = ArmSerialPortInfoDispatch (
+ Status = SerialPortInfoDispatch (
FdtParserHandle,
GenericSerialInfo,
GenericSerialIndex,
- EArmObjSerialPortInfo
+ EArchCommonObjSerialPortInfo
);
}
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/ArmSerialPortParser.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.h
index de08e57..22c686d 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/ArmSerialPortParser.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.h
@@ -1,5 +1,5 @@
/** @file
- Arm Serial Port Parser.
+ Serial Port Parser.
Copyright (c) 2021, ARM Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -9,16 +9,16 @@
- linux/Documentation/devicetree/bindings/serial/8250.txt
**/
-#ifndef ARM_SERIAL_PORT_PARSER_H_
-#define ARM_SERIAL_PORT_PARSER_H_
+#ifndef SERIAL_PORT_PARSER_H_
+#define SERIAL_PORT_PARSER_H_
/** SerialPort dispatcher.
- This disptacher populates the CM_ARM_SERIAL_PORT_INFO structure for
+ This disptacher populates the CM_ARCH_COMMON_SERIAL_PORT_INFO structure for
the following CM_OBJ_ID:
- - EArmObjSerialConsolePortInfo
- - EArmObjSerialDebugPortInfo
- - EArmObjSerialPortInfo
+ - EArchCommonObjConsolePortInfo
+ - EArchCommonObjSerialDebugPortInfo
+ - EArchCommonObjSerialPortInfo
A parser parses a Device Tree to populate a specific CmObj type. None,
one or many CmObj can be created by the parser.
@@ -44,4 +44,4 @@ SerialPortDispatcher (
IN INT32 FdtBranch
);
-#endif // ARM_SERIAL_PORT_PARSER_H_
+#endif // SERIAL_PORT_PARSER_H_
diff --git a/DynamicTablesPkg/Readme.md b/DynamicTablesPkg/Readme.md
index c1cdc5e..84d7ca9 100644
--- a/DynamicTablesPkg/Readme.md
+++ b/DynamicTablesPkg/Readme.md
@@ -402,3 +402,117 @@ Refer to the following presentation from *UEFI Plugfest Seattle 2018*:
[Dynamic Tables Framework: A Step Towards Automatic Generation of Advanced Configuration and Power Interface (ACPI) & System Management BIOS (SMBIOS) Tables](http://www.uefi.org/sites/default/files/resources/Arm_Dynamic%20Tables%20Framework%20A%20Step%20Towards%20Automatic%20Generation%20of%20Advanced%20Configuration%20and%20Power%20Interface%20%28ACPI%29%20%26%20System%20Management%20BIOS%20%28SMBIOS%29%20Tables%20_0.pdf)
+## Configuration Manager Objects
+
+The CM_OBJECT_ID type is used to identify the Configuration Manager
+ objects.
+
+## Description of Configuration Manager Object ID
+
+| 31 - 28 | 27 - 8 | 7 - 0 |
+| :-------------: | :----: | :---------: |
+| `Name Space ID` | 0 | `Object ID` |
+------------------------------------------
+
+### Name Space ID: Bits [31:28]
+
+| ID | Description | Comments |
+| ---: | :-------------------------- | :--- |
+| 0000b | Standard | |
+| 0001b | Arch Common | |
+| 0010b | ARM | |
+| 0011b | X64 | |
+| 1111b | Custom/OEM | |
+| `*` | All other values are reserved. | |
+
+### Bits: [27:8] - Reserved, must be zero.
+
+### Bits: [7:0] - Object ID
+
+#### Object ID's in the Standard Namespace:
+
+| ID | Description | Comments |
+| ---: | :-------------------------- | :--- |
+| 0 | Configuration Manager Revision | |
+| 1 | ACPI Table List | |
+| 2 | SMBIOS Table List | |
+
+#### Object ID's in the ARM Namespace:
+
+| ID | Description | Comments |
+| ---: | :-------------------------- | :--- |
+| 0 | Reserved | |
+| 1 | Boot Architecture Info | |
+| 2 | GICC Info | |
+| 3 | GICD Info | |
+| 4 | GIC MSI Frame Info | |
+| 5 | GIC Redistributor Info | |
+| 6 | GIC ITS Info | |
+| 7 | Generic Timer Info | |
+| 8 | Platform GT Block Info | |
+| 9 | Generic Timer Block Frame Info | |
+| 10 | Platform Generic Watchdog | |
+| 11 | ITS Group | |
+| 12 | Named Component | |
+| 13 | Root Complex | |
+| 14 | SMMUv1 or SMMUv2 | |
+| 15 | SMMUv3 | |
+| 16 | PMCG | |
+| 17 | GIC ITS Identifier Array | |
+| 18 | ID Mapping Array | |
+| 19 | SMMU Interrupt Array | |
+| 20 | CMN 600 Info | |
+| 21 | Reserved Memory Range Node | |
+| 22 | Memory Range Descriptor | |
+| 23 | Embedded Trace Extension/Module Info | |
+| `*` | All other values are reserved. | |
+
+#### Object ID's in the Arch Common Namespace:
+
+| ID | Description | Comments |
+| ---: | :-------------------------- | :--- |
+| 0 | Reserved | |
+| 1 | Power Management Profile Info | |
+| 2 | Serial Port Info | |
+| 3 | Serial Console Port Info | |
+| 4 | Serial Debug Port Info | |
+| 5 | Hypervisor Vendor Id | |
+| 6 | Fixed feature flags for FADT | |
+| 7 | CM Object Reference | |
+| 8 | PCI Configuration Space Info | |
+| 9 | PCI Address Map Info | |
+| 10 | PCI Interrupt Map Info | |
+| 11 | Memory Affinity Info | |
+| 12 | Device Handle Acpi | |
+| 13 | Device Handle PCI | |
+| 14 | Generic Initiator Affinity Info | |
+| 15 | Low Power Idle State Info | |
+| 16 | Processor Hierarchy Info | |
+| 17 | Cache Info | |
+| 18 | Continuous Performance Control Info | |
+| 19 | Pcc Subspace Type 0 Info | |
+| 20 | Pcc Subspace Type 1 Info | |
+| 21 | Pcc Subspace Type 2 Info | |
+| 22 | Pcc Subspace Type 3 Info | |
+| 23 | Pcc Subspace Type 4 Info | |
+| 24 | Pcc Subspace Type 5 Info | |
+| 25 | P-State Dependency (PSD) Info | |
+| 26 | TPM Interface Info | |
+| `*` | All other values are reserved. | |
+
+#### Object ID's in the X64 Namespace:
+
+| ID | Description | Comments |
+| ---: | :-------------------------- | :--- |
+| 0 | Reserved | |
+| 1 | SCI Interrupt Info | |
+| 2 | SCI Command Info | |
+| 3 | Legacy Power Management Block Info | |
+| 4 | Legacy GPE Block Info | |
+| 5 | Power Management Block Info | |
+| 6 | GPE Block Info | |
+| 7 | Sleep Block Info | |
+| 8 | Reset Block Info | |
+| 9 | Miscellaneous Block Info | |
+| 10 | Windows protection flag Info | |
+| `*` | All other values are reserved. | |