diff mbox series

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

Message ID 20181211183514.20948-5-ard.biesheuvel@linaro.org
State New
Headers show
Series final set of Styx cleanups | expand

Commit Message

Ard Biesheuvel Dec. 11, 2018, 6:35 p.m. UTC
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/PlatInitPei/PlatInitPei.inf |  1 +
 Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c   | 41 ++++++++++----------
 2 files changed, 21 insertions(+), 21 deletions(-)

-- 
2.19.2

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

Patch

diff --git a/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.inf b/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.inf
index b8829a4a9c3e..99cf01347ab7 100644
--- a/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.inf
+++ b/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.inf
@@ -58,6 +58,7 @@ 
   gAmdStyxMpCoreInfoGuid               ## PRODUCER
 
 [Pcd]
+  gAmdModulePkgTokenSpaceGuid.PcdXgbeEnable
   gArmTokenSpaceGuid.PcdSystemMemorySize
   gArmPlatformTokenSpaceGuid.PcdCoreCount
   gAmdStyxTokenSpaceGuid.PcdSocCoreCount
diff --git a/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c b/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c
index 3cd650eee36b..932be55b600a 100644
--- a/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c
+++ b/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c
@@ -121,10 +121,8 @@  PlatInitPeiEntryPoint (
   AMD_MEMORY_RANGE_DESCRIPTOR IscpMemDescriptor = {0};
   ISCP_FUSE_INFO              IscpFuseInfo = {0};
   ISCP_CPU_RESET_INFO         CpuResetInfo = {0};
-#if DO_XGBE == 1
   ISCP_MAC_INFO               MacAddrInfo = {0};
   UINTN                       MacSize;
-#endif
   UINTN                       CpuCoreCount, CpuMap, CpuMapSize;
   UINTN                       Index, CoreNum;
   UINT32                      *CpuIdReg = (UINT32 *)FixedPcdGet32 (PcdCpuIdRegister);
@@ -217,27 +215,28 @@  PlatInitPeiEntryPoint (
 
   DEBUG ((EFI_D_ERROR, "SystemMemorySize = %ld\n", PcdGet64 (PcdSystemMemorySize)));
 
-#if DO_XGBE == 1
-  // Get MAC Address from ISCP
-  Status = PeiIscpPpi->ExecuteGetMacAddressTransaction (
-             PeiServices, &MacAddrInfo );
-  ASSERT_EFI_ERROR (Status);
 
-  MacSize = sizeof(MacAddrInfo.MacAddress0);
-  Status = PcdSetPtrS (PcdEthMacA, &MacSize, MacAddrInfo.MacAddress0);
-  ASSERT_EFI_ERROR (Status);
-  Status = PcdSetPtrS (PcdEthMacB, &MacSize, MacAddrInfo.MacAddress1);
-  ASSERT_EFI_ERROR (Status);
+  if (FixedPcdGetBool (PcdXgbeEnable)) {
+    // Get MAC Address from ISCP
+    Status = PeiIscpPpi->ExecuteGetMacAddressTransaction (
+               PeiServices, &MacAddrInfo );
+    ASSERT_EFI_ERROR (Status);
 
-  DEBUG ((EFI_D_ERROR, "EthMacA = %02x:%02x:%02x:%02x:%02x:%02x\n",
-    ((UINT8 *)PcdGetPtr (PcdEthMacA))[0], ((UINT8 *)PcdGetPtr (PcdEthMacA))[1],
-    ((UINT8 *)PcdGetPtr (PcdEthMacA))[2], ((UINT8 *)PcdGetPtr (PcdEthMacA))[3],
-    ((UINT8 *)PcdGetPtr (PcdEthMacA))[4], ((UINT8 *)PcdGetPtr (PcdEthMacA))[5]));
-  DEBUG ((EFI_D_ERROR, "EthMacB = %02x:%02x:%02x:%02x:%02x:%02x\n",
-    ((UINT8 *)PcdGetPtr (PcdEthMacB))[0], ((UINT8 *)PcdGetPtr (PcdEthMacB))[1],
-    ((UINT8 *)PcdGetPtr (PcdEthMacB))[2], ((UINT8 *)PcdGetPtr (PcdEthMacB))[3],
-    ((UINT8 *)PcdGetPtr (PcdEthMacB))[4], ((UINT8 *)PcdGetPtr (PcdEthMacB))[5]));
-#endif
+    MacSize = sizeof(MacAddrInfo.MacAddress0);
+    Status = PcdSetPtrS (PcdEthMacA, &MacSize, MacAddrInfo.MacAddress0);
+    ASSERT_EFI_ERROR (Status);
+    Status = PcdSetPtrS (PcdEthMacB, &MacSize, MacAddrInfo.MacAddress1);
+    ASSERT_EFI_ERROR (Status);
+
+    DEBUG ((EFI_D_ERROR, "EthMacA = %02x:%02x:%02x:%02x:%02x:%02x\n",
+      ((UINT8 *)PcdGetPtr (PcdEthMacA))[0], ((UINT8 *)PcdGetPtr (PcdEthMacA))[1],
+      ((UINT8 *)PcdGetPtr (PcdEthMacA))[2], ((UINT8 *)PcdGetPtr (PcdEthMacA))[3],
+      ((UINT8 *)PcdGetPtr (PcdEthMacA))[4], ((UINT8 *)PcdGetPtr (PcdEthMacA))[5]));
+    DEBUG ((EFI_D_ERROR, "EthMacB = %02x:%02x:%02x:%02x:%02x:%02x\n",
+      ((UINT8 *)PcdGetPtr (PcdEthMacB))[0], ((UINT8 *)PcdGetPtr (PcdEthMacB))[1],
+      ((UINT8 *)PcdGetPtr (PcdEthMacB))[2], ((UINT8 *)PcdGetPtr (PcdEthMacB))[3],
+      ((UINT8 *)PcdGetPtr (PcdEthMacB))[4], ((UINT8 *)PcdGetPtr (PcdEthMacB))[5]));
+  }
 
   // Let other PEI modules know we're done!
   Status = (*PeiServices)->InstallPpi (PeiServices, &mPlatInitPpiDescriptor);