[edk2-devel] [edk2-platforms][PATCH 2/2] Platform/RPi/RPiFirmwareDxe: Fix serial number population for RPi4

Ard Biesheuvel ard.biesheuvel at linaro.org
Thu Jan 9 14:44:21 UTC 2020


On Wed, 8 Jan 2020 at 18:00, Pete Batard <pete at akeo.ie> wrote:
>
> Some (all?) Raspbery Pi 4 platforms report 0x0000000010000000 as their
> board serial when queried through the VideoCore mailbox.
>
> Fix this by using the MAC address then.
>
> Signed-off-by: Pete Batard <pete at akeo.ie>
> ---
>  Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
> index dd61ef089ca7..75826fdc0e53 100644
> --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
> +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
> @@ -394,8 +394,9 @@ RpiFirmwareGetSerial (
>    }
>
>    *Serial = Cmd->TagBody.Serial;
> -  // Some platforms return 0 for serial. For those, try to use the MAC address.
> -  if (*Serial == 0) {
> +  // Some platforms return 0 or 0x0000000010000000 for serial.
> +  // For those, try to use the MAC address.
> +  if ((*Serial == 0) || ((*Serial & 0xFFFFFFFF0FFFFFFFULL) == 0)) {

What is the point of using a mask here? Is it deliberately matching
0x0000000020000000 or 0x00000000F0000000 as well?

>      Status = RpiFirmwareGetMacAddress ((UINT8*) Serial);
>      // Convert to a more user-friendly value
>      *Serial = SwapBytes64 (*Serial << 16);
> --
> 2.21.0.windows.1
>

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#53085): https://edk2.groups.io/g/devel/message/53085
Mute This Topic: https://groups.io/mt/69532224/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list