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://github.com/pftf/RPi4/issues/75 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 <l...@nuviainc.com> Cc: Pete Batard <p...@akeo.ie> Cc: Andrei Warkentin <awarken...@vmware.com> Cc: Ard Biesheuvel <ard.biesheu...@arm.com> Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahm...@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 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#62857): https://edk2.groups.io/g/devel/message/62857 Mute This Topic: https://groups.io/mt/75687844/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-