From: "Pete Batard" <pete@akeo.ie>
To: devel@edk2.groups.io
Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org
Subject: [edk2-platforms][PATCH v3 2/5] Platform/RPi3/RpiFirmwareDxe: Improve serial number population
Date: Fri, 11 Oct 2019 12:07:43 +0100 [thread overview]
Message-ID: <20191011110746.1952-3-pete@akeo.ie> (raw)
In-Reply-To: <20191011110746.1952-1-pete@akeo.ie>
Improve RpiFirmwareGetSerial() to derive a serial number from the
MAC address, in case the platform returns 0 for the serial number.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
Platform/RaspberryPi/RPi3/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/Platform/RaspberryPi/RPi3/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b/Platform/RaspberryPi/RPi3/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
index 25d7fa3974c0..5a9d4c3f1787 100644
--- a/Platform/RaspberryPi/RPi3/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
+++ b/Platform/RaspberryPi/RPi3/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
@@ -393,7 +393,14 @@ RpiFirmwareGetSerial (
}
*Serial = Cmd->TagBody.Serial;
- return EFI_SUCCESS;
+ // Some platforms return 0 for serial. For those, try to use the MAC address.
+ if (*Serial == 0) {
+ Status = RpiFirmwareGetMacAddress ((UINT8*) Serial);
+ // Convert to a more user-friendly value
+ *Serial = SwapBytes64 (*Serial << 16);
+ }
+
+ return Status;
}
#pragma pack()
--
2.21.0.windows.1
next prev parent reply other threads:[~2019-10-11 11:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-11 11:07 [edk2-platforms][PATCH v3 0/5] Various SMBIOS improvements Pete Batard
2019-10-11 11:07 ` [edk2-platforms][PATCH v3 1/5] Platform/RPi3/RpiFirmwareDxe: Add more query functions Pete Batard
2019-10-14 9:55 ` [edk2-devel] " Philippe Mathieu-Daudé
2019-10-11 11:07 ` Pete Batard [this message]
2019-10-11 11:07 ` [edk2-platforms][PATCH v3 3/5] Platform/RPi3/PlatformSmbiosDxe: Improve population of SMBIOS entries Pete Batard
2019-10-11 11:07 ` [edk2-platforms][PATCH v3 4/5] Platform/RPi3/PlatformSmbiosDxe: Populate BIOS major/minor from PCD Pete Batard
2019-10-11 11:07 ` [edk2-platforms][PATCH v3 5/5] Platform/RPi3/PlatformSmbiosDxe: Derive RAM size from board revision Pete Batard
2019-10-14 10:01 ` [edk2-devel] " Philippe Mathieu-Daudé
2019-10-14 11:44 ` Pete Batard
2019-10-14 11:53 ` Philippe Mathieu-Daudé
2019-10-14 12:03 ` Pete Batard
2019-10-14 12:08 ` Philippe Mathieu-Daudé
2019-10-14 12:17 ` Leif Lindholm
2019-10-15 20:00 ` [edk2-platforms][PATCH v3 0/5] Various SMBIOS improvements Leif Lindholm
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=20191011110746.1952-3-pete@akeo.ie \
--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