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

Copyright (c) HR650X BIOS Decompilation Project
**/

#ifndef __SLOTDATAUPDATEDXENEONCITYFPGA_H__
#define __SLOTDATAUPDATEDXENEONCITYFPGA_H__

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

//
// Function Prototypes
//

EFI_STATUS
EFIAPI
GetSlotCount(
  VOID
);

EFI_STATUS
EFIAPI
GetSlotData(
  VOID
);

EFI_STATUS
EFIAPI
UbaDebugPrint(
  VOID
);

EFI_STATUS
EFIAPI
UbaDebugAssert(
  VOID
);

EFI_STATUS
EFIAPI
ReadUnaligned64(
  VOID
);

EFI_STATUS
EFIAPI
IsHobGuidMatch(
  VOID
);

EFI_STATUS
EFIAPI
InstallSlotData(
  VOID
);

EFI_STATUS
EFIAPI
SlotDataUpdateDxeEntryPoint(
  VOID
);

EFI_STATUS
EFIAPI
Definitions(
  VOID
);

EFI_STATUS
EFIAPI
gUbaProtocolGuid          = UBA_PROTOCOL_GUID;(
  VOID
);

EFI_STATUS
EFIAPI
Variables(
  VOID
);

EFI_STATUS
EFIAPI
gImageHandle      = NULL;  ///< 0xC80: Image handle from entry point(
  VOID
);

EFI_STATUS
EFIAPI
Slot Data (embedded in .data section)(
  VOID
);

EFI_STATUS
EFIAPI
PSLT entries are defined statically and registered with the UBA(
  VOID
);

EFI_STATUS
EFIAPI
during initialization. The PSLT format:(
  VOID
);

EFI_STATUS
EFIAPI
Size  Field(
  VOID
);

EFI_STATUS
EFIAPI
4     Signature   ("PSLT")(
  VOID
);

EFI_STATUS
EFIAPI
4     Version     (1)(
  VOID
);

EFI_STATUS
EFIAPI
4     Length      (total size of this entry)(
  VOID
);

EFI_STATUS
EFIAPI
4     SlotCount   (function pointer offset to GetSlotCount)(
  VOID
);

EFI_STATUS
EFIAPI
4     Reserved1(
  VOID
);

EFI_STATUS
EFIAPI
4     SlotDataOffset (function pointer offset to GetSlotData)(
  VOID
);

EFI_STATUS
EFIAPI
16    ConfigData  (OEM-specific bitfield configuration)(
  VOID
);

EFI_STATUS
EFIAPI
Entry 1 (at 0xC50, size 32): Primary PSLT with full length 0xC40(
  VOID
);

EFI_STATUS
EFIAPI
0x01, 0x00, 0x00, 0x00,         // Version = 1(
  VOID
);

EFI_STATUS
EFIAPI
= 0xC40 (3136 bytes)(
  VOID
);

EFI_STATUS
EFIAPI
= 0x4E8 (GetSlotCount function)(
  VOID
);

EFI_STATUS
EFIAPI
= 0(
  VOID
);

EFI_STATUS
EFIAPI
= 0x4EC (GetSlotData function)(
  VOID
);

EFI_STATUS
EFIAPI
Entry 2 (at 0xBE0, size 40): Secondary PSLT with length 0xC40(
  VOID
);

EFI_STATUS
EFIAPI
= 0xC40(
  VOID
);

EFI_STATUS
EFIAPI
= 0x4E8(
  VOID
);

EFI_STATUS
EFIAPI
= 0x4EC(
  VOID
);

EFI_STATUS
EFIAPI
Entry 3 (at 0xC18, size 40): Tertiary PSLT with alternate length 0xC08(
  VOID
);

EFI_STATUS
EFIAPI
= 0xC08 (3080 bytes)(
  VOID
);

EFI_STATUS
EFIAPI
Implementations(
  VOID
);

EFI_STATUS
EFIAPI
if the platform type (N3) is 0 or 3, which maps to(
  VOID
);

EFI_STATUS
EFIAPI
"standard/other" slot classification (value 15 = 0x0F).(
  VOID
);

EFI_STATUS
EFIAPI
((SlotNumber == 0) || (SlotNumber == 3)) {(
  VOID
);

EFI_STATUS
EFIAPI
cached protocol if already located.(
  VOID
);

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

EFI_STATUS
EFIAPI
a small test buffer to verify pool availability.(
  VOID
);

EFI_STATUS
EFIAPI
31 with EfiBootServicesData type via gBS->AllocatePool.(
  VOID
);

EFI_STATUS
EFIAPI
allocation of 31 bytes is a probe to verify the UEFI memory(
  VOID
);

EFI_STATUS
EFIAPI
is operational. If the allocation returns > 0x10 bytes(
  VOID
);

EFI_STATUS
EFIAPI
proceed. If the allocation fails or returns <= 0x10 bytes(
  VOID
);

EFI_STATUS
EFIAPI
bail out (return NULL).(
  VOID
);

EFI_STATUS
EFIAPI
the UBA protocol using its GUID.(
  VOID
);

EFI_STATUS
EFIAPI
registration key(
  VOID
);

EFI_STATUS
EFIAPI
the UBA protocol interface (lazy init through cached result).(
  VOID
);

EFI_STATUS
EFIAPI
= (UBA_PROTOCOL *)UbaGetProtocolInterface ();(
  VOID
);

EFI_STATUS
EFIAPI
platform type from RTC CMOS register 0x4B.(
  VOID
);

EFI_STATUS
EFIAPI
preserve bit 7 (NMI mask) of the address register.(
  VOID
);

EFI_STATUS
EFIAPI
= IoRead8 (0x70);(
  VOID
);

EFI_STATUS
EFIAPI
CMOS reg 0x4B(
  VOID
);

EFI_STATUS
EFIAPI
platform type byte(
  VOID
);

EFI_STATUS
EFIAPI
debug routing based on platform type.(
  VOID
);

EFI_STATUS
EFIAPI
(N3 > 3) {(
  VOID
);

EFI_STATUS
EFIAPI
is in valid range > 3, use as-is(
  VOID
);

EFI_STATUS
EFIAPI
type 0: read hardware strap from F000:0490 bit 1, OR with 1(
  VOID
);

EFI_STATUS
EFIAPI
N3 is 1, 2, or 3: use directly(
  VOID
);

EFI_STATUS
EFIAPI
platform type to debug route value.(
  VOID
);

EFI_STATUS
EFIAPI
((N3 - 1) <= 0xFD) {(
  VOID
);

EFI_STATUS
EFIAPI
is 1..3 (valid range check passed)(
  VOID
);

EFI_STATUS
EFIAPI
} else {(
  VOID
);

EFI_STATUS
EFIAPI
}(
  VOID
);

EFI_STATUS
EFIAPI
the debug level matches the routing mask, call UBA debug output.(
  VOID
);

EFI_STATUS
EFIAPI
((DebugRoute & DebugLevel) != 0) {(
  VOID
);

EFI_STATUS
EFIAPI
protocol function index 1 (offset 0x08): DebugPrint(
  VOID
);

EFI_STATUS
EFIAPI
= (UBA_DEBUG_PRINT)(*(UINT64 *)((UINT8 *)Uba + 8));(
  VOID
);

EFI_STATUS
EFIAPI
the UBA protocol and call its assertion handler.(
  VOID
);

EFI_STATUS
EFIAPI
protocol function index 1 (offset 0x08) is the assert handler(
  VOID
);

EFI_STATUS
EFIAPI
takes (FileName, LineNumber, AssertString).(
  VOID
);

EFI_STATUS
EFIAPI
each GUID as two unaligned 64-bit values and compare.(
  VOID
);

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

EFI_STATUS
EFIAPI
+ 104 (0x68) = NumberOfTableEntries (UINTN)(
  VOID
);

EFI_STATUS
EFIAPI
+ 112 (0x70) = ConfigurationTable (EFI_CONFIGURATION_TABLE *)(
  VOID
);

EFI_STATUS
EFIAPI
= *(UINTN *)((UINT8 *)gSystemTable + 104);(
  VOID
);

EFI_STATUS
EFIAPI
the configuration table to find the DXE Services HOB entry.(
  VOID
);

EFI_STATUS
EFIAPI
entry is sizeof(EFI_CONFIGURATION_TABLE) = 24 bytes:(
  VOID
);

EFI_STATUS
EFIAPI
(Index = 0; Index < HobCount; Index++) {(
  VOID
);

EFI_STATUS
EFIAPI
the DXE Services HOB - cache its data pointer.(
  VOID
);

EFI_STATUS
EFIAPI
= *(VOID **)(HobEntries + Index * 24 + 16);(
  VOID
);

EFI_STATUS
EFIAPI
Services HOB not found - report error.(
  VOID
);

EFI_STATUS
EFIAPI
(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", 0x800000000000000EULL);(
  VOID
);

EFI_STATUS
EFIAPI
debug banner identifying this module.(
  VOID
);

EFI_STATUS
EFIAPI
(0x80000000, "UBA:SlotDataUpdate-TypeNeonCityFPGA\n");(
  VOID
);

EFI_STATUS
EFIAPI
the UBA protocol interface.(
  VOID
);

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

EFI_STATUS
EFIAPI
protocol GUID(
  VOID
);

EFI_STATUS
EFIAPI
protocol function index 2 (offset 0x10): SetData(
  VOID
);

EFI_STATUS
EFIAPI
*Data, UINTN DataSize)(
  VOID
);

EFI_STATUS
EFIAPI
= (UBA_SET_DATA)(*(UINT64 *)((UINT8 *)Uba + 16));(
  VOID
);

EFI_STATUS
EFIAPI
PSLT Entry 1: Primary slot table with length 0xC40(
  VOID
);

EFI_STATUS
EFIAPI
= UbaSetData (Uba, &gUbaSlotDataPsl1Guid, (VOID *)mPslEntry1, 32);(
  VOID
);

EFI_STATUS
EFIAPI
PSLT Entry 2: Secondary slot table with length 0xC40(
  VOID
);

EFI_STATUS
EFIAPI
= UbaSetData (Uba, &gUbaSlotDataPsl2Guid, (VOID *)mPslEntry2, 40);(
  VOID
);

EFI_STATUS
EFIAPI
PSLT Entry 3: Tertiary slot table with alternate length 0xC08(
  VOID
);

EFI_STATUS
EFIAPI
= UbaSetData (Uba, &gUbaSlotDataPsl3Guid, (VOID *)mPslEntry3, 40);(
  VOID
);

EFI_STATUS
EFIAPI
UEFI global variables.(
  VOID
);

EFI_STATUS
EFIAPI
= ImageHandle;(
  VOID
);

EFI_STATUS
EFIAPI
the HOB list (cached globally in gHobList).(
  VOID
);

EFI_STATUS
EFIAPI
();(
  VOID
);

EFI_STATUS
EFIAPI
platform-specific slot data via UBA protocol.(
  VOID
);

EFI_STATUS
EFIAPI
= InstallSlotData ();(
  VOID
);

#endif /* __SLOTDATAUPDATEDXENEONCITYFPGA_H__ */