From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.groups.io with SMTP id smtpd.web12.13083.1575908120811753432 for ; Mon, 09 Dec 2019 08:15:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=ZEBoU6/o; spf=pass (domain: linaro.org, ip: 209.85.128.68, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f68.google.com with SMTP id p17so15598420wma.1 for ; Mon, 09 Dec 2019 08:15:20 -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; bh=T2nJ23D0s7WUeCBN9L2CUNjJOIg15glN0SpXqNGFtVk=; b=ZEBoU6/o9sMUiN62mC18A2ZS2cH9Z4Fe/AF2U4u0cgr+A6Xb3ezRZs9jveXmj7RwhL QO5lPhJuhk7XSIDRuXNAlQNE1GRDRWxoyNsSM4l5PjvfXrsmx5WY5Rll7yGJaLHopMsw fcpj8qGlsTG6XWgbp/+xqF6esQY3BiJ7Wi2FqIuKdMTnQgg4QMVgVlb/aj9/qvdFbYZj ld0Fden0NSBxORp6ab5bZkTASrqG79jFcC1pqAFZoUtiDehoGATVJUvFjDOGOAp0RncA Oue7sr0RfGpCYDaSk+s9XwrPySJImD00mzPzt82/w+3pVa+KXWR/XDJ3yu1IPfudvkS/ hQfQ== 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; bh=T2nJ23D0s7WUeCBN9L2CUNjJOIg15glN0SpXqNGFtVk=; b=qiJ8bLlEIqkntrcz+99jfO3UtvmCWS9+jOSVuxBbqH0QZTe/fUVbILAivYHF0vgo8E FgGZCiD2eo8K8PlX0hTlhPbvvOaPmFzZwmC3RGTUpsYf/PgltKDCWNixuDMG8hdGKXs6 Tb2/tvyCWePzndXHLEwJVF04f7a1lPN+Ot8xHAPFm134ueDvkers3ueazHFIgizw1hx9 t4XE32VUGzq3lhssBA9OYG//NCf14ZJ8cQtRl9tbVrmkKvm5mCMSPkMXHQdvxYPNyR47 RNT71V5sjprTxb6V+0KZ+7AM32sOnPhTMF1YLk9JdTV55vJT+g2fUlsyspFnkF8qc5YI 2WQQ== X-Gm-Message-State: APjAAAWNU1NqT8Zsvtw73QeIxJwm7tvyqAIOc5Sol4bjD6Z9aoxf+NjX F6dfyRqAaRqTCR0u1QLVIKxwtoiJdPJsNFcI X-Google-Smtp-Source: APXvYqy2pg5gYJ97WFZWOV9DYHGRTnq204PV4BOFzj7pyw5pwjlqIRzTp3yobyH5IcbZ3dRl5KPkSQ== X-Received: by 2002:a1c:1dc4:: with SMTP id d187mr26361395wmd.46.1575908119185; Mon, 09 Dec 2019 08:15:19 -0800 (PST) Return-Path: Received: from e123331-lin.home (amontpellier-657-1-18-247.w109-210.abo.wanadoo.fr. [109.210.65.247]) by smtp.gmail.com with ESMTPSA id x11sm199591wmg.46.2019.12.09.08.15.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 08:15:18 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, Ard Biesheuvel Subject: [PATCH edk2-platforms 3/3] Silicon/AMD/Styx/PlatInitPei: ignore bogus MAC addresses provided by the SCP Date: Mon, 9 Dec 2019 17:15:21 +0100 Message-Id: <20191209161521.1986-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191209161521.1986-1-ard.biesheuvel@linaro.org> References: <20191209161521.1986-1-ard.biesheuvel@linaro.org> In some cases, the SCP on B0 Overdrive returns all ones for the Ethernet MAC addresses, which breaks networking not only in UEFI but also in the OS. So ignore the SCP in this case, and keep the MAC addresses that have already been set at build time. Signed-off-by: Ard Biesheuvel --- Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c b/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c index 0f1d2c6ff6e3..4de26404a8a7 100644 --- a/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c +++ b/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c @@ -216,11 +216,18 @@ PlatInitPeiEntryPoint ( PeiServices, &MacAddrInfo ); ASSERT_EFI_ERROR (Status); + // Check for bogus MAC addresses that have the multicast bit set. This + // includes FF:FF:FF:FF:FF:FF, which is what you get from the SCP on + // some versions of the B0 Overdrive 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 ((MacAddrInfo.MacAddress0[0] & 0x1) == 0x0) { + Status = PcdSetPtrS (PcdEthMacA, &MacSize, MacAddrInfo.MacAddress0); + ASSERT_EFI_ERROR (Status); + } + if ((MacAddrInfo.MacAddress1[0] & 0x1) == 0x0) { + 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], -- 2.17.1