# SmbiosDataUpdateDxeLightningRidgeEXECB3

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **InternalReadUint32** |  |
|  | **InternalReadUint64** |  |
|  | **InternalWriteUint64** |  |
|  | **InternalCompareGuid** |  |
|  | **InternalAssert** |  |
|  | **InternalDebugPrint** |  |
|  | **InternalFreePool** |  |
|  | **InternalLocateConfigTable** |  |
|  | **InternalGetPlatformLanguage** |  |
|  | **BuildSmbiosType41Record** |  |
|  | **InternalUnicodeToAscii** |  |
|  | **InternalAsciiStrLen** |  |
|  | **InternalUnicodeStrSize** |  |
|  | **InternalAsciiStrSize** |  |
|  | **InternalUnicodeStrLen** |  |
|  | **IoRead8** |  |
|  | **IoWrite8** |  |
|  | **BuildAndAddSmbiosType41** |  |
|  | **GetSmbiosStructureSize** |  |
|  | **AddSmbiosRecord** |  |
|  | **UpdateSmbiosType41Entry** |  |
|  | **ProcessSlotConfiguration** |  |
|  | **InternalGetSmbiosStructureTotalSize** |  |
|  | **CallSmbiosUpdateProtocol** |  |
|  | **SmbiosDataUpdateCallback** |  |
|  | **InitializeSmbiosDataUpdateDxe** |  |
|  | **SmbiosDataUpdateEntry** |  |
|  | **UefiDriverEntryPoint** |  |
| Global | **protocol pointers obtained during initialization** |  |
| EFI_HANDLE | **gImageHandle             = NULL;** |  |
| HOB | **List pointer (obtained from DxeHobLib)** |  |
| VOID | ***mHobList                 = NULL;** |  |
| If | **HOB list is not available, this is a fatal error** |  |
| ASSERT | **(FALSE);** |  |
| Calculate | **total string data size by iterating through the UBA config** |  |
| data | **pointers (NULL-terminated array of pointers).** |  |
| StringData | **= (UINT32 *)UbaConfigData;** |  |
| Build | **the HII string package:** |  |
| Header | **(24 bytes) + string data + null terminator (4 bytes)** |  |
| PackageSize | **= TotalStringSize + 24 + 4;** |  |
| Initialize | **the HII package header with the GUID from UBA config** |  |
| InternalCopyMem | **(StringPackage, UbaConfigData, sizeof (EFI_GUID));** |  |
| Copy | **string data from the UBA config block** |  |
| StringDataSize | **= TotalStringSize;** |  |
| Copy | **string content (skip the 4-byte size prefix)** |  |
| InternalCopyMem | **(** |  |
| Append | **the double-null terminator for the string package** |  |
| Install | **the HII string package** |  |
| This | **updates the HII database with our board-specific strings.** |  |
| Status | **= gHiiDatabase->NewPackageList (** |  |
| First | **call to get the required buffer size** |  |
| BufferSize | **= 0;** |  |
| Allocate | **the buffer for the language string** |  |
| Buffer | **= InternalAllocateZeroPool (BufferSize);** |  |
| Read | **the variable** |  |
| Status | **= gRuntimeServices->GetVariable (** |  |
| Convert | **from Unicode to ASCII** |  |
| PlatformLang | **variable not found - not fatal, return EFI_NOT_FOUND** |  |
| Walk | **the supported languages list** |  |
| for | **(Match = SupportedLanguages; *Match != '\0'; ) {** |  |
| Skip | **delimiters (semicolons)** |  |
| while | **(*Match == ';') {** |  |
| Determine | **the length of this language tag** |  |
| Check | **if the language starts with a 3-letter prefix match** |  |
| or | **matches the full RFC 4646 language code** |  |
| if | **((LangLen >= 3) && (AsciiStrnCmp (Match, Lang, 3) == 0)) {** |  |
| Found | **a match - return a copy** |  |
| CHAR8 | ***LanguageString;** |  |
| SMBIOS | **Type 41 (Onboard Devices Extended Information) string table** |  |
| Each | **entry is a 10-byte record containing:** |  |
| The | **table encodes the mapping between HII string IDs and** |  |
| the | **corresponding SMBIOS Type 41 device data for this board.** |  |
| Index | **0 entry reference structure (10 bytes):** |  |
| The | **device configuration data for this board is encoded as** |  |
| a | **table of fixed-size records in the .data section.** |  |
| For | **each entry, we extract:** |  |
| These | **are resolved against the HII string package installed** |  |
| during | **initialization to produce the actual ASCII strings.** |  |
| The | **string table format is:** |  |
| struct | **{** |  |
| UINT16 | **StringId;       // +0: HII string reference** |  |
| UINT8 | **DevType;        // +2: device type** |  |
| UINT8 | **Instance;       // +3: reserved/instance** |  |
| UINT16 | **SegmentBus;     // +4: segment group (high) + bus (low)** |  |
| UINT8 | **DevFunc;        // +6: PCI device (high nibble) + function (low nibble)** |  |
| UINT8 | **Reserved;       // +7: reserved** |  |
| UINT16 | **Reserved2;      // +8: reserved** |  |
| The | **table entries are indexed differently for Type 41 (primary)** |  |
| vs | **secondary device data in the HII strings.** |  |
| For | **Type 41, the HII string reference is in a different** |  |
| format | **than for Type 9. The device string reference has** |  |
| the | **format:** |  |
| The | **string table is indexed by TableIndex and the result** |  |
| depends | **on which SMBIOS type we're building.** |  |
| resolve | **from the UBA configuration table.** |  |
| return | **EFI_UNSUPPORTED;** |  |
| SMBIOS | **Type 41 (Onboard Device) string table data for LightningRidge EX EC B3** |  |
| Each | **10-byte record encodes one onboard device's string reference and** |  |
| SMBIOS | **Type 41 fields.** |  |
| For | **Type 41 secondary entries, the string reference is 0x0000 and the** |  |
| device | **instance + bus/segment data are at different offsets.** |  |
| If | **no HII string handle is available, skip SMBIOS table creation** |  |
| if | **(gSmbiosStringPackHandle == NULL) {** |  |
| Retrieve | **the Unicode strings from HII** |  |
| if | **(FirstStringId != 0) {** |  |
| Get | **the HII string** |  |
| String1 | **= InternalAllocateZeroPool (SMBIOS_STRING_MAX_LEN);** |  |
| Convert | **from HII string to ASCII** |  |
| the | **HII String protocol to a CHAR16, then to CHAR8)** |  |
| For | **now, just copy the reference name as a placeholder** |  |
| Build | **the SMBIOS Type 41 record** |  |
| The | **formatted area includes:** |  |
| return | **Status;** |  |
| count | **the double-null terminator** |  |
| Remove | **existing entries of this type to allow replacing data.** |  |
| The | **SMBIOS protocol's Remove function will be called for each** |  |
| existing | **entry.** |  |
| SmbiosHandle | **= SMBIOS_HANDLE_PI_RESERVED;** |  |
| Extract | **device type and PCI address from the configuration data.** |  |
| The | **configuration table at sub_77C uses board-specific values** |  |
| derived | **from string table entries.** |  |
| For | **each entry (0..29):** |  |
| primary | **device designation and secondary/alternate)** |  |
| The | **record is built and submitted to the SMBIOS protocol.** |  |
| Build | **and add the primary record** |  |
| Status | **= BuildAndAddSmbiosType41 (** |  |
| First | **string ID from config** |  |
| If | **a secondary device string is defined (non-zero string ID)** |  |
| build | **and add the secondary record too.** |  |
| Parse | **the configuration table entry.** |  |
| Each | **entry encodes the SMBIOS slot/device parameters for** |  |
| the | **LightningRidge EX EC B3 board layout:** |  |
| For | **Type 41 entries:** |  |
| The | **secondary string is tested separately. If it exists** |  |
| a | **second SMBIOS entry is created with the alternate string.** |  |
| Status | **= gHiiString->GetString (** |  |
| Walk | **strings until we hit double-null** |  |
| while | **(TRUE) {** |  |
| Call | **through the SmbiosUpdate protocol entry point.** |  |
| The | **protocol's function pointer is at offset +16.** |  |
| Status | **= UpdateProtocol->Callback (** |  |
| Allocate | **a working buffer for building SMBIOS records** |  |
| with | **multiple strings).** |  |
| SmbiosBuffer | **= InternalAllocateZeroPool (SMBIOS_RECORD_MAX_SIZE);** |  |
| Phase | **1: Update SMBIOS Type 41 entries (Onboard Devices Extended)** |  |
| The | **board has 30 onboard device entries with associated HII strings.** |  |
| for | **(Index = 0; Index < SMBIOS_TYPE41_ENTRY_COUNT; Index++) {** |  |
| Phase | **2: Update SMBIOS Type 9 entries (System Slots)** |  |
| Update | **8 system slot definitions for this board.** |  |
| for | **(Index = 0; Index < SMBIOS_TYPE9_ENTRY_COUNT; Index++) {** |  |
| Build | **SMBIOS Type 9 record...** |  |
| Phase | **3: Update SMBIOS Type 43 entries (TPM Device)** |  |
| TPM | **device configuration for this board variant.** |  |
| for | **(Index = 0; Index < SMBIOS_TYPE43_ENTRY_COUNT; Index++) {** |  |
| Build | **SMBIOS Type 43 record...** |  |
| Cleanup | **//** |  |
| Step | **1: Save ImageHandle and SystemTable** |  |
| gImageHandle | **= ImageHandle;** |  |
| Step | **2: Locate HII Database protocol** |  |
| Status | **= gBootServices->LocateProtocol (** |  |
| Step | **3: Locate HII String protocol** |  |
| Step | **4: Locate HII Config Routing protocol** |  |
| Step | **5: Locate HII Font protocol** |  |
| Step | **6: Locate HII Runtime protocol** |  |
| Step | **7: Locate the DxeServicesTable from the system configuration table** |  |
| Status | **= InternalLocateConfigTable (&gDxeServicesTableGuid, &gDs);** |  |
| Step | **8: Initialize HOB list pointer** |  |
| mHobList | **= InternalGetHobList ();** |  |
| Step | **9: Locate the MM PCI Base protocol for memory-mapped PCI access** |  |
| if | **(mPciUsra == NULL) {** |  |
| Step | **1: Initialize the driver (locate protocols, etc.)** |  |
| Status | **= InitializeSmbiosDataUpdateDxe (ImageHandle, SystemTable);** |  |
| Step | **2: Display the board GUID for debugging** |  |
| DEBUG | **((EFI_D_INFO, "UBA:SmbiosDataUpdateEntry Image GUID=%g\n", &gSmbiosDataUpdateBoardGuid));** |  |
| Step | **3: Install the HII string package for this board** |  |
| gSmbiosStringPackHandle | **= InternalInstallSmbiosStringPack (** |  |
| Step | **4: Look up the UBA SMBIOS Update protocol** |  |
| Locate | **the UBA SMBIOS Update protocol** |  |
| Step | **5: Register the callback with the UBA framework** |  |
| The | **UBA SMBIOS Update protocol provides a callback registration** |  |
| entry | **at offset +16 in the protocol structure. It takes:** |  |
| Status | **= gSmbiosUpdateProtocol->Callback (** |  |

---
*Generated by HR650X BIOS Decompilation Project*