# NetworkStackSetupScreen

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **ReadUnalignedQword** |  |
|  | **CompareGuidQword** |  |
|  | **CmosReadNvStorage** |  |
|  | **AmiBoardInfoAssert** |  |
|  | **AmiBoardInfoConditionalSend** |  |
|  | **AmiBoardInfoInit** |  |
|  | **AmiBoardInfoEntryPoint** |  |
| Global | **variable storage (mapped from .data section)** |  |
| EFI_HANDLE | **gImageHandle_      = NULL;   // 0xD00 (.data)** |  |
| 0xCF0 | **(.data)** |  |
| Cached | **protocol pointer (located by sub_4F8)** |  |
| EFI_AMI_BOARD_INFO_PROTOCOL | ***gAmiBoardInfoProtocol = NULL;   // 0xD10 (.data)** |  |
| Cached | **HOB list pointer (located by sub_600 -> GetHobList)** |  |
| EFI_PHYSICAL_ADDRESS | **gHobListRva     = 0;     // 0xD18 (.data)** |  |
| Second | **copies of service pointers (aliased .data at 0xD20/0xD28/0xD30)** |  |
| UINT64 | **gBS_1                = 0;     // 0xD20** |  |
| 0xD28 | **UINT64          gST_1                = 0;     // 0xD30** |  |
| NetworkStackVar | **data buffer (10 bytes at 0xD40)** |  |
| NETWORK_STACK_VAR | **gNvData;                    // 0xD40..0xD49** |  |
| UINT8 | **gNvBootFlag          = 0;     // byte_D45 (offset 5)** |  |
| word_D46 | **(offset 6)** |  |
| GUID | **definitions** |  |
| GUID | **for the AMI Board Info Protocol.** |  |
| The | **protocol interface is located via gBS->LocateProtocol.** |  |
| Stored | **at .data 0xCC0.** |  |
| EFI_GUID | **gAmiBoardInfoProtocolGuid = {** |  |
| PiHobList | **GUID (standard UEFI PiHobList GUID).** |  |
| Used | **to locate the HOB list from the system table configuration table.** |  |
| Stored | **as two halves at .data 0xCD0 (first 8 bytes) and 0xCD8 (second 8).** |  |
| EFI_GUID | **gPiHobListGuid = {** |  |
| Vendor | **GUID for the NetworkStackVar variable.** |  |
| Stored | **at .data 0xCE0.** |  |
| EFI_GUID | **gAmiBoardInfoVarGuid = {** |  |
| Forward | **declarations** |  |
| UINT64 | **EFIAPI** |  |
| Save | **current index, select CMOS diagnostic register (0x4B).** |  |
| Mask | **bit 7 (power good flag) to access the register number.** |  |
| IoWrite8 | **(** |  |
| Read | **the diagnostic status value.** |  |
| DiagnosticValue | **= IoRead8 (CMOS_REG_DATA_PORT);** |  |
| Value | **appears accessible.** |  |
| if | **(NvStorage == 0) {** |  |
| and | **use bit 1 combined with bit 0 as override indicator.** |  |
| NvStorage | **= (*(volatile UINT8 *)0xFDAF0490 & 2) | 1;** |  |
| if | **((UINT8)(NvStorage - 1) > 0xFD) {** |  |
| NvStorage | **is not 1 or 2 (or is 0xFF) -> undetermined.** |  |
| return | **0;** |  |
| 0x80000004 | **}** |  |
| Allocate | **a small pool (EfiBootServicesData) as scratch.** |  |
| Pool | **= AllocatePool (31);    // 31 = EfiBootServicesData** |  |
| FreePool | **(Pool);** |  |
| Locate | **the protocol.** |  |
| Status | **= gBS_->LocateProtocol (** |  |
| Registration | **(VOID **)&gAmiBoardInfoProtocol** |  |
| Offset | **0x00: AssertCallback.** |  |
| CMOS | **NV storage status does not match Mask.** |  |
| return | **EFI_UNSUPPORTED;** |  |
| Status | **matches; invoke StatusSend callback at offset 0x08.** |  |
| VA_START | **(Args, Arg2);** |  |
| Initialize | **to NULL.** |  |
| gHobListRva | **= 0;** |  |
| Walk | **the configuration table array.** |  |
| Each | **entry is sizeof(EFI_CONFIGURATION_TABLE) bytes = 24 bytes:** |  |
| 16 | **bytes VendorGuid + 8 bytes VendorTable pointer.** |  |
| for | **(Index = 0; Index < TableCount; Index++) {** |  |
| Found | **the HOB list entry.** |  |
| gHobListRva | **= (EFI_PHYSICAL_ADDRESS)ConfigEntry->VendorTable;** |  |
| ASSERT | **failure on debug builds. The original binary called** |  |
| sub_578 | **(conditional send) with:** |  |
| mask | **= 0x80000000LL** |  |
| arg2 | **= "\nASSERT_EFI_ERROR (Status = %r)\n" string ref** |  |
| arg3 | **= 0x800000000000000EuLL (EFI_NOT_FOUND)** |  |
| Cache | **services if not already set (by entry point).** |  |
| if | **(gST_ == NULL) {** |  |
| Try | **to read the existing variable.** |  |
| VarSize | **= sizeof (gNvData);        // = NETWORK_STACK_VAR_DATA_SIZE = 10** |  |
| Attributes | **(returned)** |  |
| Variable | **does not exist: zero the buffer and set defaults.** |  |
| word_D46 | **gNvBootFlag     = 1;            // byte_D45** |  |
| default | **flag value** |  |
| Write | **the variable as non-volatile + boot + runtime.** |  |
| Status | **= gRT_->SetVariable (** |  |
| Original | **driver does not check SetVariable status.** |  |
| _ModuleEntryPoint | **(0x370) -> AmiBoardInfoEntryPoint** |  |
| Save | **global handles (standard UEFI boot services library pattern).** |  |
| gImageHandle_ | **= ImageHandle;** |  |
| Locate | **and cache the HOB list pointer.** |  |
| GetHobList | **(SystemTable);** |  |
| Initialize | **the board info variable ("NetworkStackVar").** |  |
| return | **AmiBoardInfoInit (10, SystemTable);** |  |

---
*Generated by HR650X BIOS Decompilation Project*