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

Copyright (c) HR650X BIOS Decompilation Project
**/

#ifndef __SMBIOSDATAUPDATEDXECLX64L_H__
#define __SMBIOSDATAUPDATEDXECLX64L_H__

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

//
// Function Prototypes
//

EFI_STATUS
EFIAPI
InstallSmbiosStringTable(
  VOID
);

EFI_STATUS
EFIAPI
InstallSmbiosDataTable(
  VOID
);

EFI_STATUS
EFIAPI
InstallSmbiosMemoryTable(
  VOID
);

EFI_STATUS
EFIAPI
UpdateSmbiosStringPack(
  VOID
);

EFI_STATUS
EFIAPI
SmbiosDataUpdateCallback(
  VOID
);

EFI_STATUS
EFIAPI
SmbiosDataUpdateDxeEntryPoint(
  VOID
);

EFI_STATUS
EFIAPI
variable definitions(
  VOID
);

EFI_STATUS
EFIAPI
handles and protocol interfaces(
  VOID
);

EFI_STATUS
EFIAPI
image handle(
  VOID
);

EFI_STATUS
EFIAPI
to system table(
  VOID
);

EFI_STATUS
EFIAPI
to boot services(
  VOID
);

EFI_STATUS
EFIAPI
to runtime services(
  VOID
);

EFI_STATUS
EFIAPI
protocol interfaces(
  VOID
);

EFI_STATUS
EFIAPI
VOID  *gHiiStringProtocol     = NULL;  // EFI_HII_STRING_PROTOCOL(
  VOID
);

EFI_STATUS
EFIAPI
VOID  *gHiiConfigAccess       = NULL;  // EFI_HII_CONFIG_ACCESS_PROTOCOL(
  VOID
);

EFI_STATUS
EFIAPI
VOID  *gHiiPackageList        = NULL;  // HII Package List Registration(
  VOID
);

EFI_STATUS
EFIAPI
services(
  VOID
);

EFI_STATUS
EFIAPI
VOID  *gHobList               = NULL;  // HOB list pointer(
  VOID
);

EFI_STATUS
EFIAPI
PCI Base Protocol (mPciUsra)(
  VOID
);

EFI_STATUS
EFIAPI
interfaces installed via UBA(
  VOID
);

EFI_STATUS
EFIAPI
string pack handle(
  VOID
);

EFI_STATUS
EFIAPI
language protocol(
  VOID
);

EFI_STATUS
EFIAPI
protocol(
  VOID
);

EFI_STATUS
EFIAPI
Hub protocol(
  VOID
);

EFI_STATUS
EFIAPI
mode flag (set via CMOS check)(
  VOID
);

EFI_STATUS
EFIAPI
output protocol (for DEBUG/ASSERT)(
  VOID
);

EFI_STATUS
EFIAPI
Platform SMBIOS String Table Definition(
  VOID
);

EFI_STATUS
EFIAPI
table defines how SMBIOS string fields are mapped to HII string IDs(
  VOID
);

EFI_STATUS
EFIAPI
the CLX64L platform. Each entry is a 10-byte record:(
  VOID
);

EFI_STATUS
EFIAPI
0-1: HII StringId (UINT16)(
  VOID
);

EFI_STATUS
EFIAPI
2:   Field type encoding(
  VOID
);

EFI_STATUS
EFIAPI
3:   SMBIOS structure sub-type(
  VOID
);

EFI_STATUS
EFIAPI
4-5: Reserved (field size/offset info)(
  VOID
);

EFI_STATUS
EFIAPI
6-9: Reserved(
  VOID
);

EFI_STATUS
EFIAPI
total of 22 entries are defined covering memory, cache, port, slot(
  VOID
);

EFI_STATUS
EFIAPI
device, OEM, and system information SMBIOS types.(
  VOID
);

EFI_STATUS
EFIAPI
Device - Type 17 fields(
  VOID
);

EFI_STATUS
EFIAPI
Memory Array - Type 16 fields(
  VOID
);

EFI_STATUS
EFIAPI
- Type 7 fields(
  VOID
);

EFI_STATUS
EFIAPI
Connector - Type 8 fields(
  VOID
);

EFI_STATUS
EFIAPI
Slots - Type 9 fields(
  VOID
);

EFI_STATUS
EFIAPI
Device - Type 10 (or extended) fields(
  VOID
);

EFI_STATUS
EFIAPI
Strings - Type 11 fields(
  VOID
);

EFI_STATUS
EFIAPI
Information - Type 1 fields(
  VOID
);

EFI_STATUS
EFIAPI
Platform SMBIOS Data Table Definition(
  VOID
);

EFI_STATUS
EFIAPI
table defines the SMBIOS data update entries for SMBIOS types(
  VOID
);

EFI_STATUS
EFIAPI
of platform-specific binary data to be installed.(
  VOID
);

EFI_STATUS
EFIAPI
table is indexed by the SMBIOS type groups and contains raw(
  VOID
);

EFI_STATUS
EFIAPI
structure data with embedded string references.(
  VOID
);

EFI_STATUS
EFIAPI
0 - BIOS Information(
  VOID
);

EFI_STATUS
EFIAPI
1 - System Information(
  VOID
);

EFI_STATUS
EFIAPI
2 - Baseboard Information(
  VOID
);

EFI_STATUS
EFIAPI
3 - System Enclosure(
  VOID
);

EFI_STATUS
EFIAPI
4 - Processor Information(
  VOID
);

EFI_STATUS
EFIAPI
7 - Cache Information(
  VOID
);

EFI_STATUS
EFIAPI
8 - Port Connector Information(
  VOID
);

EFI_STATUS
EFIAPI
9 - System Slots(
  VOID
);

EFI_STATUS
EFIAPI
Platform SMBIOS Memory Data Table Definition(
  VOID
);

EFI_STATUS
EFIAPI
table defines the SMBIOS data update entries for memory-related(
  VOID
);

EFI_STATUS
EFIAPI
types (Type 11, 17, 19, 20). These provide OEM-specific(
  VOID
);

EFI_STATUS
EFIAPI
configuration data and memory device mapping.(
  VOID
);

EFI_STATUS
EFIAPI
11 - OEM Strings (memory-specific)(
  VOID
);

EFI_STATUS
EFIAPI
17 - Memory Device(
  VOID
);

EFI_STATUS
EFIAPI
19 - Memory Array Mapped Address(
  VOID
);

EFI_STATUS
EFIAPI
20 - Memory Device Mapped Address(
  VOID
);

EFI_STATUS
EFIAPI
SMBIOS string structure header:(
  VOID
);

EFI_STATUS
EFIAPI
populate the structure from the string table entry fields(
  VOID
);

EFI_STATUS
EFIAPI
retrieve the actual string data from the HII database.(
  VOID
);

EFI_STATUS
EFIAPI
header (3 bytes)(
  VOID
);

EFI_STATUS
EFIAPI
type(
  VOID
);

EFI_STATUS
EFIAPI
length(
  VOID
);

EFI_STATUS
EFIAPI
handle(
  VOID
);

EFI_STATUS
EFIAPI
string table entry fields into the output buffer.(
  VOID
);

EFI_STATUS
EFIAPI
the SMBIOS string from the HII database for all(
  VOID
);

EFI_STATUS
EFIAPI
languages and format it into the string pack buffer.(
  VOID
);

EFI_STATUS
EFIAPI
EFI_SUCCESS;(
  VOID
);

EFI_STATUS
EFIAPI
the platform SMBIOS data template for the specified(
  VOID
);

EFI_STATUS
EFIAPI
table group into the output buffer. Each data table(
  VOID
);

EFI_STATUS
EFIAPI
contains a complete SMBIOS structure including:(
  VOID
);

EFI_STATUS
EFIAPI
CLX64L, the data table groups are:(
  VOID
);

EFI_STATUS
EFIAPI
the appropriate memory SMBIOS structure:(
  VOID
);

EFI_STATUS
EFIAPI
the string from the HII database via the HII String protocol.(
  VOID
);

EFI_STATUS
EFIAPI
query the required buffer size, then allocate and retrieve.(
  VOID
);

EFI_STATUS
EFIAPI
= 0;(
  VOID
);

EFI_STATUS
EFIAPI
total string data size by iterating through the package list.(
  VOID
);

EFI_STATUS
EFIAPI
package entry consists of:(
  VOID
);

EFI_STATUS
EFIAPI
= (UINT8 **)PackageList;(
  VOID
);

EFI_STATUS
EFIAPI
string data size: total package size minus 4-byte header(
  VOID
);

EFI_STATUS
EFIAPI
= *(UINT32 *)PackageArray[Index] - 4;(
  VOID
);

EFI_STATUS
EFIAPI
the string pack buffer (24-byte header + string data)(
  VOID
);

EFI_STATUS
EFIAPI
= (UINT8 *)AllocateZeroPool (TotalSize + 24);(
  VOID
);

EFI_STATUS
EFIAPI
the string pack header:(
  VOID
);

EFI_STATUS
EFIAPI
((EFI_GUID *)StringPackBuffer, PackageGuid);(
  VOID
);

EFI_STATUS
EFIAPI
string data into the pack buffer, starting at offset 20(
  VOID
);

EFI_STATUS
EFIAPI
*DestPtr = StringPackBuffer + 20;(
  VOID
);

EFI_STATUS
EFIAPI
the terminating 4-byte entry(
  VOID
);

EFI_STATUS
EFIAPI
the string pack with HII database(
  VOID
);

EFI_STATUS
EFIAPI
= gHiiDatabaseProtocol->NewPackageList ((
  VOID
);

EFI_STATUS
EFIAPI
associated with a driver handle(
  VOID
);

EFI_STATUS
EFIAPI
no strings to update, return success(
  VOID
);

EFI_STATUS
EFIAPI
(NumStrings == 0) {(
  VOID
);

EFI_STATUS
EFIAPI
the string pack by retrieving all strings sequentially.(
  VOID
);

EFI_STATUS
EFIAPI
string is null-terminated and concatenated into the output buffer.(
  VOID
);

EFI_STATUS
EFIAPI
buffer format is compatible with SMBIOS string table expectations.(
  VOID
);

EFI_STATUS
EFIAPI
each SMBIOS string from the HII database(
  VOID
);

EFI_STATUS
EFIAPI
= GetSmbiosString ((
  VOID
);

EFI_STATUS
EFIAPI
the buffer as needed(
  VOID
);

EFI_STATUS
EFIAPI
= (CHAR8 *)AllocateZeroPool (TotalBufferSize + StringLen);(
  VOID
);

EFI_STATUS
EFIAPI
the string data(
  VOID
);

EFI_STATUS
EFIAPI
(CurrentOffset > 0) {(
  VOID
);

EFI_STATUS
EFIAPI
the total string size does not exceed the maximum(
  VOID
);

EFI_STATUS
EFIAPI
by the SMBIOS string table format(
  VOID
);

EFI_STATUS
EFIAPI
(TotalBufferSize > SMBIOS_STRING_PACK_BUFFER_SIZE) {(
  VOID
);

EFI_STATUS
EFIAPI
a working buffer for string pack construction.(
  VOID
);

EFI_STATUS
EFIAPI
buffer must be large enough to hold the largest SMBIOS(
  VOID
);

EFI_STATUS
EFIAPI
table entry (768 bytes).(
  VOID
);

EFI_STATUS
EFIAPI
= (UINT8 *)AllocateZeroPool (SMBIOS_STRING_PACK_BUFFER_SIZE);(
  VOID
);

EFI_STATUS
EFIAPI
1: Install SMBIOS String Table Entries(
  VOID
);

EFI_STATUS
EFIAPI
through all 30 (0x1E) string table entries and install(
  VOID
);

EFI_STATUS
EFIAPI
one by formatting the SMBIOS structure and adding string(
  VOID
);

EFI_STATUS
EFIAPI
from the HII database.(
  VOID
);

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

EFI_STATUS
EFIAPI
formatted string table entry is ready for installation.(
  VOID
);

EFI_STATUS
EFIAPI
it to the SMBIOS table via the string pack mechanism.(
  VOID
);

EFI_STATUS
EFIAPI
((
  VOID
);

EFI_STATUS
EFIAPI
2: Install SMBIOS Data Table Entries(
  VOID
);

EFI_STATUS
EFIAPI
Type 0-9 data tables for the CLX64L platform.(
  VOID
);

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

EFI_STATUS
EFIAPI
3: Install SMBIOS Memory Data Table Entries(
  VOID
);

EFI_STATUS
EFIAPI
Type 11, 17, 19, 20 memory data tables.(
  VOID
);

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

EFI_STATUS
EFIAPI
is accomplished by sending an end marker via the string(
  VOID
);

EFI_STATUS
EFIAPI
to terminate the SMBIOS string pack.(
  VOID
);

EFI_STATUS
EFIAPI
(WorkBuffer);(
  VOID
);

EFI_STATUS
EFIAPI
the global UEFI handles(
  VOID
);

EFI_STATUS
EFIAPI
= ImageHandle;(
  VOID
);

EFI_STATUS
EFIAPI
HII Database Protocol(
  VOID
);

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

EFI_STATUS
EFIAPI
HII String Protocol(
  VOID
);

EFI_STATUS
EFIAPI
HII Config Routing Protocol(
  VOID
);

EFI_STATUS
EFIAPI
the DXE Services Table via the configuration table(
  VOID
);

EFI_STATUS
EFIAPI
= EfiGetSystemConfigurationTable ((
  VOID
);

EFI_STATUS
EFIAPI
the HOB List via configuration table(
  VOID
);

EFI_STATUS
EFIAPI
the MM PCI Base Protocol (for PCI configuration access)(
  VOID
);

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

EFI_STATUS
EFIAPI
with UBA to install the CLX64L SMBIOS platform data(
  VOID
);

EFI_STATUS
EFIAPI
= UbaSmbiosUpdateLibRegister ((
  VOID
);

#endif /* __SMBIOSDATAUPDATEDXECLX64L_H__ */