[edk2,edk2-platforms,03/11] Silicon/AMD/Styx/AcpiPlatformDxe: replace XGBE CPP conditional with PCD

Message ID 20181211183514.20948-4-ard.biesheuvel@linaro.org
State New
Headers show
Series
  • final set of Styx cleanups
Related show

Commit Message

Ard Biesheuvel Dec. 11, 2018, 6:35 p.m.
We already have a boolean PCD that tells us whether XGBE support should
be enabled, so use it instead of C preprocessor conditionals.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf |  1 +
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c      | 13 ++++---------
 2 files changed, 5 insertions(+), 9 deletions(-)

-- 
2.19.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Patch

diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
index be885d6aea90..d27431343f4b 100644
--- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -68,6 +68,7 @@ 
   gAmdStyxTokenSpaceGuid.PcdSocCpuId
 
 [FixedPcd]
+  gAmdModulePkgTokenSpaceGuid.PcdXgbeEnable
   gAmdStyxTokenSpaceGuid.PcdCntControlBase
   gAmdStyxTokenSpaceGuid.PcdCntReadBase
   gAmdStyxTokenSpaceGuid.PcdCntCTLBase
diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
index 9c17c38a04bf..9c8c8b09d4a4 100644
--- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
@@ -43,7 +43,6 @@ 
 STATIC EFI_ACPI_TABLE_PROTOCOL   *mAcpiTableProtocol;
 STATIC AMD_MP_CORE_INFO_PROTOCOL *mAmdMpCoreInfoProtocol;
 
-#if DO_XGBE
 
 STATIC CONST UINT8 mDefaultMacPackageA[] = {
   0x12, 0xe, 0x6, 0xa, 0x2, 0xa, 0xa1, 0xa, 0xa2, 0xa, 0xa3, 0xa, 0xa4, 0xa, 0xa5
@@ -91,8 +90,6 @@  PatchAmlPackage (
   }
 }
 
-#endif
-
 STATIC
 VOID
 EnableAvailableCores (
@@ -135,10 +132,7 @@  InstallSystemDescriptionTables (
   EFI_ACPI_6_0_IO_REMAPPING_TABLE                     *Iort;
   EFI_ACPI_5_1_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *Madt;
   EFI_ACPI_5_1_GIC_STRUCTURE                          *GicC;
-
-#if DO_XGBE
   UINT8                         MacPackage[sizeof(mDefaultMacPackageA)];
-#endif
 
   CpuId = PcdGet32 (PcdSocCpuId);
 
@@ -158,7 +152,10 @@  InstallSystemDescriptionTables (
       break;
 
     case SIGNATURE_64 ('S', 't', 'y', 'x', 'X', 'g', 'b', 'e'):
-#if DO_XGBE
+      if (!FixedPcdGetBool (PcdXgbeEnable)) {
+        continue;
+      }
+
       //
       // Patch the SSDT binary with the correct MAC addresses
       //
@@ -173,8 +170,6 @@  InstallSystemDescriptionTables (
         (UINT8 *)Table, TableSize);
 
       break;
-#endif
-      continue;
 
     default:
       switch (Table->Signature) {