From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::344; helo=mail-wm1-x344.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 87A512119A44D for ; Tue, 11 Dec 2018 10:35:30 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id q26so3336217wmf.5 for ; Tue, 11 Dec 2018 10:35:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KNxbnAeENirUl6c8AesROocyKRCa0McmhfRsMYn8HuQ=; b=d9iJ8+ablTZCWwuHOv73aWMSSwpyTk/AGL/aD8oLOewGoBVFtA9deNO2i5vL9WmBuV xjqzw5KfBSQx7VIhU3QjofTFi6OKPZiK2R5yjh56QG+wH2x+FBgGvQV0o4R4crbYjNv2 ycUyfm6nMLP7D7/Bt+oZuH4s6zHXMn2S4CmNw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KNxbnAeENirUl6c8AesROocyKRCa0McmhfRsMYn8HuQ=; b=HSCgy+TbxofvZ16Qr+o7z7kSarVwYEoL6NTQwIaeJPlRLBp0DP08xghphALL1ffWno w5Mm+ZfVyNDpQlBKvugmOUdQ4VDwWAW+VSVzp0NDGO5vYnVVye/AC9uMLBb83VtsZy/z y0KsGZivgCXJ8GM9y/izRI28mV5Bf6q/ylEcZLJp0oSrWnsJgQBIGiHBWeN0mHF5vOmM SkPCGA6GmhqW8ii3s82XuTyALfXNAEqxn9HefPqGFvEGjt2/5J/7zp2AXS8bNa4euVUy ICb1cXDvLIRu068xxXiBD6K0cwwQr97mNuR9HNaN1eq1kTi5wIwg8kCFgcHGh4m1nVI5 fdFQ== X-Gm-Message-State: AA+aEWa6TLm9H1SQ60psSZuLMkamsgMUeH8zyZr5f0jar8VlpdGGINNs jAbO/el+elNqr51IiTI4ovHNldWwshCAeQ== X-Google-Smtp-Source: AFSGD/XQZ5ecHrvjBtbvvAFL0L0TvKaX52QJhY8DHe0/6uynQ+Z7KQQ5X+RMHeKFkh2EBLBvu3Rykw== X-Received: by 2002:a1c:9e4a:: with SMTP id h71mr3591053wme.82.1544553328720; Tue, 11 Dec 2018 10:35:28 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:8c3:6b9d:cbc9:58c6]) by smtp.gmail.com with ESMTPSA id h131sm1026688wmd.17.2018.12.11.10.35.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 10:35:27 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, alan@softiron.co.uk, Ard Biesheuvel Date: Tue, 11 Dec 2018 19:35:08 +0100 Message-Id: <20181211183514.20948-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181211183514.20948-1-ard.biesheuvel@linaro.org> References: <20181211183514.20948-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [PATCH edk2-platforms 05/11] Silicon/AMD/Styx/StyxDtbLoaderLib: replace XGBE CPP conditional with PCD X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Dec 2018 18:35:30 -0000 Content-Transfer-Encoding: 8bit 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 --- 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