# OpromUpdateDxeLightningRidgeEXECB4

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **__inbyte** |  |
|  | **__outbyte** |  |
|  | **OpromOperationUnsupported** |  |
|  | **DebugPrint** |  |
|  | **DebugAssert** |  |
|  | **IsHobListGuid** |  |
|  | **ReadUnaligned64** |  |
|  | **_ModuleEntryPoint** |  |
| NULL | **// ============================================================================** |  |
| Platform | **I/O Intrinsics (MSVC __inbyte / __outbyte replacements)** |  |
| Embedded | **Binary Data (GUIDs and Protocol Interface)** |  |
| GUID | **storage block at 0xB40 in .data.** |  |
| Contains | **GUIDs used by the driver.** |  |
| static | **CONST UINT8  GuidBlock[0x40] = {** |  |
| OpROM | **update stub protocol interface data block (at 0xB80 in .data).** |  |
| This | **structure serves as the registered protocol interface.** |  |
| It | **starts with a signature/header ("PSET") followed by a callback pointer.** |  |
| Layout | **(24 bytes):** |  |
| static | **CONST UINT8  OpromUpdateProtocolData[OPROM_UPDATE_PROTOCOL_DATA_SIZE] = {** |  |
| Version | **= 1** |  |
| Callback | **-> sub_48C (0x48C)** |  |
| Reserved | **/ second copy -> sub_48C** |  |
| Global | **Variables (.data segment)** |  |
| Cached | **pointer to the OpROM update protocol interface.** |  |
| Resolved | **once by GetDebugLibProtocol() and reused thereafter.** |  |
| static | **VOID   *gOpromUpdateProtocol = NULL;** |  |
| Cached | **pointer to the HOB (Hand-Off Block) list.** |  |
| Resolved | **once by GetHobList() and reused thereafter.** |  |
| VOID | ***gHobList = NULL;** |  |
| Stub | **Callback Implementation** |  |
| Protocol | **Resolution** |  |
| Check | **if protocol was already resolved.** |  |
| if | **(gOpromUpdateProtocol != NULL) {** |  |
| Allocate | **pool for the protocol interface.** |  |
| The | **pool type used corresponds to memory type 31 (implementation-specific** |  |
| allocation | **type for UBA protocol interfaces).** |  |
| AllocatePool | **signature: (PoolType, Size, Buffer).** |  |
| Initialize | **the protocol interface with the single callback pointer.** |  |
| Locate | **the DebugLib protocol using gBS->LocateProtocol().** |  |
| If | **the protocol cannot be located (e.g., not yet installed), set the** |  |
| cached | **pointer to NULL so the caller can handle gracefully.** |  |
| if | **(EFI_ERROR((*gBS->LocateProtocol)((EFI_GUID *)&GuidBlock[0x00], NULL, &gOpromUpdateProtocol))) {** |  |
| Debug | **Output** |  |
| Resolve | **the DebugLib/OpROM protocol interface.** |  |
| Protocol | **= GetDebugLibProtocol ();** |  |
| Determine | **platform type from CMOS register 0x4B.** |  |
| Read | **the CMOS register using port I/O instructions.** |  |
| CmosValue | **= __inbyte (RTC_INDEX_PORT);** |  |
| Validate | **platform type. If > 3, use as-is.** |  |
| If | **== 0, fall back to MMIO register at 0xFDAF0490.** |  |
| if | **(PlatformType > 3) {** |  |
| PlatformType | **is valid as-is** |  |
| Platform | **type 1..3 = valid** |  |
| Check | **if the platform type matches the Lightning Ridge EXEC B4 type.** |  |
| if | **((PlatformType - 1) <= 0xFD) {** |  |
| Build | **the error mask for this platform:** |  |
| if | **(PlatformType == OPROM_PLATFORM_TYPE_LIGHTNING_RIDGE) {** |  |
| If | **the requested ErrorLevel matches the platform's error mask** |  |
| call | **the DebugLib protocol's output function (at offset 0x00).** |  |
| if | **((ErrorMask & ErrorLevel) != 0) {** |  |
| Invoke | **the debug output function.** |  |
| directly | **pointing to the stack location after Format. In the actual** |  |
| UEFI | **DebugLib implementation, this is the DebugVPrint function.** |  |
| Assertion | **Handler** |  |
| Resolve | **the DebugLib protocol interface.** |  |
| Call | **the assertion handler function at offset 0x08 in the** |  |
| protocol | **interface. The assertion handler is accessed via pointer** |  |
| arithmetic | **on the raw protocol interface.** |  |
| HOB | **List Management** |  |
| Return | **cached value if already resolved.** |  |
| if | **(gHobList != NULL) {** |  |
| Initialize | **and iterate through configuration tables.** |  |
| gHobList | **= NULL;** |  |
| Walk | **the configuration table array.** |  |
| Each | **entry is 24 bytes (sizeof(EFI_CONFIGURATION_TABLE)).** |  |
| for | **(Index = 0; Index < TableCount; Index++) {** |  |
| Check | **if this table's VendorGuid matches EFI_HOB_LIST_GUID.** |  |
| if | **(IsHobListGuid (NULL, &ConfigTable[Index].VendorGuid)) {** |  |
| If | **no HOB list was found, trigger assertion failure.** |  |
| if | **(gHobList == NULL) {** |  |
| Read | **the expected GUID halves from the GUID storage block.** |  |
| The | **EFI_HOB_LIST_GUID is stored at GuidBlock + 0x20.** |  |
| ExpectedFirstHalf | **= ReadUnaligned64 (&GuidBlock[0x20]);** |  |
| Read | **the target GUID as two 64-bit halves.** |  |
| GuidFirstHalf | **= ReadUnaligned64 (GuidPtr);** |  |
| Both | **halves must match.** |  |
| return | **(GuidFirstHalf == ExpectedFirstHalf) && (GuidSecondHalf == ExpectedSecondHalf);** |  |
| Utility | **Functions** |  |
| Validate | **Buffer is not NULL.** |  |
| if | **(Buffer == NULL) {** |  |
| Read | **8 bytes from the buffer as a 64-bit value.** |  |
| Cast | **to volatile to prevent compiler optimizations from re-ordering** |  |
| or | **combining the access.** |  |
| return | ***(CONST UINT64 *)Buffer;** |  |
| Module | **Entry Point** |  |
| Cache | **global pointers.** |  |
| gImageHandle | **= ImageHandle;** |  |
| Validate | **input parameters.** |  |
| if | **(ImageHandle == NULL) {** |  |
| Locate | **HOB list (ensures PCI enumeration data is available).** |  |
| Initializes | **gHobList for use by the UBA framework.** |  |
| GetHobList | **(ImageHandle);** |  |
| Log | **debug banner indicating this is the OpROM Update driver for** |  |
| the | **Lightning Ridge EXEC B4 platform.** |  |
| DebugPrint | **(DEBUG_INFO, "UBA:SETUPConfigUpdate-TypeLightningRidgeEXECB4\n");** |  |
| Locate | **the UBA Lightning Ridge EXEC B4 board-type protocol.** |  |
| The | **protocol GUID is stored at GuidBlock + 0x10.** |  |
| If | **the UBA protocol was found, register the OpROM update configuration.** |  |
| The | **registration function is at offset 0x10 in the protocol interface.** |  |
| if | **(!EFI_ERROR (Status)) {** |  |
| OPROM_UPDATE_PROTOCOL_REGISTRATION_GUID | **(VOID *)OpromUpdateProtocolData** |  |
| 24 | **bytes** |  |

---
*Generated by HR650X BIOS Decompilation Project*