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

IioCfgUpdateDxeNeonCityEPECB

Function Table

Address Name Description
ReadUnaligned64
IsMatchingHobGuidPair
DebugAssert
DebugPrint
SetIioConfiguration
NoOpStub
ModuleEntryPoint
UEFI Protocol GUID definitions
These GUIDs identify the IIO configuration tables and protocols
used by this driver for the NeonCity EP EC B platform.
EFI_GUID gIioConfigTable0Guid = IIO_CONFIG_TABLE_0_GUID;
HOB discovery GUID pair.
The system table contains a firmware resource array. Each entry is a 24-byte
for a pair where the first QWORD of descriptor[N] matches gHobListGuid1 and
the first QWORD of descriptor[N] matches gHobListGuid2. The third QWORD of
the matching descriptor contains the HOB list pointer.
gHobListGuid1 = gEfiDxeServicesTableGuid
EFI_GUID gHobListGuid1 = { 0x7739F24C, 0x93D7, 0x11D4, { 0x9A, 0x3A, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } };
Module globals
VOID *mHobList = NULL; ///< Cached HOB list pointer
IIO Configuration Table (platform data for NeonCity EP EC B)
The configuration data is stored in PIIO format (signature "PIIO", version 1
length 0xD48). It contains IIO port configuration entries including PCIe port
IIO stack on the NeonCity EP EC B platform.
IIO port configuration entries follow
Internal function prototypes
UINT64 ReadUnaligned64 (
The system table at offset 0x68 (104) contains the number of firmware
resource descriptors, and at offset 0x70 (112) contains the array pointer.
FwResourceCount = (UINTN )((UINTN)gST + 104);
The third QWORD of the matching descriptor is the HOB list pointer.
mHobList = *(VOID )((UINTN)FwResourceArray + (Index 24) + 16);*
HOB list not found: report error via debug and assert.
DEBUG ((EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", EFI_NOT_FOUND));
Probe page allocator: try to allocate 0x10 pages (64 KB).
The pointer value is checked against 0x10 to determine if the
allocator function is available (low addresses are typical for
early DXE phase allocations, and a return value <= 0x10 suggests
the allocation backend is functional).
Pages = (UINT64)(UINTN)gBS->AllocatePages (AllocateAnyPages, EfiBootServicesData, 0x10);
The assertion handler is at offset 8 in the protocol vtable.
AssertFunc = (UINT64 ()(CONST CHAR8 , UINTN, CONST CHAR8 ))((UINTN)DebugProtocol + 8);
Read the current CMOS index register (I/O port 0x70)
then select CMOS offset 0x4B (BIOS debug level).
CmosIndex = __inbyte (0x70);
Determine effective debug level.
If DebugLevel > 3 (e.g., uninitialized CMOS), fall back to
hardware strap: read from I/O port 0xFDAF0490 bit 1, then OR with 1.
if (DebugLevel > 3) {
Compute the filter mask based on debug level.
Level 1 (errors only): 0x80000004
Level 2+ (errors+warn): 0x80000006
ShouldPrint = FALSE;
The print function is at offset 0 in the protocol vtable.
PrintFunc = (UINT64 ()(UINTN, CONST CHAR8 *, ...))((UINTN)DebugProtocol);
Report the platform type for debug purposes.
DEBUG ((EFI_D_INFO, "UBA:IioCfgUpdate-TypeNeonCityEPECB\n"));
Locate the UBA IIO configuration protocol.
The protocol GUID is IIO_CONFIG_PROTOCOL_GUID.
Status = gBS->LocateProtocol (&gIioConfigProtocolGuid, NULL, &UbaProtocol);
Call the protocol's SetIioConfig function at offset 16 in the vtable
Register configuration table 0.
Status = ((EFI_STATUS ()(VOID , EFI_GUID , VOID , UINTN))((UINTN)UbaProtocol + 16))(
Register configuration table 1.
Register configuration table 2.
Register configuration table 3.
Save the global image handle.
ASSERT (ImageHandle != NULL);
Save the UEFI system table pointer.
ASSERT (SystemTable != NULL);
Save the boot services table pointer.
ASSERT (SystemTable->BootServices != NULL);
Save the runtime services table pointer.
ASSERT (SystemTable->RuntimeServices != NULL);
Retrieve the HOB list (needed by platform configuration code).
GetHobList ();
Register the IIO configuration data via the UBA protocol.
Status = SetIioConfiguration ();

Generated by HR650X BIOS Decompilation Project