From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web10.10818.1579529314808635122 for ; Mon, 20 Jan 2020 06:08:35 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CPuI73Gj; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579529313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4yhjPc58+XkU0v4PSiDROebAVf6pcyNjnLzJdy5R4ac=; b=CPuI73Gj1DMrx0QlvmVRb5rIzg8+E44QOfGs7EMfUafkcwmIU3csFRcNqeM58U3c+3nkFs qZrnyZBHJLfYJ0tDAl7cCBFiT8VA6/irVxQ4HUYS70Gcink98N4NPp9MkdUU3QXFhUUQGt 4EY7KKpSUBemZ2urQ+oSVk4+RTWddU8= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-305-cun8LsCOPEqaq55AIejVGg-1; Mon, 20 Jan 2020 09:08:30 -0500 Received: by mail-wr1-f71.google.com with SMTP id f10so14249699wro.14 for ; Mon, 20 Jan 2020 06:08:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4yhjPc58+XkU0v4PSiDROebAVf6pcyNjnLzJdy5R4ac=; b=rsh0TOqnphGjjV3Na63KyI816U6BT2g0xUx7IjGKbjSyXCcHKs3CiWUcPiiGr8yFDg QkNJH0IWvRcgVG1TugnzIKI6vyEli/0V3De4ztd6UFXZwsd5ig8Gi/u3XKv/VhE7UQzl XmCa6K8kIJTp5QEBbGlQinj+lCA+7M1xnCiiGntrUXmnetzVU/c5KzheUs+zERyF+ZPW qhvD70Qw7fQdVgQ0kVmkMo/fhXpWhTDB+M8Q02c1rB4l7WnA3KHmyQPeLYPLzyck0h38 oV8xfBvvZ+nWVlr6vQZHSYzkq2qpU5E1WlFcEgS2yKrHvLkvFWNNJMe0QDvzShwD0jRY bnkg== X-Gm-Message-State: APjAAAWMyIfJqpgQRYM67Td8EJBQr1ldmO/xRbI3D1R7+2N1RCBpxi/6 JdjTBKGhJomzEepLSPVWD1NDVPGAFmD/XIY+x7A4W1LEf8XD55KU5hvuaTwbjm7W1mnQs4kMFaV rN8lQT/ne2A5eYw== X-Received: by 2002:adf:ca07:: with SMTP id o7mr17975369wrh.49.1579529309226; Mon, 20 Jan 2020 06:08:29 -0800 (PST) X-Google-Smtp-Source: APXvYqz/xWTcDUIVXfEYA72FAf1zrxpsifQQ+RuiF3iIRo+QLOFXVZ9EnK74FGFUbuS5Boa9nV+ScQ== X-Received: by 2002:adf:ca07:: with SMTP id o7mr17975340wrh.49.1579529308855; Mon, 20 Jan 2020 06:08:28 -0800 (PST) Return-Path: Received: from [192.168.1.35] (113.red-83-57-172.dynamicip.rima-tde.net. [83.57.172.113]) by smtp.gmail.com with ESMTPSA id n3sm299693wmc.27.2020.01.20.06.08.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Jan 2020 06:08:28 -0800 (PST) Subject: Re: [edk2-platforms][PATCH 1/2] Platform/RPi/SmbiosDxe: Report a more human readable firmware revision To: Pete Batard , devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org References: <20200108170004.6680-1-pete@akeo.ie> <20200108170004.6680-2-pete@akeo.ie> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: <1d1bf178-0b55-dae8-9d48-3235ff8169a5@redhat.com> Date: Mon, 20 Jan 2020 15:08:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200108170004.6680-2-pete@akeo.ie> X-MC-Unique: cun8LsCOPEqaq55AIejVGg-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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 > --- > 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 > #include > #include > +#include > #include > #include > > @@ -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