Newer
Older
AMI-Aptio-BIOS-Reversed / SmbiosDataUpdateDxeCLX64L / SmbiosDataUpdateDxeCLX64L.md
@Ajax Dong Ajax Dong 2 days ago 8 KB Init

SmbiosDataUpdateDxeCLX64L

Function Table

Address Name Description
InstallSmbiosStringTable
InstallSmbiosDataTable
InstallSmbiosMemoryTable
UpdateSmbiosStringPack
SmbiosDataUpdateCallback
SmbiosDataUpdateDxeEntryPoint
Global variable definitions
UEFI handles and protocol interfaces
Driver image handle
Pointer to system table
Pointer to boot services
Pointer to runtime services
Located protocol interfaces
EFI_HII_DATABASE_PROTOCOL VOID *gHiiStringProtocol = NULL; // EFI_HII_STRING_PROTOCOL
EFI_HII_CONFIG_ROUTING_PROTOCOL VOID *gHiiConfigAccess = NULL; // EFI_HII_CONFIG_ACCESS_PROTOCOL
EFI_DRIVER_BINDING_PROTOCOL VOID *gHiiPackageList = NULL; // HII Package List Registration
Located services
EFI_DXE_SERVICES VOID *gHobList = NULL; // HOB list pointer
MM PCI Base Protocol (mPciUsra)
Protocol interfaces installed via UBA
HII string pack handle
Platform language protocol
SMBIOS protocol
Data Hub protocol
Debug mode flag (set via CMOS check)
Debug output protocol (for DEBUG/ASSERT)
CLX64L Platform SMBIOS String Table Definition
This table defines how SMBIOS string fields are mapped to HII string IDs
for the CLX64L platform. Each entry is a 10-byte record:
Bytes 0-1: HII StringId (UINT16)
Byte 2: Field type encoding
Byte 3: SMBIOS structure sub-type
Bytes 4-5: Reserved (field size/offset info)
Bytes 6-9: Reserved
A total of 22 entries are defined covering memory, cache, port, slot
onboard device, OEM, and system information SMBIOS types.
Memory Device - Type 17 fields
Physical Memory Array - Type 16 fields
Cache - Type 7 fields
Port Connector - Type 8 fields
System Slots - Type 9 fields
Onboard Device - Type 10 (or extended) fields
OEM Strings - Type 11 fields
System Information - Type 1 fields
CLX64L Platform SMBIOS Data Table Definition
This table defines the SMBIOS data update entries for SMBIOS types
layout of platform-specific binary data to be installed.
The table is indexed by the SMBIOS type groups and contains raw
SMBIOS structure data with embedded string references.
Type 0 - BIOS Information
Type 1 - System Information
Type 2 - Baseboard Information
Type 3 - System Enclosure
Type 4 - Processor Information
Type 7 - Cache Information
Type 8 - Port Connector Information
Type 9 - System Slots
CLX64L Platform SMBIOS Memory Data Table Definition
This table defines the SMBIOS data update entries for memory-related
SMBIOS types (Type 11, 17, 19, 20). These provide OEM-specific
memory configuration data and memory device mapping.
Type 11 - OEM Strings (memory-specific)
Type 17 - Memory Device
Type 19 - Memory Array Mapped Address
Type 20 - Memory Device Mapped Address
Initialize SMBIOS string structure header:
Then populate the structure from the string table entry fields
and retrieve the actual string data from the HII database.
Structure header (3 bytes)
SMBIOS type
Structure length
Unused handle
Map string table entry fields into the output buffer.
Retrieve the SMBIOS string from the HII database for all
configured languages and format it into the string pack buffer.
return EFI_SUCCESS;
Copy the platform SMBIOS data template for the specified
data table group into the output buffer. Each data table
group contains a complete SMBIOS structure including:
For CLX64L, the data table groups are:
Build the appropriate memory SMBIOS structure:
Retrieve the string from the HII database via the HII String protocol.
First query the required buffer size, then allocate and retrieve.
StringSize = 0;
Calculate total string data size by iterating through the package list.
Each package entry consists of:
PackageArray = (UINT8 )PackageList;**
Calculate string data size: total package size minus 4-byte header
StringDataSize = (UINT32 )PackageArray[Index] - 4;
Allocate the string pack buffer (24-byte header + string data)
StringPackBuffer = (UINT8 *)AllocateZeroPool (TotalSize + 24);
Initialize the string pack header:
CopyGuid ((EFI_GUID *)StringPackBuffer, PackageGuid);
Copy string data into the pack buffer, starting at offset 20
UINT8 *DestPtr = StringPackBuffer + 20;
Append the terminating 4-byte entry
Register the string pack with HII database
Status = gHiiDatabaseProtocol->NewPackageList (
Not associated with a driver handle
If no strings to update, return success
if (NumStrings == 0) {
Build the string pack by retrieving all strings sequentially.
Each string is null-terminated and concatenated into the output buffer.
The buffer format is compatible with SMBIOS string table expectations.
Retrieve each SMBIOS string from the HII database
RetrievedString = GetSmbiosString (
Grow the buffer as needed
StringBuffer = (CHAR8 *)AllocateZeroPool (TotalBufferSize + StringLen);
Copy the string data
if (CurrentOffset > 0) {
Verify the total string size does not exceed the maximum
supported by the SMBIOS string table format
if (TotalBufferSize > SMBIOS_STRING_PACK_BUFFER_SIZE) {
Allocate a working buffer for string pack construction.
The buffer must be large enough to hold the largest SMBIOS
string table entry (768 bytes).
WorkBuffer = (UINT8 *)AllocateZeroPool (SMBIOS_STRING_PACK_BUFFER_SIZE);
Phase 1: Install SMBIOS String Table Entries
Iterate through all 30 (0x1E) string table entries and install
each one by formatting the SMBIOS structure and adding string
references from the HII database.
for (Index = 0; Index < SMBIOS_MAX_STRING_ENTRIES; Index++) {
The formatted string table entry is ready for installation.
Write it to the SMBIOS table via the string pack mechanism.
UpdateSmbiosStringPack (
Phase 2: Install SMBIOS Data Table Entries
Install Type 0-9 data tables for the CLX64L platform.
for (Index = 0; Index < SMBIOS_MAX_DATA_ENTRIES; Index++) {
Phase 3: Install SMBIOS Memory Data Table Entries
Install Type 11, 17, 19, 20 memory data tables.
for (Index = 0; Index < SMBIOS_MAX_MEMORY_ENTRIES; Index++) {
This is accomplished by sending an end marker via the string
protocol to terminate the SMBIOS string pack.
FreePool (WorkBuffer);
Save the global UEFI handles
gImageHandle = ImageHandle;
Locate HII Database Protocol
Status = gBootServices->LocateProtocol (
Locate HII String Protocol
Locate HII Config Routing Protocol
Locate the DXE Services Table via the configuration table
Status = EfiGetSystemConfigurationTable (
Locate the HOB List via configuration table
Locate the MM PCI Base Protocol (for PCI configuration access)
if (gMmPciBaseProtocol == NULL) {
Register with UBA to install the CLX64L SMBIOS platform data
Status = UbaSmbiosUpdateLibRegister (

Generated by HR650X BIOS Decompilation Project