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

Copyright (c) HR650X BIOS Decompilation Project
**/

#ifndef __SMBIOSDATAUPDATEDXELIGHTNINGRIDGEEXECB3_H__
#define __SMBIOSDATAUPDATEDXELIGHTNINGRIDGEEXECB3_H__

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

//
// Function Prototypes
//

EFI_STATUS
EFIAPI
InternalReadUint32(
  VOID
);

EFI_STATUS
EFIAPI
InternalReadUint64(
  VOID
);

EFI_STATUS
EFIAPI
InternalWriteUint64(
  VOID
);

EFI_STATUS
EFIAPI
InternalCompareGuid(
  VOID
);

EFI_STATUS
EFIAPI
InternalAssert(
  VOID
);

EFI_STATUS
EFIAPI
InternalDebugPrint(
  VOID
);

EFI_STATUS
EFIAPI
InternalFreePool(
  VOID
);

EFI_STATUS
EFIAPI
InternalLocateConfigTable(
  VOID
);

EFI_STATUS
EFIAPI
InternalGetPlatformLanguage(
  VOID
);

EFI_STATUS
EFIAPI
BuildSmbiosType41Record(
  VOID
);

EFI_STATUS
EFIAPI
InternalUnicodeToAscii(
  VOID
);

EFI_STATUS
EFIAPI
InternalAsciiStrLen(
  VOID
);

EFI_STATUS
EFIAPI
InternalUnicodeStrSize(
  VOID
);

EFI_STATUS
EFIAPI
InternalAsciiStrSize(
  VOID
);

EFI_STATUS
EFIAPI
InternalUnicodeStrLen(
  VOID
);

EFI_STATUS
EFIAPI
IoRead8(
  VOID
);

EFI_STATUS
EFIAPI
IoWrite8(
  VOID
);

EFI_STATUS
EFIAPI
BuildAndAddSmbiosType41(
  VOID
);

EFI_STATUS
EFIAPI
GetSmbiosStructureSize(
  VOID
);

EFI_STATUS
EFIAPI
AddSmbiosRecord(
  VOID
);

EFI_STATUS
EFIAPI
UpdateSmbiosType41Entry(
  VOID
);

EFI_STATUS
EFIAPI
ProcessSlotConfiguration(
  VOID
);

EFI_STATUS
EFIAPI
InternalGetSmbiosStructureTotalSize(
  VOID
);

EFI_STATUS
EFIAPI
CallSmbiosUpdateProtocol(
  VOID
);

EFI_STATUS
EFIAPI
SmbiosDataUpdateCallback(
  VOID
);

EFI_STATUS
EFIAPI
InitializeSmbiosDataUpdateDxe(
  VOID
);

EFI_STATUS
EFIAPI
SmbiosDataUpdateEntry(
  VOID
);

EFI_STATUS
EFIAPI
UefiDriverEntryPoint(
  VOID
);

EFI_STATUS
EFIAPI
protocol pointers obtained during initialization(
  VOID
);

EFI_STATUS
EFIAPI
gImageHandle             = NULL;(
  VOID
);

EFI_STATUS
EFIAPI
List pointer (obtained from DxeHobLib)(
  VOID
);

EFI_STATUS
EFIAPI
*mHobList                 = NULL;(
  VOID
);

EFI_STATUS
EFIAPI
HOB list is not available, this is a fatal error(
  VOID
);

EFI_STATUS
EFIAPI
(FALSE);(
  VOID
);

EFI_STATUS
EFIAPI
total string data size by iterating through the UBA config(
  VOID
);

EFI_STATUS
EFIAPI
pointers (NULL-terminated array of pointers).(
  VOID
);

EFI_STATUS
EFIAPI
= (UINT32 *)UbaConfigData;(
  VOID
);

EFI_STATUS
EFIAPI
the HII string package:(
  VOID
);

EFI_STATUS
EFIAPI
(24 bytes) + string data + null terminator (4 bytes)(
  VOID
);

EFI_STATUS
EFIAPI
= TotalStringSize + 24 + 4;(
  VOID
);

EFI_STATUS
EFIAPI
the HII package header with the GUID from UBA config(
  VOID
);

EFI_STATUS
EFIAPI
(StringPackage, UbaConfigData, sizeof (EFI_GUID));(
  VOID
);

EFI_STATUS
EFIAPI
string data from the UBA config block(
  VOID
);

EFI_STATUS
EFIAPI
= TotalStringSize;(
  VOID
);

EFI_STATUS
EFIAPI
string content (skip the 4-byte size prefix)(
  VOID
);

EFI_STATUS
EFIAPI
((
  VOID
);

EFI_STATUS
EFIAPI
the double-null terminator for the string package(
  VOID
);

EFI_STATUS
EFIAPI
the HII string package(
  VOID
);

EFI_STATUS
EFIAPI
updates the HII database with our board-specific strings.(
  VOID
);

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

EFI_STATUS
EFIAPI
call to get the required buffer size(
  VOID
);

EFI_STATUS
EFIAPI
= 0;(
  VOID
);

EFI_STATUS
EFIAPI
the buffer for the language string(
  VOID
);

EFI_STATUS
EFIAPI
= InternalAllocateZeroPool (BufferSize);(
  VOID
);

EFI_STATUS
EFIAPI
the variable(
  VOID
);

EFI_STATUS
EFIAPI
= gRuntimeServices->GetVariable ((
  VOID
);

EFI_STATUS
EFIAPI
from Unicode to ASCII(
  VOID
);

EFI_STATUS
EFIAPI
variable not found - not fatal, return EFI_NOT_FOUND(
  VOID
);

EFI_STATUS
EFIAPI
the supported languages list(
  VOID
);

EFI_STATUS
EFIAPI
(Match = SupportedLanguages; *Match != '\0'; ) {(
  VOID
);

EFI_STATUS
EFIAPI
delimiters (semicolons)(
  VOID
);

EFI_STATUS
EFIAPI
(*Match == ';') {(
  VOID
);

EFI_STATUS
EFIAPI
the length of this language tag(
  VOID
);

EFI_STATUS
EFIAPI
if the language starts with a 3-letter prefix match(
  VOID
);

EFI_STATUS
EFIAPI
matches the full RFC 4646 language code(
  VOID
);

EFI_STATUS
EFIAPI
((LangLen >= 3) && (AsciiStrnCmp (Match, Lang, 3) == 0)) {(
  VOID
);

EFI_STATUS
EFIAPI
a match - return a copy(
  VOID
);

EFI_STATUS
EFIAPI
*LanguageString;(
  VOID
);

EFI_STATUS
EFIAPI
Type 41 (Onboard Devices Extended Information) string table(
  VOID
);

EFI_STATUS
EFIAPI
entry is a 10-byte record containing:(
  VOID
);

EFI_STATUS
EFIAPI
table encodes the mapping between HII string IDs and(
  VOID
);

EFI_STATUS
EFIAPI
corresponding SMBIOS Type 41 device data for this board.(
  VOID
);

EFI_STATUS
EFIAPI
0 entry reference structure (10 bytes):(
  VOID
);

EFI_STATUS
EFIAPI
device configuration data for this board is encoded as(
  VOID
);

EFI_STATUS
EFIAPI
table of fixed-size records in the .data section.(
  VOID
);

EFI_STATUS
EFIAPI
each entry, we extract:(
  VOID
);

EFI_STATUS
EFIAPI
are resolved against the HII string package installed(
  VOID
);

EFI_STATUS
EFIAPI
initialization to produce the actual ASCII strings.(
  VOID
);

EFI_STATUS
EFIAPI
string table format is:(
  VOID
);

EFI_STATUS
EFIAPI
{(
  VOID
);

EFI_STATUS
EFIAPI
StringId;       // +0: HII string reference(
  VOID
);

EFI_STATUS
EFIAPI
DevType;        // +2: device type(
  VOID
);

EFI_STATUS
EFIAPI
Instance;       // +3: reserved/instance(
  VOID
);

EFI_STATUS
EFIAPI
SegmentBus;     // +4: segment group (high) + bus (low)(
  VOID
);

EFI_STATUS
EFIAPI
DevFunc;        // +6: PCI device (high nibble) + function (low nibble)(
  VOID
);

EFI_STATUS
EFIAPI
Reserved;       // +7: reserved(
  VOID
);

EFI_STATUS
EFIAPI
Reserved2;      // +8: reserved(
  VOID
);

EFI_STATUS
EFIAPI
table entries are indexed differently for Type 41 (primary)(
  VOID
);

EFI_STATUS
EFIAPI
secondary device data in the HII strings.(
  VOID
);

EFI_STATUS
EFIAPI
Type 41, the HII string reference is in a different(
  VOID
);

EFI_STATUS
EFIAPI
than for Type 9. The device string reference has(
  VOID
);

EFI_STATUS
EFIAPI
format:(
  VOID
);

EFI_STATUS
EFIAPI
string table is indexed by TableIndex and the result(
  VOID
);

EFI_STATUS
EFIAPI
on which SMBIOS type we're building.(
  VOID
);

EFI_STATUS
EFIAPI
from the UBA configuration table.(
  VOID
);

EFI_STATUS
EFIAPI
EFI_UNSUPPORTED;(
  VOID
);

EFI_STATUS
EFIAPI
Type 41 (Onboard Device) string table data for LightningRidge EX EC B3(
  VOID
);

EFI_STATUS
EFIAPI
10-byte record encodes one onboard device's string reference and(
  VOID
);

EFI_STATUS
EFIAPI
Type 41 fields.(
  VOID
);

EFI_STATUS
EFIAPI
Type 41 secondary entries, the string reference is 0x0000 and the(
  VOID
);

EFI_STATUS
EFIAPI
instance + bus/segment data are at different offsets.(
  VOID
);

EFI_STATUS
EFIAPI
no HII string handle is available, skip SMBIOS table creation(
  VOID
);

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

EFI_STATUS
EFIAPI
the Unicode strings from HII(
  VOID
);

EFI_STATUS
EFIAPI
(FirstStringId != 0) {(
  VOID
);

EFI_STATUS
EFIAPI
the HII string(
  VOID
);

EFI_STATUS
EFIAPI
= InternalAllocateZeroPool (SMBIOS_STRING_MAX_LEN);(
  VOID
);

EFI_STATUS
EFIAPI
from HII string to ASCII(
  VOID
);

EFI_STATUS
EFIAPI
HII String protocol to a CHAR16, then to CHAR8)(
  VOID
);

EFI_STATUS
EFIAPI
now, just copy the reference name as a placeholder(
  VOID
);

EFI_STATUS
EFIAPI
the SMBIOS Type 41 record(
  VOID
);

EFI_STATUS
EFIAPI
formatted area includes:(
  VOID
);

EFI_STATUS
EFIAPI
Status;(
  VOID
);

EFI_STATUS
EFIAPI
the double-null terminator(
  VOID
);

EFI_STATUS
EFIAPI
existing entries of this type to allow replacing data.(
  VOID
);

EFI_STATUS
EFIAPI
SMBIOS protocol's Remove function will be called for each(
  VOID
);

EFI_STATUS
EFIAPI
entry.(
  VOID
);

EFI_STATUS
EFIAPI
= SMBIOS_HANDLE_PI_RESERVED;(
  VOID
);

EFI_STATUS
EFIAPI
device type and PCI address from the configuration data.(
  VOID
);

EFI_STATUS
EFIAPI
configuration table at sub_77C uses board-specific values(
  VOID
);

EFI_STATUS
EFIAPI
from string table entries.(
  VOID
);

EFI_STATUS
EFIAPI
each entry (0..29):(
  VOID
);

EFI_STATUS
EFIAPI
device designation and secondary/alternate)(
  VOID
);

EFI_STATUS
EFIAPI
record is built and submitted to the SMBIOS protocol.(
  VOID
);

EFI_STATUS
EFIAPI
and add the primary record(
  VOID
);

EFI_STATUS
EFIAPI
= BuildAndAddSmbiosType41 ((
  VOID
);

EFI_STATUS
EFIAPI
string ID from config(
  VOID
);

EFI_STATUS
EFIAPI
a secondary device string is defined (non-zero string ID)(
  VOID
);

EFI_STATUS
EFIAPI
and add the secondary record too.(
  VOID
);

EFI_STATUS
EFIAPI
the configuration table entry.(
  VOID
);

EFI_STATUS
EFIAPI
entry encodes the SMBIOS slot/device parameters for(
  VOID
);

EFI_STATUS
EFIAPI
LightningRidge EX EC B3 board layout:(
  VOID
);

EFI_STATUS
EFIAPI
Type 41 entries:(
  VOID
);

EFI_STATUS
EFIAPI
secondary string is tested separately. If it exists(
  VOID
);

EFI_STATUS
EFIAPI
second SMBIOS entry is created with the alternate string.(
  VOID
);

EFI_STATUS
EFIAPI
= gHiiString->GetString ((
  VOID
);

EFI_STATUS
EFIAPI
strings until we hit double-null(
  VOID
);

EFI_STATUS
EFIAPI
(TRUE) {(
  VOID
);

EFI_STATUS
EFIAPI
through the SmbiosUpdate protocol entry point.(
  VOID
);

EFI_STATUS
EFIAPI
protocol's function pointer is at offset +16.(
  VOID
);

EFI_STATUS
EFIAPI
= UpdateProtocol->Callback ((
  VOID
);

EFI_STATUS
EFIAPI
a working buffer for building SMBIOS records(
  VOID
);

EFI_STATUS
EFIAPI
multiple strings).(
  VOID
);

EFI_STATUS
EFIAPI
= InternalAllocateZeroPool (SMBIOS_RECORD_MAX_SIZE);(
  VOID
);

EFI_STATUS
EFIAPI
1: Update SMBIOS Type 41 entries (Onboard Devices Extended)(
  VOID
);

EFI_STATUS
EFIAPI
board has 30 onboard device entries with associated HII strings.(
  VOID
);

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

EFI_STATUS
EFIAPI
2: Update SMBIOS Type 9 entries (System Slots)(
  VOID
);

EFI_STATUS
EFIAPI
8 system slot definitions for this board.(
  VOID
);

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

EFI_STATUS
EFIAPI
SMBIOS Type 9 record...(
  VOID
);

EFI_STATUS
EFIAPI
3: Update SMBIOS Type 43 entries (TPM Device)(
  VOID
);

EFI_STATUS
EFIAPI
device configuration for this board variant.(
  VOID
);

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

EFI_STATUS
EFIAPI
SMBIOS Type 43 record...(
  VOID
);

EFI_STATUS
EFIAPI
//(
  VOID
);

EFI_STATUS
EFIAPI
1: Save ImageHandle and SystemTable(
  VOID
);

EFI_STATUS
EFIAPI
= ImageHandle;(
  VOID
);

EFI_STATUS
EFIAPI
2: Locate HII Database protocol(
  VOID
);

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

EFI_STATUS
EFIAPI
3: Locate HII String protocol(
  VOID
);

EFI_STATUS
EFIAPI
4: Locate HII Config Routing protocol(
  VOID
);

EFI_STATUS
EFIAPI
5: Locate HII Font protocol(
  VOID
);

EFI_STATUS
EFIAPI
6: Locate HII Runtime protocol(
  VOID
);

EFI_STATUS
EFIAPI
7: Locate the DxeServicesTable from the system configuration table(
  VOID
);

EFI_STATUS
EFIAPI
= InternalLocateConfigTable (&gDxeServicesTableGuid, &gDs);(
  VOID
);

EFI_STATUS
EFIAPI
8: Initialize HOB list pointer(
  VOID
);

EFI_STATUS
EFIAPI
= InternalGetHobList ();(
  VOID
);

EFI_STATUS
EFIAPI
9: Locate the MM PCI Base protocol for memory-mapped PCI access(
  VOID
);

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

EFI_STATUS
EFIAPI
1: Initialize the driver (locate protocols, etc.)(
  VOID
);

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

EFI_STATUS
EFIAPI
2: Display the board GUID for debugging(
  VOID
);

EFI_STATUS
EFIAPI
((EFI_D_INFO, "UBA:SmbiosDataUpdateEntry Image GUID=%g\n", &gSmbiosDataUpdateBoardGuid));(
  VOID
);

EFI_STATUS
EFIAPI
3: Install the HII string package for this board(
  VOID
);

EFI_STATUS
EFIAPI
= InternalInstallSmbiosStringPack ((
  VOID
);

EFI_STATUS
EFIAPI
4: Look up the UBA SMBIOS Update protocol(
  VOID
);

EFI_STATUS
EFIAPI
the UBA SMBIOS Update protocol(
  VOID
);

EFI_STATUS
EFIAPI
5: Register the callback with the UBA framework(
  VOID
);

EFI_STATUS
EFIAPI
UBA SMBIOS Update protocol provides a callback registration(
  VOID
);

EFI_STATUS
EFIAPI
at offset +16 in the protocol structure. It takes:(
  VOID
);

EFI_STATUS
EFIAPI
= gSmbiosUpdateProtocol->Callback ((
  VOID
);

#endif /* __SMBIOSDATAUPDATEDXELIGHTNINGRIDGEEXECB3_H__ */