From 08dd5e921c26ad819bbf05a71b2f83bf5223f88c Mon Sep 17 00:00:00 2001 From: Rebecca Cran Date: Wed, 24 Jun 2026 18:05:24 -0600 Subject: [PATCH] ArmPkg: Add SMBIOS Type 4 SocketType handling The SMBIOS Type 4 field SocketType was added in commit 7f505d377b44aeee59f34b3d898f6caf0a0df538 in 2024. This caused the table size to be invalid when platforms specify versions of SMBIOS before 3.8. Update ProcessorSubClassDxe to handle fetching the string for the socket type including calling into OemMiscLib to retrieve it. Signed-off-by: Rebecca Cran --- ArmPkg/ArmPkg.dec | 1 + ArmPkg/Include/Library/OemMiscLib.h | 1 + .../ProcessorSubClassDxe/ProcessorSubClass.c | 29 +++++++++++++++++-- .../ProcessorSubClassDxe.inf | 1 + .../ProcessorSubClassStrings.uni | 1 + 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index 7f869f03e7..67ce5ff1a6 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -166,6 +166,7 @@ gArmTokenSpaceGuid.PcdProcessorSerialNumber|L""|VOID*|0x30000073 gArmTokenSpaceGuid.PcdProcessorAssetTag|L""|VOID*|0x30000074 gArmTokenSpaceGuid.PcdProcessorPartNumber|L""|VOID*|0x30000075 + gArmTokenSpaceGuid.PcdProcessorSocketType|L""|VOID*|0x30000076 # # ARM L2x0 PCDs diff --git a/ArmPkg/Include/Library/OemMiscLib.h b/ArmPkg/Include/Library/OemMiscLib.h index 240e0307ec..054e82fa98 100644 --- a/ArmPkg/Include/Library/OemMiscLib.h +++ b/ArmPkg/Include/Library/OemMiscLib.h @@ -60,6 +60,7 @@ typedef enum { ProcessorPartNumType04, ProcessorSerialNumType04, ProcessorVersionType04, + ProcessorSocketTypeType04, SmbiosHiiStringFieldMax } OEM_MISC_SMBIOS_HII_STRING_FIELD; diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c index b49caaab45..416e6fb166 100644 --- a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c +++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c @@ -104,7 +104,9 @@ SMBIOS_TABLE_TYPE4 mSmbiosProcessorTableTemplate = { ProcessorFamilyARM, // ProcessorFamily2 0, // CoreCount2 0, // EnabledCoreCount2 - 0 // ThreadCount2 + 0, // ThreadCount2 + 0, // ThreadEnabled + 7 // SocketType }; /** Sets the HII variable `StringId` is `Pcd` isn't empty. @@ -495,12 +497,14 @@ AllocateType4AndSetProcessorInformationStrings ( EFI_STRING_ID SerialNumber; EFI_STRING_ID AssetTag; EFI_STRING_ID PartNumber; + EFI_STRING_ID SocketType; EFI_STRING ProcessorStr; EFI_STRING ProcessorManuStr; EFI_STRING ProcessorVersionStr; EFI_STRING SerialNumberStr; EFI_STRING AssetTagStr; EFI_STRING PartNumberStr; + EFI_STRING SocketTypeStr; CHAR8 *OptionalStrStart; CHAR8 *StrStart; UINTN ProcessorStrLen; @@ -509,6 +513,7 @@ AllocateType4AndSetProcessorInformationStrings ( UINTN SerialNumberStrLen; UINTN AssetTagStrLen; UINTN PartNumberStrLen; + UINTN SocketTypeStrLen; UINTN TotalSize; UINTN StringBufferSize; @@ -519,12 +524,14 @@ AllocateType4AndSetProcessorInformationStrings ( SerialNumberStr = NULL; AssetTagStr = NULL; PartNumberStr = NULL; + SocketTypeStr = NULL; ProcessorManu = STRING_TOKEN (STR_PROCESSOR_MANUFACTURE); ProcessorVersion = STRING_TOKEN (STR_PROCESSOR_VERSION); SerialNumber = STRING_TOKEN (STR_PROCESSOR_SERIAL_NUMBER); AssetTag = STRING_TOKEN (STR_PROCESSOR_ASSET_TAG); PartNumber = STRING_TOKEN (STR_PROCESSOR_PART_NUMBER); + SocketType = STRING_TOKEN (STR_PROCESSOR_SOCKET_TYPE); SET_HII_STRING_IF_PCD_NOT_EMPTY (PcdProcessorManufacturer, ProcessorManu); SET_HII_STRING_IF_PCD_NOT_EMPTY (PcdProcessorAssetTag, AssetTag); @@ -547,6 +554,12 @@ AllocateType4AndSetProcessorInformationStrings ( OemUpdateSmbiosInfo (mHiiHandle, ProcessorVersion, ProcessorVersionType04); } + if (StrLen ((CHAR16 *)FixedPcdGetPtr (PcdProcessorSocketType)) > 0) { + HiiSetString (mHiiHandle, SocketType, (CHAR16 *)FixedPcdGetPtr (PcdProcessorSocketType), NULL); + } else { + OemUpdateSmbiosInfo (mHiiHandle, SocketType, ProcessorSocketTypeType04); + } + // Processor Designation StringBufferSize = sizeof (CHAR16) * SMBIOS_STRING_MAX_LENGTH; ProcessorStr = AllocateZeroPool (StringBufferSize); @@ -581,13 +594,17 @@ AllocateType4AndSetProcessorInformationStrings ( PartNumberStr = HiiGetPackageString (&gEfiCallerIdGuid, PartNumber, NULL); PartNumberStrLen = StrLen (PartNumberStr); + SocketTypeStr = HiiGetPackageString (&gEfiCallerIdGuid, SocketType, NULL); + SocketTypeStrLen = StrLen (SocketTypeStr); + TotalSize = sizeof (SMBIOS_TABLE_TYPE4) + ProcessorStrLen + 1 + ProcessorManuStrLen + 1 + ProcessorVersionStrLen + 1 + SerialNumberStrLen + 1 + AssetTagStrLen + 1 + - PartNumberStrLen + 1 + 1; + PartNumberStrLen + 1 + + SocketTypeStrLen + 1 + 1; *Type4Record = AllocateZeroPool (TotalSize); if (*Type4Record == NULL) { @@ -639,6 +656,13 @@ AllocateType4AndSetProcessorInformationStrings ( PartNumberStrLen + 1 ); + StrStart += PartNumberStrLen + 1; + UnicodeStrToAsciiStrS ( + SocketTypeStr, + StrStart, + SocketTypeStrLen + 1 + ); + Exit: FreePool (ProcessorStr); FreePool (ProcessorManuStr); @@ -646,6 +670,7 @@ Exit: FreePool (SerialNumberStr); FreePool (AssetTagStr); FreePool (PartNumberStr); + FreePool (SocketTypeStr); return Status; } diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf index 939efe6553..79d20399c6 100644 --- a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf +++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf @@ -55,6 +55,7 @@ gArmTokenSpaceGuid.PcdProcessorSerialNumber gArmTokenSpaceGuid.PcdProcessorAssetTag gArmTokenSpaceGuid.PcdProcessorPartNumber + gArmTokenSpaceGuid.PcdProcessorSocketType [Guids] diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassStrings.uni b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassStrings.uni index c67706ecd1..fd6d80cd1d 100644 --- a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassStrings.uni +++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassStrings.uni @@ -21,4 +21,5 @@ #string STR_PROCESSOR_SERIAL_NUMBER #language en-US "Not Specified" #string STR_PROCESSOR_ASSET_TAG #language en-US "Not Specified" #string STR_PROCESSOR_PART_NUMBER #language en-US "Not Specified" +#string STR_PROCESSOR_SOCKET_TYPE #language en-US "Not Specified" #string STR_PROCESSOR_UNKNOWN #language en-US "Unknown"