From patchwork Tue Dec 11 18:35:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153495 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp949182ljp; Tue, 11 Dec 2018 10:35:40 -0800 (PST) X-Google-Smtp-Source: AFSGD/V6jqAmAPLSe6ne9DQcnFg+SDHbRdceVg3y1xIfL76Fs9Zgoce9wzoTuM2HS21EoldsIzJ+ X-Received: by 2002:a62:32c4:: with SMTP id y187mr18000819pfy.195.1544553340566; Tue, 11 Dec 2018 10:35:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544553340; cv=none; d=google.com; s=arc-20160816; b=NEL9CTWGIhtLmLAbUUfpYjPdYrX+bGip+M2R1/uOusxaMKLdiC8FGwzhuNLA2Rv1HU W268cE2O+TwdDp7v3Lf1JGFLRSZMqPuAN0uXX3Z3LauzO5oURJIs5hO0P53iFU7k01vz 7qjGkAk8zT5NQgY0AM3oHeue1qtkI1bjAv6Se2DC7Rl5zo2bhGP8ymGR34tZLnNfEadv 1+9fP+mGW3JTeiMF9oHKmwq13Vh48Fti0PtXKDLq9kMlj2Gqz6HKZcTWzdn4JSRaKrqE EWBNnOKmVEnkVOVZ1I12/vDtv1n2Sqp/1IAxNoRu70u9s0x//+rqHB9n0Fxjx2nQWm99 DI3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=sNz4gw0u6Te82jFbnGGEFrAcr+wgWNQrwiT8vnPM518=; b=HQ+k/lObYKkWvPAJ2+W5lzv2w6lrmZAWfdT2zxb/l3j4rbWmW43qdF2SFPc1SfGpwa 75mIzUYJJuwDihK/cUWs4HsSIkT+FZCR455l4Indc5AKPzbkqEwyq6+oo9IG0xNPQfcV 2brNIc3Px8P+p1Eh8p8hn3dyst2qHuRuToXhoRhnt02Wc+YxBEsQ9Q3481ejHWDoWDAH 7bc4UmTcG4tpg5zXMAhcTNk0+wN4FJSTCk0eQt+xMY5/jTzlfIMrqtiMdSJAV9KWOyZ7 yNK2TqqXZt6wA/gWyYJso4f/LRAdTCcTjG3O0cMXlG+OA3SGFPrCFEvXezMO94WFAhsS HoAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=d9iJ8+ab; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id n33si12751598pgl.336.2018.12.11.10.35.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 10:35:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=d9iJ8+ab; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C716E2119AC02; Tue, 11 Dec 2018 10:35:31 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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-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 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: [edk2] [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: , Cc: alan@softiron.co.uk Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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); + } }