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

SetupConfigUpdateDxeNeonCityEPECB

Function Table

Address Name Description
ReturnNotFound
DebugAssert
DebugPrint
IsHobListGuid
ReadUnaligned64
SetupConfigUpdateDxeNeonCityEPECBEntryPoint
These global variables occupy memory in the .data section at fixed offsets.
They are accessed directly by the compiled code via RIP-relative addressing.
Address Name Description
0xB40 mDebugProtocolGuid UBA Debug Protocol GUID
0xB50 mUbaBoardTypeProtocolGuid UBA Board-Type Protocol GUID
0xB60 mEfiHobListGuid EFI HOB List GUID
0xB68 mEfiHobListGuidSecondHalf Second 8 bytes of HOB List GUID
0xB70 mUbaSetupConfigGuid UBA Setup Config Protocol GUID
0xB80 mSetupConfigData UBA_SETUP_CONFIG_DATA structure
0xBA0 gBS_global Cached BootServices pointer
0xBA8 gImageHandle_global Cached ImageHandle
0xBB0 gRT_global Cached RuntimeServices pointer
0xBB8 mDebugProtocol Cached Debug Protocol interface
0xBC0 mHobList Cached HOB List pointer
0xBC8 mCmosDebugLevel Cached CMOS debug level
0xB98 gST_global Cached SystemTable pointer
UBA Debug Protocol GUID
EFI_GUID mDebugProtocolGuid = UBA_DEBUG_PROTOCOL_GUID;
UBA Board-Type Protocol GUID for NeonCity EP EC B
EFI_GUID mUbaBoardTypeProtocolGuid = UBA_BOARD_TYPE_PROTOCOL_GUID;
EFI HOB List GUID - used to locate the HOB list from the system
configuration table. The GUID is split into two 64-bit halves for
the optimized comparison in IsHobListGuid().
First 8 bytes: 0x11D493D77739F24C (GUID.Data1 + Data2 + Data3 high)
Second 8 bytes: 0x4DC13F2700903A9A (GUID.Data3 low + Data4)
EFI_GUID mEfiHobListGuid = EFI_HOB_LIST_GUID;
UBA Setup Config Protocol GUID for NeonCity EP EC B
EFI_GUID mUbaSetupConfigGuid = UBA_SETUP_CONFIG_PROTOCOL_GUID;
Setup Configuration Data block.
Signature "PSET" (Platform SETup), Version 1, DataSize 0x48C (1164 bytes).
This data is provided to the setup engine via the board-type protocol.
UBA_SETUP_CONFIG_DATA mSetupConfigData = {
Signature 1, // Version
DataSize 0x48C // DataSize2 (duplicate)
Cached UEFI global pointers.
EFI_HANDLE *gImageHandle_global = NULL; // 0xBA8
0xB98 EFI_BOOT_SERVICES *gBS_global = NULL; // 0xBA0
0xBB0 //
Cached protocol and data pointers.
VOID *mDebugProtocol = NULL; // 0xBB8 - Cached Debug Protocol
0xBC0 - Cached HOB List
0xBC8 - Cached CMOS Debug Level
Function Implementations
Return cached value if already resolved.
Protocol = mDebugProtocol;
Allocate a small buffer (31 bytes = EfiBootServicesData pool type index)
and immediately free it. This validates that boot services are operational.
If the returned pointer value is > 0x10, the environment may not support
protocol lookup.
PoolSize = (UINTN)gBS_global->AllocatePool (EfiBootServicesData, 31);
Valid UEFI environment. Locate the UBA Debug Protocol.
Cache the result (or NULL if not found).
Call the assertion handler at protocol offset 0x08.
return ((UBA_DEBUG_PROTOCOL *)Protocol)->DebugAssert (
Get the UBA Debug Protocol interface.
Protocol = GetDebugProtocol ();
Read the current CMOS index register, preserving bit 7 (NMI enable).
Select CMOS register index 0x4B for the debug level.
CmosValue = IoRead8 (RTC_INDEX_PORT);
Read the debug level from CMOS data port 0x71.
DebugLevel = IoRead8 (RTC_DATA_PORT);
Determine the effective debug level.
if (DebugLevel > 3) {
Level > 3 means the raw value is not a simple level encoding.
Use the cached value.
DebugLevel = mCmosDebugLevel;
Bit 1 indicates the board type, and bit 0 is always set.
DebugLevel **= (MmioRead32 (BOARD_CONFIG_MMIO_ADDR) & 2) 1;**
Calculate the debug mask from the level.
Level must be >= 1 and level - 1 <= 0xFD.
if ((DebugLevel > 0) && ((DebugLevel - 1) <= 0xFD)) {
Map platform ID to debug filter mask.
Level **1: mask = 0x80000004 (DEBUG_INIT DEBUG_INFO)**
Level >1: mask = 0x80000046 (multiple debug flags)
if (DebugLevel == 1) {
If the requested ErrorLevel is enabled by the mask, call the
if ((DebugMask & ErrorLevel) != 0) {
if (mHobList != NULL) {
Initialize to NULL.
mHobList = NULL;
Check if there are configuration table entries.
TableCount = gST_global->NumberOfTableEntries;
Get pointer to the configuration table array.
ConfigTable = gST_global->ConfigurationTable;
Compare the current entry's VendorGuid against EFI_HOB_LIST_GUID.
if (IsHobListGuid (&ConfigTable[Index].VendorGuid)) {
Found the HOB list. Extract the VendorTable pointer.
mHobList = ConfigTable[Index].VendorTable;
HOB list not found. Raise ASSERT_EFI_ERROR.
DebugPrint (0x80000000, L"\nASSERT_EFI_ERROR (Status = %r)\n", EFI_NOT_FOUND);
If mHobList is still NULL, raise another assertion.
if (mHobList == NULL) {
Compare first 8 bytes of the GUID against the first half of the
cached EFI_HOB_LIST_GUID.
if (ReadUnaligned64 (&mEfiHobListGuid) != ReadUnaligned64 (GuidPtr)) {
Compare second 8 bytes of the GUID (at offset 8).
return ReadUnaligned64 ((UINT8 *)&mEfiHobListGuid + 8) ==
Cache ImageHandle with assertion check.
gImageHandle_global = (EFI_HANDLE *)ImageHandle;
Cache SystemTable with assertion check.
gST_global = SystemTable;
Cache BootServices from SystemTable with assertion check.
gBS_global = SystemTable->BootServices;
Cache RuntimeServices from SystemTable with assertion check.
gRT_global = SystemTable->RuntimeServices;
Locate the HOB list from the system configuration table.
GetHobList ();
Print debug banner.
DebugPrint (0x80000000, L"UBA:SETUPConfigUpdate-TypeNeonCityEPECB\n");
Locate the UBA board-type protocol.
Call the board-type protocol's RegisterSetupConfig function.
This registers the setup configuration GUID and data block for
the NeonCity EP EC B platform.
return BoardProtocol->RegisterSetupConfig (

Generated by HR650X BIOS Decompilation Project