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

AmiBoardInfo2

Function Table

Address Name Description
_ModuleEntryPoint
Standard UEFI globals (set by _ModuleEntryPoint)
EFI_HANDLE gImageHandle = NULL;
Persistent copies for AmiBoardInfo2Entry
EFI_SYSTEM_TABLE gSavedSystemTable = NULL; / 0x1760 */
Debug library globals
VOID gDebugOutputProtocol = NULL; / 0x1720 (serial debug) */
HOB list pointer (lazily initialized by GetHobList)
VOID gHobList = NULL; / 0x1728 */
Allocate one page for the serial I/O interface
Pages = gBootServices->AllocatePages (AllocateAnyPages, EfiBootServicesData, 1);
Locate the Serial I/O protocol
Read CMOS diagnostic status register (0x70/0x71, index 0x4B)
CmosDebugLevel = IoRead8 (0x70);
Check platform-specific memory-mapped register
PlatformFlags = (volatile UINT8 )(UINTN)0xFDAF0490;
DebugLevel is 0: debug disabled
return 0;
Console debug mode: locate StdErr protocol
if (gDebugOutputProtocol2 != NULL) {
This path not taken in console mode since gDebugInitialized=0
return EFI_NOT_READY;
Serial debug mode (default)
Pages = gSavedBootServices->AllocatePages (AllocateAnyPages, EfiBootServicesData, 1);
Convert %r (EFI_STATUS) to %r and %s/%g to ASCII-compatible format
Fmt = (CHAR8 *)Format;
Walk the configuration table looking for HOB list GUID
while (Count < gSystemTable->NumberOfTableEntries) {
Optimized comparison handling misaligned start, aligned 8-byte blocks
and trailing bytes.
CONST UINT8 *B1;
Handle head misalignment if both pointers have same alignment
if (AlignDelta != 0 && AlignDelta == ((UINTN)Buffer2 & 7)) {
Compare aligned 8-byte chunks
while (Length >= 8 && (UINT64 )B1 == (UINT64 )B2) {
Compare remaining bytes
while (Length > 0) {
Get the HOB protocol handle list via gBS->LocateHandle
Status = gSavedBootServices->LocateHandle (
Open the HOB protocol for this handle
Status = gSavedBootServices->OpenProtocol (
Get the next HOB entry
SearchType = (NameFilter != NULL) ? HobTypeCodeWithName : HobTypeCode;
If name filter provided, copy and compare the name
if (NameFilter != NULL) {
Name doesn't match; adjust data pointer and free
EntryDataSize -= 16;
Name matches; fall through to return
Detect overlap: if Source < Destination and overlap exists
copy backwards from the end.
if (Src < Dst && Src + Length > Dst) {
If aligned and length >= 8, copy aligned head first
if (Length >= 8 && (UINTN)Src - (UINTN)Dst < 8) {
Copy misaligned head
AlignDelta = (UINTN)Src & 7;
if (Length >= 8) {
Copy trailing bytes
if (Length != 0) {
Save global pointers with ASSERT checks (standard UEFI boilerplate)
gImageHandle = ImageHandle;
Initialize the HOB list
GetHobList ();
Dispatch to the main board info entry function
return AmiBoardInfo2Entry (ImageHandle, SystemTable);
Save SystemTable, BootServices, RuntimeServices on first call
if (gSavedSystemTable == NULL) {
Check if the Multi-Platform Board Info protocol already exists
BoardInfo = NULL;
Find the protocol-data HOBs (they contain DSDT, SIO, IOAPIC data)
HasProtocolData = FALSE;
Find DSDT HOB data
if (gProtocolDataBase != 0) {
Store DSDT data pointer in the protocol structure (slot 2)
BoardInfo = (AMI_BOARD_INFO2_PROTOCOL *)&gBoardInfoProtocolStructure;
Find DSDT ACPI table via HOB protocol (optional)
Status = HobFindProtocolData (
Store DSDT data pointer and size (slots 5, 6)
Find SIO (Super I/O) data HOB
SioHobAddr = 0;
Find IOAPIC data HOB
Install the AMI Board Info protocol
return gSavedBootServices->InstallMultipleProtocolInterfaces (

Generated by HR650X BIOS Decompilation Project