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

SlotDataUpdateDxeLightningRidgeEXECB2

Function Table

Address Name Description
GetSlotCount
UbaDebugPrint
UbaDebugAssert
ReadUnaligned64
IsHobGuidMatch
InstallSlotData
_ModuleEntryPoint
GUID Definitions
Global Variables
Platform Slot Data (PSLT entries embedded in .data section)
The PSLT entries are stored statically in the .data section and registered
with the UBA protocol during initialization. They define the PCIe slot layout
for the LightningRidge EXEC B2 platform.
PSLT_HEADER layout:
Offset Size Field
0 4 Signature ("PSLT" = 0x544C5350)
4 4 Version (1)
8 4 TotalDataSize (total PSLT data size in bytes)
12 4 SlotCountFunc (RVA of GetSlotCount function)
16 4 Reserved (pad)
20 4 SlotDataFunc (RVA of GetSlotData function)
24 8 ConfigData (platform slot config flags)
Function Implementations
Return cached protocol if already located (lazy init check).
if (gUbaProtocol != NULL) {
Allocate a small test buffer to verify pool availability.
Size 31 = 0x1F bytes via gBS->AllocatePool (BootServices + 24).
This is a probe to verify the UEFI memory system is operational.
Check if AllocatePool succeeded by verifying it returned > 0x10.
if (TestBufferSize <= 0x10) {
Locate the UBA protocol using LocateProtocol (BootServices + 320 = 0x140).
Get the UBA protocol interface (lazy init through cached result).
Uba = UbaGetProtocolInterface ();
Read platform type from RTC CMOS register 0x4B.
We preserve bit 7 (NMI mask) of the address register.
PlatformType = IoRead8 (0x70); // Read current CMOS address
Select reg 0x4B, keep NMI mask
Read platform type byte
Determine debug routing based on platform type (N3).
if (N3 > 3) {
N3 is in valid range > 3, use as-is (no remapping needed)
Platform type 0: read hardware strap from memory-mapped IO.
0xFDAF0490 is the LPC/strap register. Bit 1 indicates the
platform type. OR with 1 to ensure N3 is at least 1.
N3 *= ((volatile UINT8 *)0xFDAF0490 & 0x02) 0x01;**
else N3 is 1, 2, or 3: use directly without remapping
Map platform type to debug route value.
Valid range: N3 - 1 <= 0xFD (check that N3 is not 0 after remap)
if ((UINT8)(N3 - 1) <= 0xFD) {
EFI_D_INFO route
EFI_D_VERBOSE route (N3 >= 2)
If the debug level matches the routing mask, call UBA debug output.
if ((DebugRoute & Severity) != 0) {
UBA protocol function index 0 (offset 0x00): DebugPrint
UbaDebugFunc = (UBA_DEBUG_PRINT)(Uba->DebugPrint);
Get the UBA protocol and call its assertion handler.
UBA protocol function index 1 (offset 0x08) is the assert handler:
VOID (*)(UINT64 FileName, UINTN LineNumber, UINT64 Description)
Read each GUID as two 64-bit values (low and high halves)
and compare. The ReadUnaligned64 wrapper includes NULL checking.
Guid1Low = ReadUnaligned64 ((CONST UINT64 *)Guid1);
Return cached HOB list if already located.
if (gHobList != NULL) {
SystemTable + 104 (0x68) = NumberOfTableEntries (UINTN)
SystemTable + 112 (0x70) = ConfigurationTable (EFI_CONFIGURATION_TABLE *)
Total entry size: 24 bytes
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 24 + 16);*
DXE Services HOB not found in config table - report error.
UbaDebugPrint (0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n");
HobList is still NULL after scanning all config entries.
This triggers a CpuDeadLoop (via the UBA assert).
UbaDebugAssert (
Print debug banner identifying this module.
UbaDebugPrint (0x80000000, "UBA:SlotDataUpdate-TypeLightningRidgeEXECB2\n");
Locate the UBA protocol interface via LocateProtocol.
BootServices + 320 (0x140) = LocateProtocol
Registration key: NULL
Status = gBootServices->LocateProtocol (
UBA protocol function at offset +0x10 (Register): SetData.
VOID *Data, UINTN DataSize)
UbaRegister = (UBA_REGISTER)(Uba->RegisterFunc);
Register PSLT Entry 1: Primary slot table with GUID B93613E1-...
Status = UbaRegister (
Register PSLT Entry 2: Extended slot config with GUID 226763AE-...
Phase 1: Cache and validate global UEFI pointers
Save ImageHandle globally and ASSERT if NULL.
gImageHandle = ImageHandle;
Save SystemTable globally and ASSERT if NULL.
gSystemTable = SystemTable;
Save BootServices pointer from SystemTable and ASSERT if NULL.
gBootServices = SystemTable->BootServices;
Save RuntimeServices pointer from SystemTable and ASSERT if NULL.
gRuntimeServices = SystemTable->RuntimeServices;
Phase 2: Initialize HOB list from system table configuration
gEfiDxeServicesTableGuid ({7739F24C-93D7-11D4-...}) and caches
the associated VendorTable pointer in gHobList.
GetHobList ();
Phase 3: Register platform slot data with UBA protocol
Status = InstallSlotData ();

Generated by HR650X BIOS Decompilation Project