# UsbOcUpdateDxeLightningRidgeEXECB3

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **ReadUnaligned64** |  |
|  | **IsUbaPlatformHob** |  |
|  | **GetUsbOcConfigPointers** |  |
|  | **RegisterUsbOcData** |  |
|  | **UsbOcUpdateEntryPoint** |  |
| Global | **UEFI table pointers (filled in by entry point)** |  |
| EFI_HANDLE | **gImageHandle     = NULL;** |  |
| Cached | **HOB list pointer** |  |
| VOID | ***gHobList = NULL;** |  |
| Cached | **UBA Configuration Database protocol pointer** |  |
| UBA_CONFIG_DATABASE_PROTOCOL | ***gUbaConfigDb = NULL;** |  |
| UBA | **configuration database protocol GUID** |  |
| EFI_GUID | **mUbaConfigDatabaseProtocolGuid = USB_OC_UBA_PROTOCOL_GUID;** |  |
| Parameter | **GUID for USB OC configuration** |  |
| EFI_GUID | **mUsbOcConfigGuid = USB_OC_PARAM_GUID;** |  |
| HOB | **GUID for locating UBA platform data** |  |
| EFI_GUID | **mUbaPlatformHobGuid = USB_OC_HOB_GUID;** |  |
| PUSB | **table metadata** |  |
| Combined | **UBA OC configuration data structure containing all mapping tables.** |  |
| UBA_OC_CONFIG_DATA | **mUsbOcConfigData = {** |  |
| USB | **port numbers** | logical index to physical port number mapping. |
| 0 | **= unused/unavailable port slot.** |  |
| OC | **channel index per physical port.** |  |
| 8 | **= no overcurrent channel (port not physically connected or no OC).** |  |
| PUSB | **table header** |  |
| OC | **data mapping entries.** |  |
| All | **entries identical: 0x01020007 encodes channel and attribute info.** |  |
| Read | **the 64-bit value as two 32-bit halves to handle unaligned access.** |  |
| The | **UEFI specification guarantees this is safe.** |  |
| return | ***(CONST UINT64 *)Buffer;** |  |
| Compare | **the GUID as two 64-bit halves for efficiency.** |  |
| GuidFirstHalf | **= ReadUnaligned64 (HobGuid);** |  |
| Check | **for cached HOB list pointer** |  |
| if | **(gHobList != NULL) {** |  |
| Find | **the first GUID HOB that matches the UBA platform GUID.** |  |
| GuidHob | **= GetFirstGuidHob (&mUbaPlatformHobGuid);** |  |
| Cache | **and return pointer to the HOB data portion (immediately after the GUID)** |  |
| gHobList | **= (VOID *)(GuidHob + 1);** |  |
| UBA | **platform HOB not found** | error condition |
| DEBUG | **((DEBUG_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", EFI_NOT_FOUND));** |  |
| Return | **cached pointer if already resolved** |  |
| if | **(gUbaConfigDb != NULL) {** |  |
| Locate | **the UBA Configuration Database protocol** |  |
| Status | **= gBootServices->LocateProtocol (** |  |
| Board | **type identification via port topology** |  |
| Combined | **OC config including PUSB header** |  |
| Register | **the OC configuration data with the UBA protocol.** |  |
| The | **protocol call uses:** |  |
| Status | **= UbaConfigDb->SetData (** |  |
| Validate | **parameters** |  |
| if | **(ImageHandle == NULL) {** |  |
| Initialize | **global table pointers** |  |
| gImageHandle | **= ImageHandle;** |  |
| Initialize | **HOB subsystem** |  |
| GetUbaPlatformHob | **();** |  |
| Log | **the UBA configuration being applied** |  |
| DEBUG | **((EFI_D_INFO, "UBA:UsbOcUpdate-TypeLightningRidgeEXECB3\n"));** |  |
| UbaConfigDb | **= GetUbaConfigDb ();** |  |
| Register | **the USB OC mapping configuration** |  |
| Status | **= RegisterUsbOcData (UbaConfigDb);** |  |

---
*Generated by HR650X BIOS Decompilation Project*