# SetupConfigUpdateDxeNeonCityFPGA

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **_ModuleEntryPoint** |  |
|  | **IsHobListGuid** |  |
|  | **DebugPrint** |  |
|  | **DebugAssert** |  |
|  | **ReturnNotFound** |  |
|  | **ReadUnaligned64** |  |
| Static | **(Module-Level) Global Variables** |  |
| Cached | **pointer to the DebugLib protocol interface.** |  |
| Initialized | **lazily by GetDebugProtocol(). Located via gBS->LocateProtocol()** |  |
| against | **the DebugLib protocol GUID stored in the data section.** |  |
| STATIC | **VOID  *mDebugProtocol;     // qword_BB8 at 0xBB8** |  |
| Cached | **pointer to the HOB list.** |  |
| Initialized | **lazily by GetHobList() by searching the system configuration** |  |
| table | **for the EFI_HOB_LIST_GUID entry.** |  |
| STATIC | **VOID  *mHobList;           // qword_BC0 at 0xBC0** |  |
| Cached | **CMOS debug level byte (n3 at 0xBC8).** |  |
| Read | **from CMOS register 0x4B during debug output filtering.** |  |
| STATIC | **UINT8  mCmosDebugLevel;    // n3 at 0xBC8** |  |
| Constant | **Data (in .data section)** |  |
| These | **constants are embedded in the .data section of the binary. They are** |  |
| referenced | **by absolute address in the compiled code and are provided here** |  |
| for | **reference documentation. The actual values must match what the compiled** |  |
| code | **expects through the fixed .data layout.** |  |
| EFI_GUID | **mDebugProtocolGuid             @ 0xB40 = 36232936-0E76-31C8-A13A-3AF2FC1C3932** |  |
| EFI_GUID | **mUbaBoardTypeProtocolGuid      @ 0xB50 = E03E0D46-5263-4845-B0A4-58D57B3177E2** |  |
| EFI_GUID | **mEfiHobListGuid                @ 0xB60 = 7739F24C-93D7-11D4-9A3A-0090273FC14D** |  |
| EFI_GUID | **mUbaSetupConfigGuid            @ 0xB70 = CD1F9574-DD03-4196-96AD-4965146F9665** |  |
| The | **GUID halves used for the optimized comparison in IsHobListGuid() reside** |  |
| at | **the same GUID buffer:** |  |
| UINT64 | **mEfiHobListGuidFirstHalf  (first  8 bytes of GUID at 0xB60)** |  |
| UINT64 | **mEfiHobListGuidSecondHalf (second 8 bytes of GUID at 0xB68)** |  |
| UBA_SETUP_CONFIG_DATA | **mSetupConfigData @ 0xB80** |  |
| Local | **(Forward) Function Declarations** |  |
| Function | **Implementations** |  |
| Cache | **ImageHandle with assertion check.** |  |
| gImageHandle | **= ImageHandle;** |  |
| Cache | **SystemTable with assertion check.** |  |
| gST | **= SystemTable;** |  |
| Cache | **BootServices from SystemTable with assertion check.** |  |
| gBS | **= SystemTable->BootServices;** |  |
| Cache | **RuntimeServices from SystemTable with assertion check.** |  |
| gRT | **= SystemTable->RuntimeServices;** |  |
| Locate | **the HOB list from the system configuration table.** |  |
| This | **is required for HOB-based drivers that follow.** |  |
| GetHobList | **(ImageHandle);** |  |
| Print | **debug banner indicating this driver is executing.** |  |
| Interface | **= NULL;** |  |
| Locate | **the UBA NeonCityFPGA board-type protocol.** |  |
| Status | **= gBS->LocateProtocol (** |  |
| Call | **the board-type protocol's RegisterSetupConfig function at offset 0x10.** |  |
| This | **registers the setup configuration protocol for NeonCityFPGA.** |  |
| rdx | **= &mUbaSetupConfigGuid (protocol GUID to register)** |  |
| r8 | **= &mSetupConfigData ("PSET" structure)** |  |
| r9 | **= sizeof(UBA_SETUP_CONFIG_DATA) = 0x18 (24 bytes)** |  |
| return | **((UBA_NEONCITYFPGA_BOARD_TYPE_PROTOCOL *)Interface)->RegisterSetupConfig (** |  |
| Return | **cached value if already resolved.** |  |
| if | **(mHobList != NULL) {** |  |
| Initialize | **HOB list pointer to NULL.** |  |
| Get | **the number of configuration table entries.** |  |
| TableCount | **= gST->NumberOfTableEntries;** |  |
| If | **there are entries, scan them for EFI_HOB_LIST_GUID.** |  |
| if | **(TableCount > 0) {** |  |
| Get | **pointer to the configuration table array.** |  |
| ConfigTable | **= gST->ConfigurationTable;** |  |
| Compare | **current entry's VendorGuid against EFI_HOB_LIST_GUID.** |  |
| The | **comparison splits the 16-byte GUID into two 8-byte halves:** |  |
| This | **matches the EFI_HOB_LIST_GUID: 7739F24C-93D7-11D4-9A3A-0090273FC14D** |  |
| if | **(IsHobListGuid (ImageHandle, &ConfigTable[Index].VendorGuid)) {** |  |
| Found | **the HOB list entry. Extract the VendorTable pointer.** |  |
| mHobList | **= ConfigTable[Index].VendorTable;** |  |
| HOB | **list GUID not found in configuration table.** |  |
| Raise | **ASSERT_EFI_ERROR with EFI_NOT_FOUND (0x800000000000000E).** |  |
| DebugPrint | **(EFI_NOT_FOUND, "\nASSERT_EFI_ERROR (Status = %r)\n");** |  |
| If | **mHobList is still NULL after the search, raise another assertion.** |  |
| if | **(mHobList == NULL) {** |  |
| Compare | **first 8 bytes of the GUID.** |  |
| if | **(ReadUnaligned64 (&mEfiHobListGuidFirstHalf) != ReadUnaligned64 (GuidPtr)) {** |  |
| Compare | **second 8 bytes of the GUID.** |  |
| GuidPtr | **+ 8 points to the second half of the 16-byte GUID structure.** |  |
| return | **ReadUnaligned64 (&mEfiHobListGuidSecondHalf) == ReadUnaligned64 ((UINT8 *)GuidPtr + 8);** |  |
| Get | **the DebugLib protocol interface (cached).** |  |
| DebugProtocol | **= GetDebugProtocol ();** |  |
| Read | **debug level from CMOS register 0x4B.** |  |
| Access | **RTC CMOS ports 0x70/0x71:** |  |
| Port | **0x70 = CMOS index/address register** |  |
| Port | **0x71 = CMOS data register** |  |
| Read | **current CMOS index register value, mask off bits to preserve** |  |
| NMI | **enable (bit 7 = 0x80), and set the register address to 0x4B.** |  |
| CmosValue | **= IoRead8 (RTC_INDEX_PORT);** |  |
| Read | **the debug level value from CMOS data port.** |  |
| DebugLevel | **= IoRead8 (RTC_DATA_PORT);** |  |
| Determine | **the debug mask based on the CMOS value.** |  |
| if | **(DebugLevel > 3) {** |  |
| For | **values > 3, check the cached CMOS debug level.** |  |
| If | **the cached level is 0, fall through to the board config check.** |  |
| DebugLevel | **= mCmosDebugLevel;** |  |
| Read | **board configuration from MMIO register 0xFDAF0490.** |  |
| This | **is a platform-specific register that indicates the board type** |  |
| or | **configuration variant.** |  |
| DebugLevel | **= (*(volatile UINT32 *)BOARD_CONFIG_MMIO_ADDR & 2) | 1;** |  |
| Calculate | **the debug mask from the debug level.** |  |
| level | **- 1 must be <= 0xFD (i.e., level >= 1 and level < 0xFF)** |  |
| if | **((DebugLevel > 0) && ((DebugLevel - 1) <= 0xFD)) {** |  |
| Level | **1 -> mask = 0x80000004 (DEBUG_INIT | DEBUG_INFO)** |  |
| Level | **>1 -> mask = 0x80000046 (multiple debug flags)** |  |
| if | **(DebugLevel == 1) {** |  |
| Check | **if the requested ErrorLevel is enabled by the mask.** |  |
| if | **((DebugMask & ErrorLevel) != 0) {** |  |
| Call | **the DebugLib protocol's output function.** |  |
| ReturnValue | **= ((DEBUGLIB_PROTOCOL *)DebugProtocol)->DebugPrint (** |  |
| if | **(mDebugProtocol != NULL) {** |  |
| Allocate | **a small pool buffer (EfiBootServicesData = 31) and free it.** |  |
| This | **is a UEFI environment validation check: if the allocation succeeds** |  |
| and | **the buffer address is within a reasonable range (<= 0x10), proceed.** |  |
| On | **minimal or non-UEFI environments, the allocation may behave differently.** |  |
| The | **buffer size check suggests we are in a valid UEFI environment with** |  |
| properly | **functioning boot services.** |  |
| Locate | **the DebugLib protocol.** |  |

---
*Generated by HR650X BIOS Decompilation Project*