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

SlotDataUpdateDxeNeonCityFPGA

Function Table

Address Name Description
GetSlotCount
GetSlotData
UbaDebugPrint
UbaDebugAssert
ReadUnaligned64
IsHobGuidMatch
InstallSlotData
SlotDataUpdateDxeEntryPoint
GUID Definitions
EFI_GUID gUbaProtocolGuid = UBA_PROTOCOL_GUID;
Global Variables
EFI_HANDLE gImageHandle = NULL; ///< 0xC80: Image handle from entry point
Platform Slot Data (embedded in .data section)
Three PSLT entries are defined statically and registered with the UBA
protocol during initialization. The PSLT format:
Offset Size Field
0 4 Signature ("PSLT")
4 4 Version (1)
8 4 Length (total size of this entry)
12 4 SlotCount (function pointer offset to GetSlotCount)
16 4 Reserved1
20 4 SlotDataOffset (function pointer offset to GetSlotData)
24 16 ConfigData (OEM-specific bitfield configuration)
PSLT Entry 1 (at 0xC50, size 32): Primary PSLT with full length 0xC40
Signature 0x01, 0x00, 0x00, 0x00, // Version = 1
Length = 0xC40 (3136 bytes)
SlotCount = 0x4E8 (GetSlotCount function)
Reserved1 = 0
SlotDataOffset = 0x4EC (GetSlotData function)
PSLT Entry 2 (at 0xBE0, size 40): Secondary PSLT with length 0xC40
Length = 0xC40
SlotCount = 0x4E8
SlotDataOffset = 0x4EC
PSLT Entry 3 (at 0xC18, size 40): Tertiary PSLT with alternate length 0xC08
Length = 0xC08 (3080 bytes)
Function Implementations
Check if the platform type (N3) is 0 or 3, which maps to
a "standard/other" slot classification (value 15 = 0x0F).
if **((SlotNumber == 0) (SlotNumber == 3)) {**
Return cached protocol if already located.
if (gUbaProtocol != NULL) {
Allocate a small test buffer to verify pool availability.
Size 31 with EfiBootServicesData type via gBS->AllocatePool.
The allocation of 31 bytes is a probe to verify the UEFI memory
system is operational. If the allocation returns > 0x10 bytes
we proceed. If the allocation fails or returns <= 0x10 bytes
we bail out (return NULL).
Locate the UBA protocol using its GUID.
No registration key
Get the UBA protocol interface (lazy init through cached result).
Uba = (UBA_PROTOCOL *)UbaGetProtocolInterface ();
Read platform type from RTC CMOS register 0x4B.
We preserve bit 7 (NMI mask) of the address register.
PlatformType = IoRead8 (0x70);
Select CMOS reg 0x4B
Read platform type byte
Determine debug routing based on platform type.
if (N3 > 3) {
N3 is in valid range > 3, use as-is
Platform type 0: read hardware strap from F000:0490 bit 1, OR with 1
else N3 is 1, 2, or 3: use directly
Map platform type to debug route value.
if ((N3 - 1) <= 0xFD) {
N3 is 1..3 (valid range check passed)
UBA_DEBUG_ROUTE_A } else {
UBA_DEBUG_ROUTE_B }
If the debug level matches the routing mask, call UBA debug output.
if ((DebugRoute & DebugLevel) != 0) {
UBA protocol function index 1 (offset 0x08): DebugPrint
UbaDebugFunc = (UBA_DEBUG_PRINT)((UINT64 )((UINT8 *)Uba + 8));
Get the UBA protocol and call its assertion handler.
UBA protocol function index 1 (offset 0x08) is the assert handler
which takes (FileName, LineNumber, AssertString).
Read each GUID as two unaligned 64-bit values and compare.
Guid1Low = ReadUnaligned64 (Guid1);
SystemTable + 104 (0x68) = NumberOfTableEntries (UINTN)
SystemTable + 112 (0x70) = ConfigurationTable (EFI_CONFIGURATION_TABLE *)
HobCount = (UINTN )((UINT8 *)gSystemTable + 104);
Walk the configuration table to find the DXE Services HOB entry.
Each entry is sizeof(EFI_CONFIGURATION_TABLE) = 24 bytes:
for (Index = 0; Index < HobCount; Index++) {
Found the DXE Services HOB - cache its data pointer.
gHobList = *(VOID )(HobEntries + Index 24 + 16);*
DXE Services HOB not found - report error.
UbaDebugPrint (0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", 0x800000000000000EULL);
Print debug banner identifying this module.
UbaDebugPrint (0x80000000, "UBA:SlotDataUpdate-TypeNeonCityFPGA\n");
Locate the UBA protocol interface.
Status = gBootServices->LocateProtocol (
UBA protocol GUID
UBA protocol function index 2 (offset 0x10): SetData
VOID *Data, UINTN DataSize)
UbaSetData = (UBA_SET_DATA)((UINT64 )((UINT8 *)Uba + 16));
Register PSLT Entry 1: Primary slot table with length 0xC40
Status = UbaSetData (Uba, &gUbaSlotDataPsl1Guid, (VOID *)mPslEntry1, 32);
Register PSLT Entry 2: Secondary slot table with length 0xC40
Status = UbaSetData (Uba, &gUbaSlotDataPsl2Guid, (VOID *)mPslEntry2, 40);
Register PSLT Entry 3: Tertiary slot table with alternate length 0xC08
Status = UbaSetData (Uba, &gUbaSlotDataPsl3Guid, (VOID *)mPslEntry3, 40);
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