summaryrefslogtreecommitdiff
path: root/DynamicTablesPkg
diff options
context:
space:
mode:
authorPierre Gondois <pierre.gondois@arm.com>2024-06-10 15:00:00 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-07-29 16:44:55 +0300
commitc6e0eed07264fb5bd92198cf5c9b1c95715a1962 (patch)
tree3b83b31a7724ea7ec88d40b483fd8edf8e0cad09 /DynamicTablesPkg
parentacaf99827f4d6c386e2ce45239f058493660a282 (diff)
downloadedk2-c6e0eed07264fb5bd92198cf5c9b1c95715a1962.tar.xz
DynamicTablesPkg: AcpiSratLib: Prepare to support other archs
Allow other architectures to reuse the AcpiSratLib by extracting the Arm specific part of the table generation. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Diffstat (limited to 'DynamicTablesPkg')
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/AcpiSratLib.inf7
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/Arm/ArmSratGenerator.c262
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.c214
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.h59
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGeneratorNull.c79
5 files changed, 424 insertions, 197 deletions
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/AcpiSratLib.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/AcpiSratLib.inf
index 2f23f4e668..14e435e325 100644
--- a/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/AcpiSratLib.inf
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/AcpiSratLib.inf
@@ -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 0000000000..3d36b25e18
--- /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/Common/AcpiSratLib/SratGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.c
index 48c9970a71..dcdacc4e96 100644
--- a/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.c
@@ -25,38 +25,19 @@
#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)
- EArchCommonObjMemoryAffinityInfo (OPTIONAL)
- EArchCommonObjGenericInitiatorAffinityInfo (OPTIONAL)
- EArchCommonObjDeviceHandleAcpi (OPTIONAL)
- EArchCommonObjDeviceHandlePci (OPTIONAL)
*/
-/** This macro expands to a function that retrieves the GIC
- CPU interface Information from the Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGicCInfo,
- CM_ARM_GICC_INFO
- );
-
-/** This macro expands to a function that retrieves the GIC
- Interrupt Translation Service Information from the
- Configuration Manager.
-*/
-GET_OBJECT_LIST (
- EObjNameSpaceArm,
- EArmObjGicItsInfo,
- CM_ARM_GIC_ITS_INFO
- );
-
/**
This macro expands to a function that retrieves the Memory Affinity
information from the Configuration Manager.
@@ -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
@@ -455,18 +340,12 @@ 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_ARCH_COMMON_MEMORY_AFFINITY_INFO *MemAffInfo;
CM_ARCH_COMMON_GENERIC_INITIATOR_AFFINITY_INFO *GenInitiatorAffInfo;
@@ -497,46 +376,6 @@ 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 = GetEArchCommonObjMemoryAffinityInfo (
CfgMgrProtocol,
CM_NULL_TOKEN,
@@ -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,
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.h b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.h
new file mode 100644
index 0000000000..106d008494
--- /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 0000000000..4ebdf97fd6
--- /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;
+}