Topics

[edk2-platforms][PATCH v2 1/1] Platforms/RaspberryPi: Fix BIOS Release Date and System Manufacturer


Pete Batard
 

Per SMBIOS specs, The Type 0 BIOS Release Date is not a free form field but
must be specified in a US middle-endian format (mm/dd/yyyy), so make sure
we populate it accordingly by using the recently introduced TimeBaseLib
macros. This is required for platforms like Windows, that fail to parse the
date otherwise.

Also, the system manufacturer should not be set to the same value as the
board manufacturer for the Type 1 strings, as, on the Raspberry Pi, this is
not representative of the actual manufacturer of the system, which is the
Raspberry Pi Foundation always.

Signed-off-by: Pete Batard <@pbatard>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index d5fb843d43ce..ff7203585acb 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -119,11 +119,12 @@ SMBIOS_TABLE_TYPE0 mBIOSInfoType0 = {

CHAR8 mBiosVendor[128] = "EDK2";
CHAR8 mBiosVersion[128] = "EDK2-DEV";
+CHAR8 mBiosDate[12] = "00/00/0000";

CHAR8 *mBIOSInfoType0Strings[] = {
mBiosVendor, // Vendor
mBiosVersion, // Version
- __DATE__ " " __TIME__, // Release Date
+ mBiosDate, // Release Date
NULL
};

@@ -149,7 +150,7 @@ CHAR8 mSysInfoSerial[sizeof (UINT64) * 2 + 1];
CHAR8 mSysInfoSKU[sizeof (UINT64) * 2 + 1];

CHAR8 *mSysInfoType1Strings[] = {
- mSysInfoManufName,
+ "Raspberry Pi Foundation",
mSysInfoProductName,
mSysInfoVersionName,
mSysInfoSerial,
@@ -626,6 +627,9 @@ BIOSInfoUpdateSmbiosType0 (
INTN i;
INTN State = 0;
INTN Value[2];
+ INTN Year = TIME_BUILD_YEAR;
+ INTN Month = TIME_BUILD_MONTH;
+ INTN Day = TIME_BUILD_DAY;

// Populate the Firmware major and minor.
Status = mFwProtocol->GetFirmwareRevision (&EpochSeconds);
@@ -648,6 +652,10 @@ BIOSInfoUpdateSmbiosType0 (
mBiosVendor, sizeof (mBiosVendor));
UnicodeStrToAsciiStrS ((CHAR16*)PcdGetPtr (PcdFirmwareVersionString),
mBiosVersion, sizeof (mBiosVersion));
+ ASSERT (Year >= 0 && Year <= 9999);
+ ASSERT (Month >= 1 && Month <= 12);
+ ASSERT (Day >= 1 && Day <= 31);
+ AsciiSPrint (mBiosDate, sizeof (mBiosDate), "%02d/%02d/%04d", Month, Day, Year);

// Look for a "x.y" numeric string anywhere in mBiosVersion and
// try to parse it to populate the BIOS major and minor.
--
2.21.0.windows.1


Leif Lindholm
 

On Mon, Aug 03, 2020 at 13:14:26 +0100, Pete Batard wrote:
Per SMBIOS specs, The Type 0 BIOS Release Date is not a free form field but
must be specified in a US middle-endian format (mm/dd/yyyy), so make sure
we populate it accordingly by using the recently introduced TimeBaseLib
macros. This is required for platforms like Windows, that fail to parse the
date otherwise.

Also, the system manufacturer should not be set to the same value as the
board manufacturer for the Type 1 strings, as, on the Raspberry Pi, this is
not representative of the actual manufacturer of the system, which is the
Raspberry Pi Foundation always.

Signed-off-by: Pete Batard <@pbatard>
Reviewed-by: Leif Lindholm <leif@...>

Pushed as 0f08b94dbdf0.
Thanks!

---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index d5fb843d43ce..ff7203585acb 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -119,11 +119,12 @@ SMBIOS_TABLE_TYPE0 mBIOSInfoType0 = {

CHAR8 mBiosVendor[128] = "EDK2";
CHAR8 mBiosVersion[128] = "EDK2-DEV";
+CHAR8 mBiosDate[12] = "00/00/0000";

CHAR8 *mBIOSInfoType0Strings[] = {
mBiosVendor, // Vendor
mBiosVersion, // Version
- __DATE__ " " __TIME__, // Release Date
+ mBiosDate, // Release Date
NULL
};

@@ -149,7 +150,7 @@ CHAR8 mSysInfoSerial[sizeof (UINT64) * 2 + 1];
CHAR8 mSysInfoSKU[sizeof (UINT64) * 2 + 1];

CHAR8 *mSysInfoType1Strings[] = {
- mSysInfoManufName,
+ "Raspberry Pi Foundation",
mSysInfoProductName,
mSysInfoVersionName,
mSysInfoSerial,
@@ -626,6 +627,9 @@ BIOSInfoUpdateSmbiosType0 (
INTN i;
INTN State = 0;
INTN Value[2];
+ INTN Year = TIME_BUILD_YEAR;
+ INTN Month = TIME_BUILD_MONTH;
+ INTN Day = TIME_BUILD_DAY;

// Populate the Firmware major and minor.
Status = mFwProtocol->GetFirmwareRevision (&EpochSeconds);
@@ -648,6 +652,10 @@ BIOSInfoUpdateSmbiosType0 (
mBiosVendor, sizeof (mBiosVendor));
UnicodeStrToAsciiStrS ((CHAR16*)PcdGetPtr (PcdFirmwareVersionString),
mBiosVersion, sizeof (mBiosVersion));
+ ASSERT (Year >= 0 && Year <= 9999);
+ ASSERT (Month >= 1 && Month <= 12);
+ ASSERT (Day >= 1 && Day <= 31);
+ AsciiSPrint (mBiosDate, sizeof (mBiosDate), "%02d/%02d/%04d", Month, Day, Year);

// Look for a "x.y" numeric string anywhere in mBiosVersion and
// try to parse it to populate the BIOS major and minor.
--
2.21.0.windows.1