From patchwork Tue Dec 11 15:02:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153469 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp716248ljp; Tue, 11 Dec 2018 07:02:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uv/taHcBWvqi5CRD96/H6QoBdUycHMYDyFvyD7QOr7u4W5JhyGq/ZQuYzkfXEZLuGjaIwv X-Received: by 2002:a63:f412:: with SMTP id g18mr15046687pgi.262.1544540567798; Tue, 11 Dec 2018 07:02:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544540567; cv=none; d=google.com; s=arc-20160816; b=wysiyR1PjTm4zCBGFk8b9h7ifZcqAdqGugJ6Y12+vCm6xH82x5sXw+/yhHr/QH8ZK8 roU15oXWmoTO/KRVFrM+5WKV7ZwgwfVWe57JdpZ6nWGllkJrVym4DEt2JPnzGN5qs+go uED9BH2w83k0c6fr3DhhUMA191TWFT/7cEqVGBRgplFTOLe5ySF4M4Wpz/aNh3CvkD2l qRZoVFhl+P+uObrZZOuLT7Xu5IUINyv+qvaYcEze/iDQ7xPqRcimp9KT7zTSIaXni3wf zFxlZOZp9lMzT+EiyH9X8Y38o+8E6TnQebZmmlCq8yi6XlqrD5dPJGjt8n5P8vQBKHU2 WdAg== 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=e8G3xD3dHu9CmKdXj7Lc3hQNvDtyKc8wNXGQPWyQoiE=; b=VAkRV9H7ERkLhsJKeDoewbncJPdX2tbdZw1hnwKN2U2DGiKpDfx01Z5mWmt8VF1iJk KO96aaNJc7pUYDtlQuAOgIv0Q0hUrucksb9K2SjCO0UgsXas8cfOtZRuuWpGZ3YRoQi4 TiBeA1oXPmlk755YQKzdRxXFVIN4WJXUSe0RSZ6quCg53/JigCamOv6abAYhwBCah0a2 UJ/xD/KjGDu1BBhG9lvSq7YbTb7IrL2B1EQC8VMlLWBrVUGco7pTa4vqn2xJdifqpUnH JQGzPpT0/uJvZ4mBFLbMsS9B2Z5MxoW34BiGfUR4dgOZNBRDUcmGr8gEB7hpet79uBMe Bvvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Dw8z57OO; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id d77si13384929pfj.124.2018.12.11.07.02.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 07:02:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Dw8z57OO; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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 BA5A92194D3AE; Tue, 11 Dec 2018 07:02:45 -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::341; helo=mail-wm1-x341.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (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 1CD302119926B for ; Tue, 11 Dec 2018 07:02:43 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id n190so2574851wmd.0 for ; Tue, 11 Dec 2018 07:02:43 -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=4Z88tCHknS8aexAglNIO+B+I6EdkSp3Pd9aCug1Axak=; b=Dw8z57OOa/lqzDbumlENL/JRjxu5A+/3c+TFzqtus9JVnKYz5tDU7I0fOAvKtQsgi8 tjjrMTdLUp6U20EYoBb1kTnENmpbiy4XYf2OMAGfmIBe4sFuzunGQnOK51mQim0JfojB iq1ZwcZVCOgWayT2bpG5/0xiJsyUTnLHywkV8= 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=4Z88tCHknS8aexAglNIO+B+I6EdkSp3Pd9aCug1Axak=; b=IFo4jmBDTdpd5kPiP6CaQnuwWRY1DamlxgYv6wo64ABiLTQwFyG1ab1/QUUHvhHu0g Ks0QyegSlZd+h6gzUGN7d76/7hwZ8wSjZaosB8VZ+igUtWLFwd1MPrBwiwOu/0yrdAFU 9qvQUjC1Go9/npLKvHtvtzNQ4atylqlWK+sWxdjKvj9thOrf9yY2j++7rEZ/zRbj7F04 rYtHrSUQVn8R7LWYiFiPZIxrqNvxAnovyi3zCPwpssuZ7ky6AIIIm6MKDXwvdSwGi5Y2 FIdBRBQQ8L75BYGZO2x7Ny7IM2zQ7stO5w5KtmqoyPMFkufbiN3itK978DzzgJg4Oq9+ ynlw== X-Gm-Message-State: AA+aEWaM+q5CRDKE+GQ6UZpwNlg1HiEvTGv79+ozW+/k8oDZr8GI+79v XPNAWLy6+VX/kPUOGiOAEP0fvvhPivf3Pg== X-Received: by 2002:a1c:81ca:: with SMTP id c193mr2820744wmd.66.1544540562137; Tue, 11 Dec 2018 07:02:42 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:8c3:6b9d:cbc9:58c6]) by smtp.gmail.com with ESMTPSA id o9sm285793wmh.3.2018.12.11.07.02.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 07:02:41 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 11 Dec 2018 16:02:32 +0100 Message-Id: <20181211150237.32275-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181211150237.32275-1-ard.biesheuvel@linaro.org> References: <20181211150237.32275-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH edk2-platforms 1/6] Platform/AMD/OverdriveBoard: fix byte order of default MAC addresses 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" The PCDs containing the default MAC addresses are of type UINT64, and so the byte order needs to be inverted. As they are currently, both default MAC addresses are invalid since they have the multicast bit set. For readability, let's switch to a VOID* type PCD while at it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/AMD/Styx/AmdStyx.dec | 4 ++-- Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 4 ++-- Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 9 ++++---- Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c | 24 ++++++++++++-------- Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c | 8 +++---- 5 files changed, 26 insertions(+), 23 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/AmdStyx.dec b/Silicon/AMD/Styx/AmdStyx.dec index 902259dd7267..c2e691cb5ea4 100644 --- a/Silicon/AMD/Styx/AmdStyx.dec +++ b/Silicon/AMD/Styx/AmdStyx.dec @@ -42,8 +42,8 @@ gAmdStyxTokenSpaceGuid.PcdSocCoreCount|1|UINT32|0x00000100 gAmdStyxTokenSpaceGuid.PcdSocCpuId|1|UINT32|0x00000101 - gAmdStyxTokenSpaceGuid.PcdEthMacA|0|UINT64|0x000d0001 - gAmdStyxTokenSpaceGuid.PcdEthMacB|0|UINT64|0x000d0002 + gAmdStyxTokenSpaceGuid.PcdEthMacA|{0x0,0x0,0x0,0x0,0x0,0x0}|VOID*|0x000d0001 + gAmdStyxTokenSpaceGuid.PcdEthMacB|{0x0,0x0,0x0,0x0,0x0,0x0}|VOID*|0x000d0002 [PcdsFixedAtBuild] # CPUID Register diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc index ce909982c39b..3b9d70de2751 100644 --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc @@ -468,8 +468,8 @@ DEFINE DO_CAPSULE = FALSE gAmdModulePkgTokenSpaceGuid.PcdPort1NetSpeed|1 [PcdsDynamicDefault.common] - gAmdStyxTokenSpaceGuid.PcdEthMacA|0x02A1A2A3A4A5 - gAmdStyxTokenSpaceGuid.PcdEthMacB|0x02B1B2B3B4B5 + gAmdStyxTokenSpaceGuid.PcdEthMacA|{0x2,0xA1,0xA2,0xA3,0xA4,0xA5} + gAmdStyxTokenSpaceGuid.PcdEthMacB|{0x2,0xB1,0xB2,0xB3,0xB4,0xB5} [PcdsPatchableInModule] gAmdModulePkgTokenSpaceGuid.PcdXgbeUseMacFromIscp|TRUE diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c index f1223ada2444..9c17c38a04bf 100644 --- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c @@ -60,15 +60,14 @@ STATIC VOID SetPackageAddress ( UINT8 *Package, - UINT64 MacAddress, + UINT8 *MacAddress, UINTN Size ) { UINTN Index; for (Index = PACKAGE_MAC_OFFSET; Index < Size; Index += PACKAGE_MAC_INCR) { - Package[Index] = (UINT8)MacAddress; - MacAddress >>= 8; + Package[Index] = *MacAddress++; } } @@ -165,11 +164,11 @@ InstallSystemDescriptionTables ( // CopyMem (MacPackage, mDefaultMacPackageA, sizeof (MacPackage)); - SetPackageAddress (MacPackage, PcdGet64 (PcdEthMacA), sizeof (MacPackage)); + SetPackageAddress (MacPackage, PcdGetPtr (PcdEthMacA), sizeof (MacPackage)); PatchAmlPackage (mDefaultMacPackageA, MacPackage, sizeof (MacPackage), (UINT8 *)Table, TableSize); - SetPackageAddress (MacPackage, PcdGet64 (PcdEthMacB), sizeof (MacPackage)); + SetPackageAddress (MacPackage, PcdGetPtr (PcdEthMacB), sizeof (MacPackage)); PatchAmlPackage (mDefaultMacPackageB, MacPackage, sizeof (MacPackage), (UINT8 *)Table, TableSize); diff --git a/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c b/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c index 4ea1dd4b3577..3cd650eee36b 100644 --- a/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c +++ b/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c @@ -123,7 +123,7 @@ PlatInitPeiEntryPoint ( ISCP_CPU_RESET_INFO CpuResetInfo = {0}; #if DO_XGBE == 1 ISCP_MAC_INFO MacAddrInfo = {0}; - UINT64 MacAddr0, MacAddr1; + UINTN MacSize; #endif UINTN CpuCoreCount, CpuMap, CpuMapSize; UINTN Index, CoreNum; @@ -223,16 +223,20 @@ PlatInitPeiEntryPoint ( PeiServices, &MacAddrInfo ); ASSERT_EFI_ERROR (Status); - MacAddr0 = MacAddr1 = 0; - for (Index = 0; Index < 6; ++Index) { - MacAddr0 |= (UINT64)MacAddrInfo.MacAddress0[Index] << (Index * 8); - MacAddr1 |= (UINT64)MacAddrInfo.MacAddress1[Index] << (Index * 8); - } - PcdSet64 (PcdEthMacA, MacAddr0); - PcdSet64 (PcdEthMacB, MacAddr1); + 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 = 0x%lX\n", PcdGet64 (PcdEthMacA))); - DEBUG ((EFI_D_ERROR, "EthMacB = 0x%lX\n", PcdGet64 (PcdEthMacB))); + 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 // Let other PEI modules know we're done! diff --git a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c index b9dfa2367ab2..4ca5d9bebed6 100644 --- a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c +++ b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c @@ -168,7 +168,7 @@ VOID SetMacAddress ( IN VOID *Fdt, IN CONST CHAR8 *Device, - IN UINT64 MacAddress + IN UINT8 *MacAddress ) { INT32 Node; @@ -179,7 +179,7 @@ SetMacAddress ( if (Node >= 0) { SubNode = fdt_subnode_offset (Fdt, Node, Device); if (SubNode >= 0) { - Rc = fdt_setprop (Fdt, SubNode, "mac-address", (VOID *)&MacAddress, + Rc = fdt_setprop (Fdt, SubNode, "mac-address", MacAddress, MAC_ADDRESS_BYTES); if (Rc) { DEBUG ((DEBUG_ERROR, @@ -289,8 +289,8 @@ SetXgbeStatus ( SetDeviceStatus (Fdt, "xgmac@e0900000", TRUE); SetDeviceStatus (Fdt, "phy@e1240c00", TRUE); - SetMacAddress (Fdt, "xgmac@e0700000", PcdGet64 (PcdEthMacA)); - SetMacAddress (Fdt, "xgmac@e0900000", PcdGet64 (PcdEthMacB)); + SetMacAddress (Fdt, "xgmac@e0700000", PcdGetPtr (PcdEthMacA)); + SetMacAddress (Fdt, "xgmac@e0900000", PcdGetPtr (PcdEthMacB)); #else SetDeviceStatus (Fdt, "xgmac@e0700000", FALSE); SetDeviceStatus (Fdt, "phy@e1240800", FALSE);