# UsbOcUpdateDxeLightningRidgeEXECB4

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **GetUsbOcConfigTables** |  |
|  | **DebugPrintEx** |  |
|  | **ReportAssertion** |  |
|  | **ReadUnaligned64Ex** |  |
|  | **CompareGuidEx** |  |
|  | **_ModuleEntryPoint** |  |
| EFI_BOOT_SERVICES | ***gBS          = NULL;** |  |
| These | **tables are embedded in the .data section at the addresses** |  |
| returned | **by GetUsbOcConfigTables(). The values map USB physical** |  |
| ports | **to overcurrent sense pins.** |  |
| 0xba0 | **(mUsbOcTableDefault): {0,0,0,0, 1,1,1,1, 2,2,2,2}** |  |
| 0xbd0 | **(mUsbOcTableAlt):     {0,0,0,0, 0,0,1,1, 1,1,2,2}** |  |
| 0xc10 | **(mUsbOcTableExt):     all 0x0702** |  |
| USB_OC_CONFIG_TABLE | **mUsbOcTableDefault = {** |  |
| EFI_GUID | **{2638009e-3850-4e4b-b05d-042a32dbb9d1}** |  |
| STATIC | **CONST EFI_GUID  mUbaProtocolGuid = UBA_USBOC_PROTOCOL_GUID;** |  |
| STATIC | **CONST EFI_GUID  mEfiHobListGuid = EFI_HOB_LIST_GUID;** |  |
| STATIC | **CONST EFI_GUID  mUsbOcHobGuid = USBOC_HOB_GUID;** |  |
| GetUsbOcConfigTables | **// ============================================================================** |  |
| Allocate | **pool for the protocol structure (minimum 16 bytes).** |  |
| Status | **= gBS->AllocatePool (EfiBootServicesData, 16, (VOID **)&Protocol);** |  |
| Locate | **the UBA USB OC protocol by GUID.** |  |
| Status | **= gBS->LocateProtocol (** |  |
| Cache | **the protocol pointer.** |  |
| mUbaProtocol | **= Protocol;** |  |
| Read | **board revision from RTC CMOS index 0x4B.** |  |
| Preserve | **NMI mask (bit 7) in the index register.** |  |
| IoWrite8 | **(RTC_INDEX_PORT, IoRead8 (RTC_INDEX_PORT) & 0x80 | CMOS_BOARD_REV_INDEX);** |  |
| If | **the raw CMOS value is out of range, try to refine it.** |  |
| if | **((UINT8)BoardRev > BOARD_REV_MAX) {** |  |
| Board | **rev appears invalid. If the raw value is 0, check the** |  |
| hardware | **strap at the MMIO address.** |  |
| if | **(BoardRev == 0) {** |  |
| Determine | **the filter mask.** |  |
| if | **((UINT8)(BoardRev - 1) <= 0xFD) {  // BoardRev >= 1** |  |
| 0x80000006 | **if (BoardRev == 1) {** |  |
| 0x80000004 | **}** |  |
| Check | **if our debug mask passes the filter.** |  |
| if | **((FilterMask & DebugMask) == 0) {** |  |
| EFI_SYSTEM_TABLE | **structure (field after RuntimeServices).** |  |
| TableCount | **= *(UINTN *)((UINT8 *)SystemTable + 104);** |  |
| No | **configuration tables** | log assertion. |
| DebugPrintEx | **(DEBUG_MASK_INIT, "\nASSERT_EFI_ERROR (Status = %r)\n", 0x800000000000000ELL);** |  |
| Each | **entry is 24 bytes: { EFI_GUID Guid; VOID *Table; }.** |  |
| for | **(Index = 0; Index < TableCount; Index++) {** |  |
| Compare | **the table's GUID with gEfiHobListGuid.** |  |
| if | **(CompareGuidEx (** |  |
| Found | **the HOB list entry. The table pointer is at offset 16** |  |
| within | **each configuration table entry.** |  |
| HobList | **= *(VOID **)((UINT8 *)SystemTable + 112 + Index * 24 + 16);** |  |
| HOB | **list not found** | this is an error condition. |
| If | **the HOB list was found, verify it is non-NULL.** |  |
| if | **(HobList == NULL) {** |  |
| gImageHandle | **= ImageHandle;** |  |
| GetHobList | **(SystemTable);** |  |
| DebugPrintEx | **(** |  |
| Minimum | **protocol structure size** |  |
| The | **protocol buffer is installed with the board-specific GUID.** |  |
| The | **consumer (USB stack) will use this protocol to determine** |  |
| USB | **port-to-overcurrent-pin mappings.** |  |
| Status | **= gBS->InstallProtocolInterface (** |  |

---
*Generated by HR650X BIOS Decompilation Project*