From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Pete Batard <pete@akeo.ie>, devel@edk2.groups.io
Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org
Subject: Re: [edk2-platforms][PATCH 1/2] Platform/RPi/SmbiosDxe: Report a more human readable firmware revision
Date: Mon, 20 Jan 2020 15:08:27 +0100 [thread overview]
Message-ID: <1d1bf178-0b55-dae8-9d48-3235ff8169a5@redhat.com> (raw)
In-Reply-To: <20200108170004.6680-2-pete@akeo.ie>
On 1/8/20 6:00 PM, Pete Batard wrote:
> The firmware revision that is queried through the VideoCore mailbox
> is really the 32-bit timestamp of when the VideoCore firmware was
> generated.
>
> To make this more palatable for human reporting, convert it to a
> YY.MM firmware revision, so that end-users can get an approximative
> idea of how old their VideoCore firmware is.
>
> Signed-off-by: Pete Batard <pete@akeo.ie>
> ---
> Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 20 ++++++++++++--------
> Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf | 2 ++
> 2 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
> index 6aa68a0925ba..06c73d691f9d 100644
> --- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
> +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
> @@ -38,6 +38,7 @@
> #include <Library/PcdLib.h>
> #include <Library/BaseMemoryLib.h>
> #include <Library/MemoryAllocationLib.h>
> +#include <Library/TimeBaseLib.h>
> #include <Library/UefiBootServicesTableLib.h>
> #include <Library/PrintLib.h>
>
> @@ -597,23 +598,26 @@ BIOSInfoUpdateSmbiosType0 (
> VOID
> )
> {
> - UINT32 FirmwareRevision = 0;
> + UINT32 EpochSeconds = 0;
> EFI_STATUS Status = EFI_SUCCESS;
> + EFI_TIME Time;
> INTN i;
> INTN State = 0;
> INTN Value[2];
>
> // Populate the Firmware major and minor.
> - Status = mFwProtocol->GetFirmwareRevision (&FirmwareRevision);
> + Status = mFwProtocol->GetFirmwareRevision (&EpochSeconds);
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "Failed to get firmware revision: %r\n", Status));
> } else {
> - // This expects Broadcom / The Raspberry Pi Foundation to switch to
> - // less nonsensical VideoCore firmware revisions in the future...
> - mBIOSInfoType0.EmbeddedControllerFirmwareMajorRelease =
> - (UINT8)((FirmwareRevision >> 16) & 0xFF);
> - mBIOSInfoType0.EmbeddedControllerFirmwareMinorRelease =
> - (UINT8)(FirmwareRevision & 0xFF);
> + // The firmware revision is really an epoch time which we convert to a
> + // YY.MM major.minor. This is good enough for our purpose, where this
> + // revision is merely provided as a loose indicator of when the
> + // VideoCore firmware was generated.
> + EpochToEfiTime (EpochSeconds, &Time);
> + ASSERT (Time.Year >= 2000 && Time.Year <= 2255);
> + mBIOSInfoType0.EmbeddedControllerFirmwareMajorRelease = (UINT8)(Time.Year - 2000);
> + mBIOSInfoType0.EmbeddedControllerFirmwareMinorRelease = Time.Month;
> }
>
> // mBiosVendor and mBiosVersion, which are referenced in mBIOSInfoType0Strings,
> diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
> index 0bd72c3ba6a1..9554c2e998f1 100644
> --- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
> +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
> @@ -27,6 +27,7 @@ [Packages]
> ArmPlatformPkg/ArmPlatformPkg.dec
> ArmPkg/ArmPkg.dec
> Platform/RaspberryPi/RaspberryPi.dec
> + EmbeddedPkg/EmbeddedPkg.dec
>
> [LibraryClasses]
> UefiBootServicesTableLib
> @@ -37,6 +38,7 @@ [LibraryClasses]
> UefiDriverEntryPoint
> DebugLib
> PrintLib
> + TimeBaseLib
>
> [Protocols]
> gEfiSmbiosProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
next prev parent reply other threads:[~2020-01-20 14:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-08 17:00 [edk2-platforms][PATCH 0/2] Platform/RPi: Smbios reporting improvements Pete Batard
2020-01-08 17:00 ` [edk2-platforms][PATCH 1/2] Platform/RPi/SmbiosDxe: Report a more human readable firmware revision Pete Batard
2020-01-20 14:08 ` Philippe Mathieu-Daudé [this message]
2020-01-08 17:00 ` [edk2-platforms][PATCH 2/2] Platform/RPi/RPiFirmwareDxe: Fix serial number population for RPi4 Pete Batard
2020-01-09 14:44 ` Ard Biesheuvel
2020-01-09 15:02 ` Pete Batard
2020-01-20 13:50 ` Pete Batard
2020-02-14 9:02 ` [edk2-platforms][PATCH 0/2] Platform/RPi: Smbios reporting improvements 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=1d1bf178-0b55-dae8-9d48-3235ff8169a5@redhat.com \
--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