# UbaConfigDatabaseDxe

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **UbaConfigDatabaseGetInfo** |  |
|  | **UbaConfigDatabaseSetData** |  |
|  | **UbaConfigDatabaseGetData** |  |
|  | **ReadUnaligned64** |  |
|  | **AssertPrint** |  |
|  | **DebugPrint** |  |
|  | **InternalBaseLibIsListValid** |  |
|  | **AsciiStrLen** |  |
|  | **AsciiStrnLenS** |  |
|  | **UbaConfigDatabaseGetListNode** |  |
|  | **UbaConfigDatabaseNodeInit** |  |
|  | **CompareGuid** |  |
|  | **AsciiStrCpyS** |  |
|  | **AsciiStrnCpyS** |  |
|  | **UbaConfigDatabaseDxeEntry** |  |
|  | **UbaConfigDatabaseInstallDriver** |  |
|  | **UbaConfigDatabaseLoadFromHob** |  |
|  | **UbaConfigDatabaseSetDataDispatch** |  |
|  | **UbaConfigDatabaseGetDataDispatch** |  |
|  | **UbaConfigDatabaseFindData** |  |
|  | **ModuleEntryPoint** |  |
| Include | **UEFI types** |  |
| typedef | **unsigned long long  UINT64;** |  |
| EFI_STATUS | **codes** |  |
| EFI_GUID | **structure (16 bytes)** |  |
| typedef | **struct {** |  |
| EFI_SYSTEM_TABLE | **(abbreviated for this module)** |  |
| 0x00 | **- 0x5F: header, firmware vendor, etc.** |  |
| 0x60 | **VOID             *RuntimeServices; // 0x68** |  |
| EFI_BOOT_SERVICES | **(function table at offset 0x60 from SystemTable)** |  |
| Only | **the entries used by this module are defined.** |  |
| 0x00 | **- 0x17: RaiseTPL, RestoreTPL, AllocatePages, FreePages** |  |
| 0x18 | **UINT64   (*AllocatePool)(UINTN PoolType, UINTN Size, VOID **Buffer); // 0x20 (index 4)** |  |
| 0x28 | **char     _pad1[0x18];          // 0x30 - 0x47** |  |
| 0x48 | **(index 9)** |  |
| 0x50 | **- 0x87** |  |
| 0x88 | **(index 17)** |  |
| 0x90 | **- 0xD7** |  |
| 0xD8 | **(index 27)** |  |
| 0xE0 | **- 0xFF** |  |
| EFI_RUNTIME_SERVICES | **(function table at offset 0x68 from SystemTable)** |  |
| LIST_ENTRY | **- standard UEFI doubly-linked list** |  |
| typedef | **struct _LIST_ENTRY {** |  |
| UBA_CONFIG_NODE | **- a single configuration data node in the linked list** |  |
| Structure | **layout:** |  |
| 0x04 | **LIST_ENTRY Link;             // 0x08** |  |
| 0x18 | **EFI_GUID   ConfigGuid;       // 0x1C** |  |
| 0x2C | **UINT32     ConfigDataSize;   // 0x3C** |  |
| 0x40 | **UINT32     NodeCount;        // 0x48** |  |
| UBA_CONFIG_DATABASE_PRIVATE | **- private structure for the config database** |  |
| 0x08 | **UINT64   ConfigCount;         // 0x10** |  |
| 0x18 | **EFI_GUID ConfigGuid;          // 0x1C** |  |
| Protocol | **interface starts here** |  |
| 0x2C | **EFI_STATUS (*SetData)(VOID *This, EFI_GUID *ConfigGuid, VOID *ConfigData, UINTN ConfigDataSize);   // 0x34** |  |
| 0x3C | **} UBA_CONFIG_DATABASE_PRIVATE;** |  |
| HOB | **(Hand-Off Block) structures** |  |
| 0x00 | **UINT16  HobLength;    // 0x02** |  |
| 0x04 | **} EFI_HOB_HEADER;       // Total: 8 bytes** |  |
| 0x00 | **UINT32             DataCount;   // 0x10: number of config entries** |  |
| followed | **by per-entry data starting at offset 0x14 (0x14 + 4 = 0x18 if 1st entry)** |  |
| UBA | **config HOB per-entry structure (36 bytes each)** |  |
| Each | **entry has a relative offset to data + data size** |  |
| EFI | **SYSTEM TABLE globals (assigned by _ModuleEntryPoint)** |  |
| extern | **UINTN     ImageHandle;** |  |
| Module | **globals** |  |
| EFI_HANDLE | **mImageHandle;** |  |
| Globals | **for this module** |  |
| VOID | ***mDebugProtocol;        // 0x1F50: cached debug logging protocol** |  |
| 0x1F10 | **EFI_GUID      gUbaConfigHobGuid = {0xCC4CC9E4, 0x4E5EF25B, 0x252CFB26, 0x8D8D8D8D}; // 0x1F20 (example - not exact)** |  |
| Forward | **declarations** |  |
| Overlapping | **case: source is before destination and overlaps** |  |
| copy | **from end to start (backward copy not shown, IDA optimizes to same)** |  |
| return | **InternalCopyMemBackward(Dst, Src, Count);** |  |
| UINTN | **Count8 = Count >> 3;** |  |
| Read | **CMOS status register to determine debug level** |  |
| EFI_D_INFO | **break;** |  |
| EFI_D_ERROR | **| EFI_D_INFO** |  |
| UBA_CONFIG_DATABASE_PRIVATE | **helper: CR-based node access** |  |
| CR | **= CONTAINER_RECORD macro: from a member pointer, get the containing struct** |  |
| Initialize | **linked list entry to point to itself (empty list)** |  |
| GUID | **for HOB list** |  |
| each | **entry = GUID + Address (3 UINT64s)** |  |
| Check | **if debug is available via CMOS diagnostic port** |  |
| Check | **overlap** |  |
| if | **(Source > Destination && Source < &Destination[DestMax]) {** |  |
| Initialize | **private structure** |  |
| Set | **protocol GUID (0x504C4342 = "BCLP")** |  |
| This | **is the UBA protocol GUID data that identifies this interface** |  |
| Load | **initial configuration from HOB** |  |
| Status | **= UbaConfigDatabaseLoadFromHob(&Private->ConfigGuid);** |  |
| Install | **the protocol interface** |  |
| Handle | **= NULL;** |  |
| Signature | **check - will ASSERT if invalid** |  |
| GUID | **to search for in HOB (target config HOB)** |  |
| Initialize | **the config database with data from HOB** |  |
| Status | **= UbaConfigDatabaseNodeInit(** |  |
| First | **config GUID data** |  |
| Config | **name** |  |
| Process | **each config entry in the HOB** |  |
| if | **(Hob->DataCount > 0) {** |  |
| Already | **the right pointer from CR macro** |  |
| Allocate | **and initialize a new config node** |  |
| Node | **= AllocatePool((UINTN)This, 60);** |  |
| Copy | **the GUID data** |  |
| Store | **the GUID** |  |
| Set | **GUID from parameter** |  |
| Insert | **into linked list** |  |
| Update | **counters** |  |
| This | **+ 0x24 from CR macro** |  |
| Walk | **the linked list looking for a matching GUID** |  |
| if | **(!InternalBaseLibIsListValid(ListHead)) return EFI_NOT_FOUND;** |  |
| Found | **a matching node, copy data if buffer is large enough** |  |
| if | **(ConfigDataSize) {** |  |
| Get | **the HOB list (for later config loading)** |  |
| Install | **the UBA config database protocol** |  |
| return | **UbaConfigDatabaseInstallDriver(ImageHandle, SystemTable);** |  |

---
*Generated by HR650X BIOS Decompilation Project*