Commit 6d4fed696d004a6aeb795369aa38d4ce1d39f308 added support for
reporting AssetTag in RPi SMBIOS Types 2 and 3. The default
AssetTag is an empty string. SMBIOS does not allow empty strings to be
referenced from the corresponding string field. This caused breakage in
parsing SMBIOS Types 2 and 3 fields that follow the AssetTag field.
The issue caused an FWTS test failure, as reported in:
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpftf%2FRPi4%2Fissues%2F75&data=02%7C01%7Cawarkentin%40vmware.com%7C0eeb8c53c3b64e1e2fd008d82cd915f3%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637308658172692193&sdata=QPQN3zqWXN4JSJqMK9kN5Ntx%2BFXVZ0Hn1PI1RXxWBt8%3D&reserved=0
The fix is to detect if no AssetTag is set in the UEFI variable, and if
so, change the AssetTag SMBIOS field to an empty blank space.
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index d5fb843d43ce..6eef66f125f8 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -793,7 +793,13 @@ BoardInfoUpdateSmbiosType2 (
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to get Asset Tag: %r\n", Status));
}
- UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, sizeof(mChassisAssetTag));
+
+ if (AssetTagVar[0] == L'\0') {
+ // SMBIOS referenced strings cannot be NULL. If no AssetTag is set, default to a blank space.
+ UnicodeStrToAsciiStrS(L" ", mChassisAssetTag, sizeof(mChassisAssetTag));
+ } else {
+ UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, sizeof(mChassisAssetTag));
+ }
DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChassisAssetTag));
LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoType2Strings, NULL);
--
2.17.1