public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, alan@softiron.co.uk,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH edk2-platforms 05/11] Silicon/AMD/Styx/StyxDtbLoaderLib: replace XGBE CPP conditional with PCD
Date: Tue, 11 Dec 2018 19:35:08 +0100	[thread overview]
Message-ID: <20181211183514.20948-6-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20181211183514.20948-1-ard.biesheuvel@linaro.org>

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/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.inf |  1 +
 Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c   | 39 +++++++-------------
 2 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.inf b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.inf
index 87cdcb3e6b25..af57ab24f084 100644
--- a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.inf
+++ b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.inf
@@ -50,6 +50,7 @@
   gArmTokenSpaceGuid.PcdSystemMemoryBase
 
 [FixedPcd]
+  gAmdModulePkgTokenSpaceGuid.PcdXgbeEnable
   gArmPlatformTokenSpaceGuid.PcdCoreCount
   gArmTokenSpaceGuid.PcdArmLinuxFdtMaxOffset
   gArmTokenSpaceGuid.PcdArmLinuxFdtAlignment
diff --git a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
index b1e4984d3fd0..db7d9b077c32 100644
--- a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
+++ b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
@@ -161,8 +161,6 @@ SetDeviceStatus (
   }
 }
 
-#if DO_XGBE
-
 #define MAC_ADDRESS_BYTES       6
 
 STATIC
@@ -192,8 +190,6 @@ SetMacAddress (
   }
 }
 
-#endif
-
 STATIC
 VOID
 DisableSmmu (
@@ -242,7 +238,6 @@ SetSocIdStatus (
 {
   UINT32        SocId;
   BOOLEAN       IsRevB1;
-  BOOLEAN       DisableXgbeSmmus;
 
   SocId = PcdGet32 (PcdSocCpuId);
   IsRevB1 = (SocId & STYX_SOC_VERSION_MASK) >= STYX_SOC_VERSION_B1;
@@ -267,13 +262,7 @@ SetSocIdStatus (
     DisableSmmu (Fdt, "iommus", "/smb/smmu@e0c00000", "/smb/sata@e0d00000");
   }
 
-#if DO_XGBE
-  DisableXgbeSmmus = !PcdGetBool (PcdEnableSmmus);
-#else
-  DisableXgbeSmmus = TRUE;
-#endif
-
-  if (DisableXgbeSmmus) {
+  if (!FixedPcdGetBool (PcdXgbeEnable) || !PcdGetBool (PcdEnableSmmus)) {
     DisableSmmu (Fdt, "iommus", "/smb/smmu@e0600000", "/smb/xgmac@e0700000");
     DisableSmmu (Fdt, "iommus", "/smb/smmu@e0800000", "/smb/xgmac@e0900000");
   }
@@ -285,20 +274,20 @@ SetXgbeStatus (
   IN VOID       *Fdt
   )
 {
-#if DO_XGBE
-  SetDeviceStatus (Fdt, "xgmac@e0700000", TRUE);
-  SetDeviceStatus (Fdt, "phy@e1240800", TRUE);
-  SetDeviceStatus (Fdt, "xgmac@e0900000", TRUE);
-  SetDeviceStatus (Fdt, "phy@e1240c00", TRUE);
+  if (FixedPcdGetBool (PcdXgbeEnable)) {
+    SetDeviceStatus (Fdt, "xgmac@e0700000", TRUE);
+    SetDeviceStatus (Fdt, "phy@e1240800", TRUE);
+    SetDeviceStatus (Fdt, "xgmac@e0900000", TRUE);
+    SetDeviceStatus (Fdt, "phy@e1240c00", TRUE);
 
-  SetMacAddress (Fdt, "xgmac@e0700000", PcdGetPtr (PcdEthMacA));
-  SetMacAddress (Fdt, "xgmac@e0900000", PcdGetPtr (PcdEthMacB));
-#else
-  SetDeviceStatus (Fdt, "xgmac@e0700000", FALSE);
-  SetDeviceStatus (Fdt, "phy@e1240800", FALSE);
-  SetDeviceStatus (Fdt, "xgmac@e0900000", FALSE);
-  SetDeviceStatus (Fdt, "phy@e1240c00", FALSE);
-#endif
+    SetMacAddress (Fdt, "xgmac@e0700000", PcdGetPtr (PcdEthMacA));
+    SetMacAddress (Fdt, "xgmac@e0900000", PcdGetPtr (PcdEthMacB));
+  } else {
+    SetDeviceStatus (Fdt, "xgmac@e0700000", FALSE);
+    SetDeviceStatus (Fdt, "phy@e1240800", FALSE);
+    SetDeviceStatus (Fdt, "xgmac@e0900000", FALSE);
+    SetDeviceStatus (Fdt, "phy@e1240c00", FALSE);
+  }
 }
 
 
-- 
2.19.2



  parent reply	other threads:[~2018-12-11 18:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 18:35 [PATCH edk2-platforms 00/11] final set of Styx cleanups Ard Biesheuvel
2018-12-11 18:35 ` [PATCH edk2-platforms 01/11] Silicon/AMD/Styx/Iort: drop conditionally included XGBE nodes Ard Biesheuvel
2018-12-11 18:35 ` [PATCH edk2-platforms 02/11] Platform/SoftIron/Overdrive1000Board: remove dead XGBE references Ard Biesheuvel
2018-12-11 18:35 ` [PATCH edk2-platforms 03/11] Silicon/AMD/Styx/AcpiPlatformDxe: replace XGBE CPP conditional with PCD Ard Biesheuvel
2018-12-11 18:35 ` [PATCH edk2-platforms 04/11] Silicon/AMD/Styx/PlatInitPei: " Ard Biesheuvel
2018-12-11 18:35 ` Ard Biesheuvel [this message]
2018-12-11 18:35 ` [PATCH edk2-platforms 06/11] Platform/AMD/OverdriveBoard: drop DO_XGBE C preprocessor defines Ard Biesheuvel
2018-12-11 18:35 ` [PATCH edk2-platforms 07/11] Silicon/AMD/Styx: introduce boolean PCD for KCS/IPMI support Ard Biesheuvel
2018-12-11 18:35 ` [PATCH edk2-platforms 08/11] Silicon/AMD/Styx/AcpiPlatformDxe: move IPMI/KCS device into separate SSDT Ard Biesheuvel
2018-12-11 18:35 ` [PATCH edk2-platforms 09/11] Silicon/AMD/Styx/StyxDtbLoaderLib: replace DO_KCS macro reference with PCD Ard Biesheuvel
2018-12-11 18:35 ` [PATCH edk2-platforms 10/11] Platform/Styx: get rid of DO_KCS preprocessor macro Ard Biesheuvel
2018-12-11 18:35 ` [PATCH edk2-platforms 11/11] Silicon/AMD/Styx/AcpiPlatformDxe: disable KCS on pre-B1 silicon Ard Biesheuvel
2018-12-12 22:23 ` [PATCH edk2-platforms 00/11] final set of Styx cleanups Leif Lindholm
2018-12-13 11:09   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181211183514.20948-6-ard.biesheuvel@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox