From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by mx.groups.io with SMTP id smtpd.web11.9479.1578581073544139072 for ; Thu, 09 Jan 2020 06:44:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=t5/cnuVM; spf=pass (domain: linaro.org, ip: 209.85.128.67, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f67.google.com with SMTP id q9so3185196wmj.5 for ; Thu, 09 Jan 2020 06:44:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hAppG18Z8LRqqIGkjgO0CqU7bkNVMLg9Gp4DOcKhTg0=; b=t5/cnuVM/T4/ATKHZs7sV0W8WxwUteDBHvdbhc/EzQCd6C2dqgNxEOyHtBQ+jFo9fO fkP4/yxlH9072GA8ksywHd8+MNTN4ZTllNIEyJtCTQVtR3jwDfNgczQMeMq3pSKfWABB Td1n59imny9iXBkC4S2F6spbasmhvRJJQqHM/xXFgnzVQ3zb8TK8C7Vspkc17gIjZwUP I7dWnZz6+sSL4gLxwzwFPdKEEqS6TG/u+ippSYwUUUTgNbKT/SdUslUKTI9/ptLrm4VB vb+aiO2u+NiVrvC02qfjMBJtkitk/vvR7Notmq+2uj00NOV2pGqk6GCs+T5oTjUCk2SA +Pkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hAppG18Z8LRqqIGkjgO0CqU7bkNVMLg9Gp4DOcKhTg0=; b=Xsc5ROWPcZhaF2DWWoz+yqe5EvVXuozL4yBych8mT6/xPaJ125uoFr5XmhtjNkNV3t ygk4P4h6NSufYd/JcLgicdvGgHZdk90Fr1Q2wr4ltg5nLsmYlcWAqnBFnsYHIUvRSEVf DGFGTX3cHH/jV+XVZq+lC+NM40u3u2EH/kP2uLP5Ejg9jCLPwlXAuDkXT62RurShvqmp v6YGr/h5n3qNt+yatt6b2McYDLYY0aARQlRY/fQG2ADuK/aq3mIiw3UC0PKk1IkTghkq 82KcwJPKbzHAdK5ooLXe8hsZqkLzmNg6jMksksjkg/6roXJS5SiJt3dCz/Nor98DLah7 F/0A== X-Gm-Message-State: APjAAAU/KTt/P+qGGGeDojGsqRfJEC2CHXMYBi7jKYhev1mqfceM/Zo7 0s5J3EJzFnnKmzVtt3pMmMJAiNBNRXDYGymSdLACvw== X-Google-Smtp-Source: APXvYqzv5+gasAo1pBxFC7+dHPzd7ZedZRjtXp9kUsaPeeLtK/nuk4hfcKOCnuRXwOD0/Ak5RxoF7vpWp7kL5yW1ojQ= X-Received: by 2002:a1c:a795:: with SMTP id q143mr5157168wme.52.1578581071969; Thu, 09 Jan 2020 06:44:31 -0800 (PST) MIME-Version: 1.0 References: <20200108170004.6680-1-pete@akeo.ie> <20200108170004.6680-3-pete@akeo.ie> In-Reply-To: <20200108170004.6680-3-pete@akeo.ie> From: "Ard Biesheuvel" Date: Thu, 9 Jan 2020 15:44:21 +0100 Message-ID: Subject: Re: [edk2-platforms][PATCH 2/2] Platform/RPi/RPiFirmwareDxe: Fix serial number population for RPi4 To: Pete Batard Cc: edk2-devel-groups-io , Leif Lindholm , =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Content-Type: text/plain; charset="UTF-8" On Wed, 8 Jan 2020 at 18:00, Pete Batard 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 > --- > 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 >