The last change in moving away from single binary for all SGI/RD
platforms to independent binary for each platform is to let the platform
select only the ACPI table module that is required for the platform.

Each platform dsc file specifies the ACPI table module to use. All the
platform specific ACPI table modules are assigned a common file guid
which is looked up by the platform dxe driver, thereby, removing the
need to lookup for a ACPI table module file guid using the platform
id hob.

Signed-off-by: Aditya Angadi <aditya.ang...@arm.com>
---
 Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf   |  2 +-
 Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf   |  2 +-
 Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf |  2 +-
 Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf     |  2 +-
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c   | 69 
+-------------------
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf |  5 +-
 Platform/ARM/SgiPkg/RdE1Edge/RdE1Edge.dsc               |  8 +++
 Platform/ARM/SgiPkg/RdN1Edge/RdN1Edge.dsc               |  8 +++
 Platform/ARM/SgiPkg/RdN1EdgeX2/RdN1EdgeX2.dsc           |  8 +++
 Platform/ARM/SgiPkg/Sgi575/Sgi575.dsc                   | 10 +++
 Platform/ARM/SgiPkg/SgiPlatform.dec                     |  5 +-
 Platform/ARM/SgiPkg/SgiPlatform.dsc.inc                 |  4 --
 Platform/ARM/SgiPkg/SgiPlatform.fdf                     |  5 +-
 13 files changed, 42 insertions(+), 88 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf
index 3a4d4e7b9502..e780698cdf57 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf
@@ -10,7 +10,7 @@
 [Defines]
   INF_VERSION                    = 0x0001001A
   BASE_NAME                      = RdE1EdgeAcpiTables
-  FILE_GUID                      = 2af40815-a84e-4de9-8c38-9140b3544073
+  FILE_GUID                      = c712719a-0aaf-438c-9cdd-35ab4d60207d  # 
gArmSgiAcpiTablesGuid
   MODULE_TYPE                    = USER_DEFINED
   VERSION_STRING                 = 1.0
 
diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf
index 58c33ecb8ec2..871697eab19e 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf
@@ -10,7 +10,7 @@
 [Defines]
   INF_VERSION                    = 0x0001001A
   BASE_NAME                      = RdN1EdgeAcpiTables
-  FILE_GUID                      = 4b0b91d0-4a05-45c4-88a7-88e170e76694
+  FILE_GUID                      = c712719a-0aaf-438c-9cdd-35ab4d60207d  # 
gArmSgiAcpiTablesGuid
   MODULE_TYPE                    = USER_DEFINED
   VERSION_STRING                 = 1.0
 
diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf
index 1b584b152455..61f17b3ee8ac 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf
@@ -10,7 +10,7 @@
 [Defines]
   INF_VERSION                    = 0x0001001A
   BASE_NAME                      = RdN1EdgeX2AcpiTables
-  FILE_GUID                      = 82a34150-0fc6-45f4-8ea0-f0a4660cf35d
+  FILE_GUID                      = c712719a-0aaf-438c-9cdd-35ab4d60207d  # 
gArmSgiAcpiTablesGuid
   MODULE_TYPE                    = USER_DEFINED
   VERSION_STRING                 = 1.0
 
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
index 097ef854df42..466e0fb658eb 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
@@ -10,7 +10,7 @@
 [Defines]
   INF_VERSION                    = 0x0001001A
   BASE_NAME                      = Sgi575AcpiTables
-  FILE_GUID                      = c712719a-0aaf-438c-9cdd-35ab4d60207d  # 
gSgi575AcpiTablesFileGuid
+  FILE_GUID                      = c712719a-0aaf-438c-9cdd-35ab4d60207d  # 
gArmSgiAcpiTablesGuid
   MODULE_TYPE                    = USER_DEFINED
   VERSION_STRING                 = 1.0
 
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 387397d74598..2f72e7152ff3 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -11,43 +11,6 @@
 #include <Library/HobLib.h>
 #include <SgiPlatform.h>
 
-typedef struct {
-  SGI_PLATFORM_DESCRIPTOR SgiPlafromDescriptor;
-  CONST  EFI_GUID*        AcpiTableGuid;
-} SGI_PLATFORM_ACPI_TABLE_GUID_LOOKUP;
-
-// Macro to construct the SGI_PLATFORM_ACPI_TABLE_GUID_LOOKUP structure
-#define ACPI_GUID_LOOKUP(PART_NUM, CONFIG_NUM, MULTI_CHIP_MODE, GUID)          
\
-{                                                                              
\
-  {                                                                            
\
-    PART_NUM, CONFIG_NUM, MULTI_CHIP_MODE                                      
\
-  },                                                                           
\
-  GUID                                                                         
\
-}                                                                              
\
-
-STATIC SGI_PLATFORM_ACPI_TABLE_GUID_LOOKUP AcpiTableGuidLookup[] = {
-  ACPI_GUID_LOOKUP (
-      SGI575_PART_NUM,
-      SGI575_CONF_NUM,
-      MULTI_CHIP_MODE_DISABLED,
-      &gSgi575AcpiTablesFileGuid),
-  ACPI_GUID_LOOKUP (
-      RD_N1E1_EDGE_PART_NUM,
-      RD_N1_EDGE_CONF_ID,
-      MULTI_CHIP_MODE_DISABLED,
-      &gRdN1EdgeAcpiTablesFileGuid),
-  ACPI_GUID_LOOKUP (
-      RD_N1E1_EDGE_PART_NUM,
-      RD_N1_EDGE_CONF_ID,
-      MULTI_CHIP_MODE_ENABLED,
-      &gRdN1EdgeX2AcpiTablesFileGuid),
-  ACPI_GUID_LOOKUP (
-      RD_N1E1_EDGE_PART_NUM,
-      RD_E1_EDGE_CONF_ID,
-      MULTI_CHIP_MODE_DISABLED,
-      &gRdE1EdgeAcpiTablesFileGuid),
-};
-
 VOID
 InitVirtioDevices (
   VOID
@@ -61,38 +24,8 @@ ArmSgiPkgEntryPoint (
   )
 {
   EFI_STATUS              Status;
-  VOID                    *SystemIdHob;
-  SGI_PLATFORM_DESCRIPTOR *HobData;
-  UINTN                   Idx;
-  UINT32                  ConfigId;
-  UINT32                  PartNum;
-  UINT32                  MultiChipMode;
-
-  SystemIdHob = GetFirstGuidHob (&gArmSgiPlatformIdDescriptorGuid);
-  if (SystemIdHob == NULL) {
-    DEBUG ((DEBUG_ERROR, "System ID HOB is NULL\n"));
-    return EFI_INVALID_PARAMETER;
-  }
-
-  HobData = (SGI_PLATFORM_DESCRIPTOR *)GET_GUID_HOB_DATA (SystemIdHob);
-
-  PartNum = HobData->PlatformId;
-  ConfigId = HobData->ConfigId;
-  MultiChipMode = HobData->MultiChipMode;
-
-  Status = EFI_UNSUPPORTED;
-
-  // Walk through the AcpiTableGuidLookup lookup array
-  for (Idx = 0; Idx < ARRAY_SIZE (AcpiTableGuidLookup); Idx++) {
-    if ((PartNum == AcpiTableGuidLookup[Idx].SgiPlafromDescriptor.PlatformId) 
&&
-        (ConfigId == AcpiTableGuidLookup[Idx].SgiPlafromDescriptor.ConfigId)  
&&
-        (MultiChipMode ==
-         AcpiTableGuidLookup[Idx].SgiPlafromDescriptor.MultiChipMode)) {
-      Status = LocateAndInstallAcpiFromFv 
(AcpiTableGuidLookup[Idx].AcpiTableGuid);
-      break;
-    }
-  }
 
+  Status = LocateAndInstallAcpiFromFv (&gArmSgiAcpiTablesGuid);
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__));
     return Status;
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf 
b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index 741dcc75ed6a..9d89314a594e 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -30,10 +30,7 @@ [LibraryClasses]
 
 [Guids]
   gArmSgiPlatformIdDescriptorGuid
-  gSgi575AcpiTablesFileGuid
-  gRdN1EdgeAcpiTablesFileGuid
-  gRdN1EdgeX2AcpiTablesFileGuid
-  gRdE1EdgeAcpiTablesFileGuid
+  gArmSgiAcpiTablesGuid
 
 [FeaturePcd]
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported
diff --git a/Platform/ARM/SgiPkg/RdE1Edge/RdE1Edge.dsc 
b/Platform/ARM/SgiPkg/RdE1Edge/RdE1Edge.dsc
index fefd0e35125f..a108b4eab0d8 100644
--- a/Platform/ARM/SgiPkg/RdE1Edge/RdE1Edge.dsc
+++ b/Platform/ARM/SgiPkg/RdE1Edge/RdE1Edge.dsc
@@ -41,3 +41,11 @@ [PcdsFixedAtBuild.common]
   gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x300C0000
   gArmSgiTokenSpaceGuid.PcdGicSize|0x100000
 
+################################################################################
+#
+# Components Section - list of all EDK II Modules needed by this Platform
+#
+################################################################################
+
+[Components.common]
+  Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf
diff --git a/Platform/ARM/SgiPkg/RdN1Edge/RdN1Edge.dsc 
b/Platform/ARM/SgiPkg/RdN1Edge/RdN1Edge.dsc
index 71407f701af8..a59a6c5b8f3a 100644
--- a/Platform/ARM/SgiPkg/RdN1Edge/RdN1Edge.dsc
+++ b/Platform/ARM/SgiPkg/RdN1Edge/RdN1Edge.dsc
@@ -41,3 +41,11 @@ [PcdsFixedAtBuild.common]
   gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x300C0000
   gArmSgiTokenSpaceGuid.PcdGicSize|0x100000
 
+################################################################################
+#
+# Components Section - list of all EDK II Modules needed by this Platform
+#
+################################################################################
+
+[Components.common]
+  Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf
diff --git a/Platform/ARM/SgiPkg/RdN1EdgeX2/RdN1EdgeX2.dsc 
b/Platform/ARM/SgiPkg/RdN1EdgeX2/RdN1EdgeX2.dsc
index 5bc286626bb1..6c9e30eadb95 100644
--- a/Platform/ARM/SgiPkg/RdN1EdgeX2/RdN1EdgeX2.dsc
+++ b/Platform/ARM/SgiPkg/RdN1EdgeX2/RdN1EdgeX2.dsc
@@ -41,3 +41,11 @@ [PcdsFixedAtBuild.common]
   gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x300C0000
   gArmSgiTokenSpaceGuid.PcdGicSize|0x100000
 
+################################################################################
+#
+# Components Section - list of all EDK II Modules needed by this Platform
+#
+################################################################################
+
+[Components.common]
+  Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf
diff --git a/Platform/ARM/SgiPkg/Sgi575/Sgi575.dsc 
b/Platform/ARM/SgiPkg/Sgi575/Sgi575.dsc
index b5f39c4db3bc..bdfd69d0477c 100644
--- a/Platform/ARM/SgiPkg/Sgi575/Sgi575.dsc
+++ b/Platform/ARM/SgiPkg/Sgi575/Sgi575.dsc
@@ -41,3 +41,13 @@ [PcdsFixedAtBuild.common]
   gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x300C0000
   gArmSgiTokenSpaceGuid.PcdGicSize|0x100000
 
+
+################################################################################
+#
+# Components Section - list of all EDK II Modules needed by this Platform
+#
+################################################################################
+
+[Components.common]
+  Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
+
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec 
b/Platform/ARM/SgiPkg/SgiPlatform.dec
index 4ac3dec91e3d..97c1e40349ea 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -26,10 +26,7 @@ [Guids.common]
   # ARM Sgi Platform ID descriptor
   gArmSgiPlatformIdDescriptorGuid = { 0xf56f152a, 0xad2a, 0x11e6, { 0xb1, 
0xa7, 0x00, 0x50, 0x56, 0x3c, 0x44, 0xcc } }
   gArmSgiTokenSpaceGuid      = { 0x577d6941, 0xaea1, 0x40b4, { 0x90, 0x93, 
0x2a, 0x86, 0x61, 0x72, 0x5a, 0x57 } }
-  gSgi575AcpiTablesFileGuid  = { 0xc712719a, 0x0aaf, 0x438c, { 0x9c, 0xdd, 
0x35, 0xab, 0x4d, 0x60, 0x20, 0x7d } }
-  gRdN1EdgeAcpiTablesFileGuid = { 0x4b0b91d0, 0x4a05, 0x45c4, { 0x88, 0xa7, 
0x88, 0xe1, 0x70, 0xe7, 0x66, 0x94 } }
-  gRdN1EdgeX2AcpiTablesFileGuid = { 0x82a34150, 0x0fc6, 0x45f4, { 0x8e, 0xa0, 
0xf0, 0xa4, 0x66, 0x0c, 0xf3, 0x5d } }
-  gRdE1EdgeAcpiTablesFileGuid = { 0x2af40815, 0xa84e, 0x4de9, { 0x8c, 0x38, 
0x91, 0x40, 0xb3, 0x54, 0x40, 0x73 } }
+  gArmSgiAcpiTablesGuid = { 0xc712719a, 0x0aaf, 0x438c, { 0x9c, 0xdd, 0x35, 
0xab, 0x4d, 0x60, 0x20, 0x7d } }
 
 [PcdsFeatureFlag.common]
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|FALSE|BOOLEAN|0x00000001
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc 
b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
index ae5ef5a8d2ef..1f33557edf18 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc
@@ -252,10 +252,6 @@ [Components.common]
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
-  Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf
-  Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf
-  Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
   #
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf 
b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index 3d13998015b9..9fc011a6d630 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -99,11 +99,8 @@ [FV.FvMain]
   # ACPI Support
   #
   INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/Sgi575AcpiTables.inf
-  INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeAcpiTables.inf
-  INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf
-  INF RuleOverride=ACPITABLE 
Platform/ARM/SgiPkg/AcpiTables/RdE1EdgeAcpiTables.inf
   INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+!include $(BOARD_DXE_FV_COMPONENTS)
 
   # Required by PCI
   INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
-- 
2.17.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58614): https://edk2.groups.io/g/devel/message/58614
Mute This Topic: https://groups.io/mt/73997063/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to