/** @file
  UsbOcUpdateDxeLightningRidgeEXECB3.h -- Header for UsbOcUpdateDxeLightningRidgeEXECB3

Copyright (c) HR650X BIOS Decompilation Project
**/

#ifndef __USBOCUPDATEDXELIGHTNINGRIDGEEXECB3_H__
#define __USBOCUPDATEDXELIGHTNINGRIDGEEXECB3_H__

#include "../uefi_headers/Uefi.h"

//
// Function Prototypes
//

EFI_STATUS
EFIAPI
ReadUnaligned64(
  VOID
);

EFI_STATUS
EFIAPI
IsUbaPlatformHob(
  VOID
);

EFI_STATUS
EFIAPI
GetUsbOcConfigPointers(
  VOID
);

EFI_STATUS
EFIAPI
RegisterUsbOcData(
  VOID
);

EFI_STATUS
EFIAPI
UsbOcUpdateEntryPoint(
  VOID
);

EFI_STATUS
EFIAPI
UEFI table pointers (filled in by entry point)(
  VOID
);

EFI_STATUS
EFIAPI
gImageHandle     = NULL;(
  VOID
);

EFI_STATUS
EFIAPI
HOB list pointer(
  VOID
);

EFI_STATUS
EFIAPI
*gHobList = NULL;(
  VOID
);

EFI_STATUS
EFIAPI
UBA Configuration Database protocol pointer(
  VOID
);

EFI_STATUS
EFIAPI
*gUbaConfigDb = NULL;(
  VOID
);

EFI_STATUS
EFIAPI
configuration database protocol GUID(
  VOID
);

EFI_STATUS
EFIAPI
mUbaConfigDatabaseProtocolGuid = USB_OC_UBA_PROTOCOL_GUID;(
  VOID
);

EFI_STATUS
EFIAPI
GUID for USB OC configuration(
  VOID
);

EFI_STATUS
EFIAPI
mUsbOcConfigGuid = USB_OC_PARAM_GUID;(
  VOID
);

EFI_STATUS
EFIAPI
GUID for locating UBA platform data(
  VOID
);

EFI_STATUS
EFIAPI
mUbaPlatformHobGuid = USB_OC_HOB_GUID;(
  VOID
);

EFI_STATUS
EFIAPI
table metadata(
  VOID
);

EFI_STATUS
EFIAPI
UBA OC configuration data structure containing all mapping tables.(
  VOID
);

EFI_STATUS
EFIAPI
mUsbOcConfigData = {(
  VOID
);

/// logical index to physical port number mapping.
EFI_STATUS
EFIAPI
port numbers(
  VOID
);

EFI_STATUS
EFIAPI
= unused/unavailable port slot.(
  VOID
);

EFI_STATUS
EFIAPI
channel index per physical port.(
  VOID
);

EFI_STATUS
EFIAPI
= no overcurrent channel (port not physically connected or no OC).(
  VOID
);

EFI_STATUS
EFIAPI
table header(
  VOID
);

EFI_STATUS
EFIAPI
data mapping entries.(
  VOID
);

EFI_STATUS
EFIAPI
entries identical: 0x01020007 encodes channel and attribute info.(
  VOID
);

EFI_STATUS
EFIAPI
the 64-bit value as two 32-bit halves to handle unaligned access.(
  VOID
);

EFI_STATUS
EFIAPI
UEFI specification guarantees this is safe.(
  VOID
);

EFI_STATUS
EFIAPI
*(CONST UINT64 *)Buffer;(
  VOID
);

EFI_STATUS
EFIAPI
the GUID as two 64-bit halves for efficiency.(
  VOID
);

EFI_STATUS
EFIAPI
= ReadUnaligned64 (HobGuid);(
  VOID
);

EFI_STATUS
EFIAPI
for cached HOB list pointer(
  VOID
);

EFI_STATUS
EFIAPI
(gHobList != NULL) {(
  VOID
);

EFI_STATUS
EFIAPI
the first GUID HOB that matches the UBA platform GUID.(
  VOID
);

EFI_STATUS
EFIAPI
= GetFirstGuidHob (&mUbaPlatformHobGuid);(
  VOID
);

EFI_STATUS
EFIAPI
and return pointer to the HOB data portion (immediately after the GUID)(
  VOID
);

EFI_STATUS
EFIAPI
= (VOID *)(GuidHob + 1);(
  VOID
);

/// error condition
EFI_STATUS
EFIAPI
platform HOB not found(
  VOID
);

EFI_STATUS
EFIAPI
((DEBUG_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", EFI_NOT_FOUND));(
  VOID
);

EFI_STATUS
EFIAPI
cached pointer if already resolved(
  VOID
);

EFI_STATUS
EFIAPI
(gUbaConfigDb != NULL) {(
  VOID
);

EFI_STATUS
EFIAPI
the UBA Configuration Database protocol(
  VOID
);

EFI_STATUS
EFIAPI
= gBootServices->LocateProtocol ((
  VOID
);

EFI_STATUS
EFIAPI
type identification via port topology(
  VOID
);

EFI_STATUS
EFIAPI
OC config including PUSB header(
  VOID
);

EFI_STATUS
EFIAPI
the OC configuration data with the UBA protocol.(
  VOID
);

EFI_STATUS
EFIAPI
protocol call uses:(
  VOID
);

EFI_STATUS
EFIAPI
= UbaConfigDb->SetData ((
  VOID
);

EFI_STATUS
EFIAPI
parameters(
  VOID
);

EFI_STATUS
EFIAPI
(ImageHandle == NULL) {(
  VOID
);

EFI_STATUS
EFIAPI
global table pointers(
  VOID
);

EFI_STATUS
EFIAPI
= ImageHandle;(
  VOID
);

EFI_STATUS
EFIAPI
HOB subsystem(
  VOID
);

EFI_STATUS
EFIAPI
();(
  VOID
);

EFI_STATUS
EFIAPI
the UBA configuration being applied(
  VOID
);

EFI_STATUS
EFIAPI
((EFI_D_INFO, "UBA:UsbOcUpdate-TypeLightningRidgeEXECB3\n"));(
  VOID
);

EFI_STATUS
EFIAPI
= GetUbaConfigDb ();(
  VOID
);

EFI_STATUS
EFIAPI
the USB OC mapping configuration(
  VOID
);

EFI_STATUS
EFIAPI
= RegisterUsbOcData (UbaConfigDb);(
  VOID
);

#endif /* __USBOCUPDATEDXELIGHTNINGRIDGEEXECB3_H__ */