public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ard.biesheuvel@linaro.org>
To: devel@edk2.groups.io
Cc: leif.lindholm@linaro.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>
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	[thread overview]
Message-ID: <20191209161521.1986-4-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <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 <ard.biesheuvel@linaro.org>
---
 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


  parent reply	other threads:[~2019-12-09 16:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-09 16:15 [PATCH edk2-platforms 0/3] Seattle Overdrive fixes Ard Biesheuvel
2019-12-09 16:15 ` [PATCH edk2-platforms 1/3] Platform/Overdrive: revert streamID DT changes for first SATA port Ard Biesheuvel
2019-12-09 16:15 ` [PATCH edk2-platforms 2/3] Silicon/AMD/Styx: add some more stream IDs for SATA0 to the IORT Ard Biesheuvel
2019-12-09 16:15 ` Ard Biesheuvel [this message]
2019-12-09 16:47 ` [PATCH edk2-platforms 0/3] Seattle Overdrive fixes Leif Lindholm
2019-12-09 17:38   ` 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=20191209161521.1986-4-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