# SlotDataUpdateDxeLightningRidgeEXRP

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **GetSlotCount** |  |
|  | **GetSlotData** |  |
|  | **UbaDebugPrint** |  |
|  | **UbaDebugAssert** |  |
|  | **ReadUnaligned64** |  |
|  | **IsHobGuidMatch** |  |
|  | **InstallSlotData** |  |
|  | **SlotDataUpdateDxeEntryPoint** |  |
| GUID | **Definitions (stored in .rdata section)** |  |
| EFI_GUID | **gUbaProtocolGuid          = UBA_PROTOCOL_GUID;** |  |
| Global | **Variables** |  |
| EFI_HANDLE | **gImageHandle      = NULL;  ///< 0xBF8: Image handle from entry point** |  |
| Platform | **Slot Data (embedded in .data section)** |  |
| Two | **PSLT entries are defined statically and registered with the UBA protocol** |  |
| during | **initialization.** |  |
| PSLT | **Entry 1 (at 0xBB0, 40 bytes):** |  |
| PSLT | **Entry 2 (at 0xBD8, 32 bytes):** |  |
| The | **function pointers at offsets 16 and 32 within Entry 1, and offset 16** |  |
| within | **Entry 2, are IMAGE_REL_BASED_DIR64 fixups applied by the PE loader** |  |
| at | **runtime to relocate from RVA to absolute address.** |  |
| PSLT | **Entry 1 (at 0xBB0, size 40): Primary PSLT with GetSlotCount + GetSlotData** |  |
| PSLT | **Entry 2 (at 0xBD8, size 32): Secondary PSLT with GetSlotCount only** |  |
| Function | **Implementations** |  |
| LightningRidge | **EXRP platform has exactly 2 slots.** |  |
| return | **2;** |  |
| Pass | **through the default slot data unchanged.** |  |
| No | **platform-specific slot data remapping is needed.** |  |
| return | **DefaultData;** |  |
| Return | **cached protocol if already located.** |  |
| if | **(gUbaProtocol != NULL) {** |  |
| Check | **current TPL level by raising to TPL_HIGH_LEVEL and restoring.** |  |
| If | **the old TPL was above TPL_NOTIFY (0x10), we cannot safely call** |  |
| LocateProtocol | **(which may block/allocate memory).** |  |
| TPL | **too high for LocateProtocol - skip and return NULL.** |  |
| return | **NULL;** |  |
| Locate | **the UBA protocol using its GUID.** |  |
| No | **registration key** |  |
| Read | **platform type from RTC CMOS register 0x4B.** |  |
| PlatformType | **= IoRead8 (RTC_CMOS_ADDRESS_PORT);** |  |
| Determine | **debug routing based on platform type.** |  |
| if | **(N3 > 3) {** |  |
| N3 | **is in the valid platform type range (4-255), use as-is.** |  |
| No | **routing change needed.** |  |
| Platform | **type 0: read hardware strap from fixed memory address.** |  |
| Bit | **1 of the strap byte indicates debug capability.** |  |
| N3 | **= (*(volatile UINT8 *)PLATFORM_STRAP_ADDRESS & 0x02) | 0x01;** |  |
| N3 | **values 1, 2, 3: use directly (valid)** |  |
| Map | **the platform type to a debug route value.** |  |
| N3 | **of 0 would have been remapped above, so 1+ is expected.** |  |
| if | **((N3 - 1) <= 0xFD) {** |  |
| Valid | **range: N3 is 1 to 255 (effectively all non-zero values).** |  |
| if | **(N3 == 1) {** |  |
| 0x80000004 | **} else {** |  |
| 0x80000006 | **}** |  |
| If | **the debug level matches the computed route mask, forward the message.** |  |
| if | **((DebugRoute & DebugLevel) != 0) {** |  |
| UBA | **protocol function index 1 (offset 0x08): DebugPrint** |  |
| The | **function is called with (Severity, FormatString, VaList).** |  |
| UbaDebugFunc | **= (UINT64 (*)(UINT64, CHAR8 *, UINT64 *))** |  |
| Get | **the UBA protocol and call its assert handler.** |  |
| The | **assert handler is at the same function index as DebugPrint** |  |
| if | **(UbaGetProtocolInterface () != NULL) {** |  |
| Read | **each GUID as two unaligned 64-bit values and compare.** |  |
| Guid1Low | **= ReadUnaligned64 (Guid1);** |  |
| SystemTable | **+ 0x68 (104) = NumberOfTableEntries** |  |
| SystemTable | **+ 0x70 (112) = ConfigurationTable pointer** |  |
| HobCount | **= *(UINTN *)((UINT8 *)gSystemTable + 104);** |  |
| Walk | **the configuration table to find the DXE Services HOB entry.** |  |
| for | **(Index = 0; Index < HobCount; Index++) {** |  |
| Found | **the DXE Services HOB - cache its VendorTable pointer.** |  |
| gHobList | **= *(VOID **)(HobEntries + Index * sizeof(EFI_CONFIGURATION_TABLE) + sizeof(EFI_GUID));** |  |
| DXE | **Services HOB not found - report error.** |  |
| UbaDebugPrint | **(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n");** |  |
| Print | **debug banner identifying this module.** |  |
| UbaDebugPrint | **(0x80000000LL, "UBA:SlotDataUpdate-TypeLightningRidgeEXRP\n");** |  |
| Locate | **the UBA protocol interface.** |  |
| Status | **= gBootServices->LocateProtocol (** |  |
| UBA | **protocol GUID** |  |
| Retrieve | **the UBA SetData function at protocol index 2 (offset 0x10).** |  |
| VOID | ***Data, UINTN DataSize)** |  |
| UbaSetData | **= (UINT64 (*)(VOID *, EFI_GUID *, VOID *, UINT64))** |  |
| Register | **PSLT Entry 1: Primary slot table with GetSlotCount + GetSlotData.** |  |
| Status | **= UbaSetData (UbaProtocol, &gUbaSlotDataPsl1Guid, (VOID *)mPslEntry1, 40);** |  |
| Register | **PSLT Entry 2: Secondary slot table with GetSlotCount only.** |  |
| Status | **= UbaSetData (UbaProtocol, &gUbaSlotDataPsl2Guid, (VOID *)mPslEntry2, 32);** |  |
| Cache | **UEFI global variables.** |  |
| gImageHandle | **= ImageHandle;** |  |
| Retrieve | **the HOB list (cached globally in gHobList).** |  |
| GetHobList | **();** |  |
| Install | **platform-specific slot data via UBA protocol.** |  |
| Status | **= InstallSlotData ();** |  |

---
*Generated by HR650X BIOS Decompilation Project*