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

Copyright (c) HR650X BIOS Decompilation Project
**/

#ifndef __STATICSKUDATADXECLX64L_H__
#define __STATICSKUDATADXECLX64L_H__

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

//
// Function Prototypes
//

EFI_STATUS
EFIAPI
GetSkuTypeFromCmos(
  VOID
);

EFI_STATUS
EFIAPI
DebugPrint(
  VOID
);

EFI_STATUS
EFIAPI
CompareGuidField(
  VOID
);

EFI_STATUS
EFIAPI
ReadUnaligned64(
  VOID
);

EFI_STATUS
EFIAPI
StaticSkuDataDxeEntryPoint(
  VOID
);

EFI_STATUS
EFIAPI
Variables(
  VOID
);

EFI_STATUS
EFIAPI
handle for this driver image (set by ModuleEntryPoint)(
  VOID
);

EFI_STATUS
EFIAPI
gImageHandle = NULL;(
  VOID
);

EFI_STATUS
EFIAPI
to the UEFI System Table (set by ModuleEntryPoint)(
  VOID
);

EFI_STATUS
EFIAPI
*gSystemTable = NULL;(
  VOID
);

EFI_STATUS
EFIAPI
to the UEFI Boot Services Table (set by ModuleEntryPoint)(
  VOID
);

EFI_STATUS
EFIAPI
*gBootServices = NULL;(
  VOID
);

EFI_STATUS
EFIAPI
to the UEFI Runtime Services Table (set by ModuleEntryPoint)(
  VOID
);

EFI_STATUS
EFIAPI
*gRuntimeServices = NULL;(
  VOID
);

EFI_STATUS
EFIAPI
notification handle for the SKU Data Protocol(
  VOID
);

EFI_STATUS
EFIAPI
*mSkuDataProtocolNotifyHandle = NULL;(
  VOID
);

EFI_STATUS
EFIAPI
(Hand-Off Block) list pointer retrieved from SystemTable(
  VOID
);

EFI_STATUS
EFIAPI
*mHobList = NULL;(
  VOID
);

EFI_STATUS
EFIAPI
Method Name Strings for CCT (CPU C-State Control Table) Entries(
  VOID
);

EFI_STATUS
EFIAPI
ACPI method names are used by platform AML code to query per-core(
  VOID
);

EFI_STATUS
EFIAPI
CLX64L platform provides individual C-state control tables for(
  VOID
);

EFI_STATUS
EFIAPI
logical processor grouping.(
  VOID
);

EFI_STATUS
EFIAPI
CHAR8  *mCctMethodNames[MAX_CCT_ENTRIES] = {(
  VOID
);

EFI_STATUS
EFIAPI
C-State Control Table Entry 0(
  VOID
);

EFI_STATUS
EFIAPI
C-State Control Table Entry 1(
  VOID
);

EFI_STATUS
EFIAPI
C-State Control Table Entry 2(
  VOID
);

EFI_STATUS
EFIAPI
C-State Control Table Entry 3(
  VOID
);

EFI_STATUS
EFIAPI
C-State Control Table Entry 4(
  VOID
);

EFI_STATUS
EFIAPI
C-State Control Table Entry 5(
  VOID
);

EFI_STATUS
EFIAPI
C-State Control Table Entry 6(
  VOID
);

EFI_STATUS
EFIAPI
C-State Control Table Entry 7(
  VOID
);

EFI_STATUS
EFIAPI
C-State Control Table Entry 8(
  VOID
);

EFI_STATUS
EFIAPI
method name for CPU Fan Health monitoring(
  VOID
);

EFI_STATUS
EFIAPI
CHAR8  *mCfh0MethodName = "_SB_.CFH0";(
  VOID
);

EFI_STATUS
EFIAPI
SKU Configuration Data Tables(
  VOID
);

EFI_STATUS
EFIAPI
following data occupies the .data section from 0x4060 through ~0xF560(
  VOID
);

EFI_STATUS
EFIAPI
exact structure of these tables is generated by the Intel/AMI(
  VOID
);

EFI_STATUS
EFIAPI
generation tools and is platform-specific to CLX64L.(
  VOID
);

EFI_STATUS
EFIAPI
SKU configuration payload. This includes per-SKU entries for(
  VOID
);

EFI_STATUS
EFIAPI
management, memory map, PCIe lane configuration, and(
  VOID
);

EFI_STATUS
EFIAPI
management settings. The data layout follows the Intel(
  VOID
);

EFI_STATUS
EFIAPI
Support Package (FSP) SKU data format.(
  VOID
);

EFI_STATUS
EFIAPI
Implementations(
  VOID
);

EFI_STATUS
EFIAPI
a small pool buffer (31 bytes) to satisfy LocateProtocol(
  VOID
);

EFI_STATUS
EFIAPI
on some firmware implementations. Free it immediately(
  VOID
);

EFI_STATUS
EFIAPI
the call since we only need the protocol interface pointer.(
  VOID
);

EFI_STATUS
EFIAPI
= gBootServices->AllocatePool (31);(
  VOID
);

EFI_STATUS
EFIAPI
that the allocated pool pointer is valid (at least 16 bytes(
  VOID
);

EFI_STATUS
EFIAPI
addressable space). If the allocation was too small or the system(
  VOID
);

EFI_STATUS
EFIAPI
in a constrained state, bail out.(
  VOID
);

EFI_STATUS
EFIAPI
((UINTN)PoolBuffer <= 0x10) {(
  VOID
);

EFI_STATUS
EFIAPI
the SKU Data Protocol interface(
  VOID
);

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

EFI_STATUS
EFIAPI
the SKU type to unknown(
  VOID
);

EFI_STATUS
EFIAPI
= SKU_TYPE_UNKNOWN;(
  VOID
);

EFI_STATUS
EFIAPI
CMOS register 0x4B while preserving NMI enable bit(
  VOID
);

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

EFI_STATUS
EFIAPI
(CPU C-State Control Table) version interpretation(
  VOID
);

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

EFI_STATUS
EFIAPI
CCT version > 3: use the CMOS register value directly(
  VOID
);

EFI_STATUS
EFIAPI
= CmosValue;(
  VOID
);

EFI_STATUS
EFIAPI
version 0 (uninitialized): determine SKU from hardware strap(
  VOID
);

EFI_STATUS
EFIAPI
platform strap at fixed address 0xFDAF0490 (PCH/CPU register)(
  VOID
);

EFI_STATUS
EFIAPI
bit 1 to determine SKU variant.(
  VOID
);

EFI_STATUS
EFIAPI
= *(UINT64 *)0xFDAF0490;(
  VOID
);

EFI_STATUS
EFIAPI
the raw CCT value to the platform SKU type:(
  VOID
);

EFI_STATUS
EFIAPI
== 1 -> SKU type 2 (0x80000004 >> 24)(
  VOID
);

EFI_STATUS
EFIAPI
== 2 -> SKU type 2 (0x80000006 >> 24, same effective type)(
  VOID
);

EFI_STATUS
EFIAPI
-> SKU type 4 (default)(
  VOID
);

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

EFI_STATUS
EFIAPI
the debug protocol(
  VOID
);

EFI_STATUS
EFIAPI
= LocateSkuDataProtocol ();(
  VOID
);

EFI_STATUS
EFIAPI
the debug protocol's output function (offset +8 from interface)(
  VOID
);

EFI_STATUS
EFIAPI
= (EFI_DEBUG_PROTOCOL *)DebugProtocol;(
  VOID
);

EFI_STATUS
EFIAPI
first call, locate the HOB list from the System Table(
  VOID
);

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

EFI_STATUS
EFIAPI
HOB list pointer is stored at offset +104 from the System Table(
  VOID
);

EFI_STATUS
EFIAPI
= NULL;(
  VOID
);

EFI_STATUS
EFIAPI
the HOB list to find a HOB whose GUID matches(
  VOID
);

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

EFI_STATUS
EFIAPI
the matching HOB, store its GUID-specific field (+16)(
  VOID
);

EFI_STATUS
EFIAPI
= *(VOID **)((UINT8 *)Hob.Raw + 16);(
  VOID
);

EFI_STATUS
EFIAPI
no matching HOB found, assert and leave mHobList as NULL(
  VOID
);

EFI_STATUS
EFIAPI
compare the second qword (GUID.Data4 field range)(
  VOID
);

EFI_STATUS
EFIAPI
= ReadUnaligned64 ((UINT8 *)Buffer1 + 8);(
  VOID
);

EFI_STATUS
EFIAPI
that the buffer pointer is valid(
  VOID
);

EFI_STATUS
EFIAPI
(Buffer != NULL);(
  VOID
);

EFI_STATUS
EFIAPI
the unaligned 64-bit value directly(
  VOID
);

EFI_STATUS
EFIAPI
platform must support unaligned access (x64 does)(
  VOID
);

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

EFI_STATUS
EFIAPI
ImageHandle globally for later use(
  VOID
);

EFI_STATUS
EFIAPI
= ImageHandle;(
  VOID
);

EFI_STATUS
EFIAPI
SystemTable pointer globally(
  VOID
);

EFI_STATUS
EFIAPI
= SystemTable;(
  VOID
);

EFI_STATUS
EFIAPI
Boot Services Table pointer globally(
  VOID
);

EFI_STATUS
EFIAPI
= SystemTable->BootServices;(
  VOID
);

EFI_STATUS
EFIAPI
Runtime Services Table pointer globally(
  VOID
);

EFI_STATUS
EFIAPI
= SystemTable->RuntimeServices;(
  VOID
);

EFI_STATUS
EFIAPI
the HOB list cache for SKU data lookup(
  VOID
);

EFI_STATUS
EFIAPI
(NULL);(
  VOID
);

EFI_STATUS
EFIAPI
protocol instance data (gSkuDataProtocolInstance) contains the(
  VOID
);

EFI_STATUS
EFIAPI
SKU configuration tables for the CLX64L platform.(
  VOID
);

EFI_STATUS
EFIAPI
protocol notify to allow SKU data consumers to connect(
  VOID
);

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

EFI_STATUS
EFIAPI
the full SKU configuration interface(
  VOID
);

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

#endif /* __STATICSKUDATADXECLX64L_H__ */