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

Copyright (c) HR650X BIOS Decompilation Project
**/

#ifndef __USBOCUPDATEDXECLX64L_H__
#define __USBOCUPDATEDXECLX64L_H__

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

//
// Function Prototypes
//

EFI_STATUS
EFIAPI
UsbOcUpdateCallback(
  VOID
);

EFI_STATUS
EFIAPI
UsbOcUpdateGetPchStepping(
  VOID
);

EFI_STATUS
EFIAPI
MmPciRead16(
  VOID
);

EFI_STATUS
EFIAPI
ReadUnaligned64(
  VOID
);

EFI_STATUS
EFIAPI
CompareGuid(
  VOID
);

EFI_STATUS
EFIAPI
EfiGetSystemConfigurationTable(
  VOID
);

EFI_STATUS
EFIAPI
ModuleEntryPoint(
  VOID
);

EFI_STATUS
EFIAPI
Variables(
  VOID
);

EFI_STATUS
EFIAPI
gImageHandle      = NULL;(
  VOID
);

EFI_STATUS
EFIAPI
OC Protocol GUIDs(
  VOID
);

EFI_STATUS
EFIAPI
gEfiUsbOcUpdateProtocolGuid = USB_OC_UPDATE_PROTOCOL_GUID;(
  VOID
);

EFI_STATUS
EFIAPI
function declarations(
  VOID
);

EFI_STATUS
EFIAPI
UsbOcUpdateCallback ((
  VOID
);

EFI_STATUS
EFIAPI
if already retrieved(
  VOID
);

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

EFI_STATUS
EFIAPI
the MM PCI Base protocol(
  VOID
);

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

EFI_STATUS
EFIAPI
cached value if already computed(
  VOID
);

EFI_STATUS
EFIAPI
(gPchStepping != PCH_STEPPING_UNKNOWN) {(
  VOID
);

EFI_STATUS
EFIAPI
the MM PCI User Space Register Area(
  VOID
);

EFI_STATUS
EFIAPI
= GetMpciUsra ();(
  VOID
);

EFI_STATUS
EFIAPI
the LPC device DID (Device ID) register at offset 0x2(
  VOID
);

EFI_STATUS
EFIAPI
= MmPciRead16 ((UINTN)Usra + 2);(
  VOID
);

EFI_STATUS
EFIAPI
the PCH stepping from the DID(
  VOID
);

EFI_STATUS
EFIAPI
((DidValue == 0xA13F) ||(
  VOID
);

EFI_STATUS
EFIAPI
stepping set (0xA13F base):(
  VOID
);

EFI_STATUS
EFIAPI
SUBVID from offset 0x2C to distinguish A0/A1/B0/B1(
  VOID
);

EFI_STATUS
EFIAPI
= 0;(
  VOID
);

EFI_STATUS
EFIAPI
SUBVID at MM PCI offset 0x2C(
  VOID
);

EFI_STATUS
EFIAPI
= MmPciRead16 ((UINTN)Usra + 0x2C);(
  VOID
);

EFI_STATUS
EFIAPI
Virtual Channel table entry 0 => A0 stepping(
  VOID
);

EFI_STATUS
EFIAPI
= PCH_STEPPING_A0;(
  VOID
);

EFI_STATUS
EFIAPI
Virtual Channel table entry 1 => A1 stepping(
  VOID
);

EFI_STATUS
EFIAPI
= PCH_STEPPING_A1;(
  VOID
);

EFI_STATUS
EFIAPI
Virtual Channel table entry 2 => B0 stepping(
  VOID
);

EFI_STATUS
EFIAPI
= PCH_STEPPING_B0;(
  VOID
);

EFI_STATUS
EFIAPI
Virtual Channel table entry 3 => B1 stepping(
  VOID
);

EFI_STATUS
EFIAPI
= PCH_STEPPING_B1;(
  VOID
);

EFI_STATUS
EFIAPI
through to extended stepping decode(
  VOID
);

EFI_STATUS
EFIAPI
we resolved to a known stepping via SUBVID, cache and return(
  VOID
);

EFI_STATUS
EFIAPI
stepping range for B2/C0/C1:(
  VOID
);

EFI_STATUS
EFIAPI
plus 0x62A0 -> 0x62A8 range indicates B2/C stepping(
  VOID
);

EFI_STATUS
EFIAPI
((DidValue + 0x62A0) <= 8) {(
  VOID
);

EFI_STATUS
EFIAPI
= 35, B3 = 36, C0 = 37, C1 = 38(
  VOID
);

EFI_STATUS
EFIAPI
(Revision == 0x10) {(
  VOID
);

EFI_STATUS
EFIAPI
DID (0xA14C) — check revision for stepping decode(
  VOID
);

EFI_STATUS
EFIAPI
= *(UINT8 *)((UINTN)Usra + 8);(
  VOID
);

EFI_STATUS
EFIAPI
indicates Server platform: stepping = D0(
  VOID
);

EFI_STATUS
EFIAPI
further decode needed(
  VOID
);

EFI_STATUS
EFIAPI
= PCH_STEPPING_D0;(
  VOID
);

EFI_STATUS
EFIAPI
Server platform: stepping depends on revision(
  VOID
);

EFI_STATUS
EFIAPI
(Revision) {(
  VOID
);

EFI_STATUS
EFIAPI
DID — stepping not recognized(
  VOID
);

EFI_STATUS
EFIAPI
= PCH_STEPPING_UNKNOWN;(
  VOID
);

EFI_STATUS
EFIAPI
OC table based on stepping(
  VOID
);

EFI_STATUS
EFIAPI
>= 48 (D0 and above) uses 48-pin OC mapping(
  VOID
);

EFI_STATUS
EFIAPI
others use default 54-pin mapping(
  VOID
);

EFI_STATUS
EFIAPI
(Stepping >= PCH_STEPPING_D0) {(
  VOID
);

EFI_STATUS
EFIAPI
output structures(
  VOID
);

EFI_STATUS
EFIAPI
actual OC table data is provided by the UBA base protocol(
  VOID
);

EFI_STATUS
EFIAPI
layer.(
  VOID
);

EFI_STATUS
EFIAPI
library services(
  VOID
);

EFI_STATUS
EFIAPI
(ImageHandle, SystemTable);(
  VOID
);

EFI_STATUS
EFIAPI
the driver entry(
  VOID
);

EFI_STATUS
EFIAPI
((DEBUG_INFO, "UBA:UsbOcUpdate-TypeClx64L\n"));(
  VOID
);

EFI_STATUS
EFIAPI
the UBA USB OC Update protocol(
  VOID
);

EFI_STATUS
EFIAPI
the USB OC mapping callback(
  VOID
);

EFI_STATUS
EFIAPI
= UsbOcProtocol->GetUsbOcMapping ((
  VOID
);

#endif /* __USBOCUPDATEDXECLX64L_H__ */