/** @file
DataHubDxe.h -- Header for DataHubDxe
Copyright (c) HR650X BIOS Decompilation Project
**/
#ifndef __DATAHUBDXE_H__
#define __DATAHUBDXE_H__
#include "../uefi_headers/Uefi.h"
//
// Function Prototypes
//
EFI_STATUS
EFIAPI
InternalBaseLibIsListValid(
VOID
);
EFI_STATUS
EFIAPI
CompareGuid(
VOID
);
EFI_STATUS
EFIAPI
FreePool(
VOID
);
EFI_STATUS
EFIAPI
ReadUnaligned64(
VOID
);
EFI_STATUS
EFIAPI
EfiAcquireLock(
VOID
);
EFI_STATUS
EFIAPI
EfiReleaseLock(
VOID
);
EFI_STATUS
EFIAPI
DataHubLogData(
VOID
);
EFI_STATUS
EFIAPI
DataHubGetNextDataRecord(
VOID
);
EFI_STATUS
EFIAPI
DataHubRegisterDataClass(
VOID
);
EFI_STATUS
EFIAPI
DataHubUnregisterDataClass(
VOID
);
EFI_STATUS
EFIAPI
DebugPrintWithCmosCheck(
VOID
);
EFI_STATUS
EFIAPI
DebugAssert(
VOID
);
EFI_STATUS
EFIAPI
HobLibConstructor(
VOID
);
EFI_STATUS
EFIAPI
DataHubDriverEntryPoint(
VOID
);
EFI_STATUS
EFIAPI
ModuleEntryPoint(
VOID
);
EFI_STATUS
EFIAPI
globals provided by UEFI boot/runtime services tables(
VOID
);
EFI_STATUS
EFIAPI
EFI_SYSTEM_TABLE *gST;(
VOID
);
EFI_STATUS
EFIAPI
globals (reside in .data section)(
VOID
);
EFI_STATUS
EFIAPI
CONST EFI_GUID gEfiDataHubProtocolGuid =(
VOID
);
EFI_STATUS
EFIAPI
driver instance (DATA_HUB_PRIVATE_DATA)(
VOID
);
EFI_STATUS
EFIAPI
DATA_HUB_PRIVATE_DATA mPrivateData;(
VOID
);
EFI_STATUS
EFIAPI
pointers for DataHub protocol methods installed in(
VOID
);
EFI_STATUS
EFIAPI
protocol structure (indexed from mPrivateData.DataHubProtocol).(
VOID
);
EFI_STATUS
EFIAPI
are stored separately and referenced by the protocol dispatch.(
VOID
);
EFI_STATUS
EFIAPI
VOID *mHobList; // qword_19C8(
VOID
);
EFI_STATUS
EFIAPI
STATIC EFI_EVENT mDataHubEvent; // qword_19E8(
VOID
);
EFI_STATUS
EFIAPI
(not set at init)(
VOID
);
EFI_STATUS
EFIAPI
fields layout:(
VOID
);
EFI_STATUS
EFIAPI
Signature (set to DATA_HUB_PRIVATE_SIGNATURE = 0x4453424C "LBSD")(
VOID
);
EFI_STATUS
EFIAPI
Reserved(
VOID
);
EFI_STATUS
EFIAPI
EFI_DATA_HUB_PROTOCOL (4 function pointers + protocol header)(
VOID
);
EFI_STATUS
EFIAPI
LogData -> DataHubLogData(
VOID
);
EFI_STATUS
EFIAPI
GetNextDataRecord -> DataHubGetNextDataRecord(
VOID
);
EFI_STATUS
EFIAPI
RegisterDataClass -> DataHubRegisterDataClass(
VOID
);
EFI_STATUS
EFIAPI
UnregisterDataClass-> DataHubUnregisterDataClass(
VOID
);
EFI_STATUS
EFIAPI
EFI_LOCK DataLock(
VOID
);
EFI_STATUS
EFIAPI
Tpl (initialised to 16)(
VOID
);
EFI_STATUS
EFIAPI
OwnerTpl(
VOID
);
EFI_STATUS
EFIAPI
Lock (initialised to 1 = EfiLockReleased)(
VOID
);
EFI_STATUS
EFIAPI
TotalMonotonicCount (running count)(
VOID
);
EFI_STATUS
EFIAPI
DataRecordListHead (self-referential LIST_ENTRY)(
VOID
);
EFI_STATUS
EFIAPI
Flink -> 0x50(
VOID
);
EFI_STATUS
EFIAPI
Blink -> 0x50(
VOID
);
EFI_STATUS
EFIAPI
DataClassListHead (self-referential LIST_ENTRY)(
VOID
);
EFI_STATUS
EFIAPI
Flink -> 0x60(
VOID
);
EFI_STATUS
EFIAPI
Blink -> 0x60(
VOID
);
EFI_STATUS
EFIAPI
Reserved / extra fields(
VOID
);
EFI_STATUS
EFIAPI
helper: Get the DATA_HUB_PRIVATE_DATA* from a protocol* pointer(
VOID
);
EFI_STATUS
EFIAPI
the CR macro pattern.(
VOID
);
EFI_STATUS
EFIAPI
()(
VOID
);
EFI_STATUS
EFIAPI
EFIAPI(
VOID
);
EFI_STATUS
EFIAPI
Entry at the tail of the doubly-linked list headed by ListHead.(
VOID
);
EFI_STATUS
EFIAPI
BaseLib's InsertTailList().(
VOID
);
EFI_STATUS
EFIAPI
*(
VOID
);
EFI_STATUS
EFIAPI
the first node in List (List->Flink).(
VOID
);
EFI_STATUS
EFIAPI
the node after Node in List.(
VOID
);
EFI_STATUS
EFIAPI
Entry from its doubly-linked list.(
VOID
);
EFI_STATUS
EFIAPI
copy wrapper. Delegates to InternalCopyMem for the actual copy(
VOID
);
EFI_STATUS
EFIAPI
checking for overlap and validating pointers.(
VOID
);
EFI_STATUS
EFIAPI
zeroing wrapper. Delegates to InternalZeroMem.(
VOID
);
EFI_STATUS
EFIAPI
two GUIDs by comparing their 64-bit halves.(
VOID
);
EFI_STATUS
EFIAPI
boot-services memory pool of type EfiBootServicesData.(
VOID
);
EFI_STATUS
EFIAPI
a memory pool allocation. Asserts on error.(
VOID
);
EFI_STATUS
EFIAPI
a UINT64 from an unaligned pointer.(
VOID
);
EFI_STATUS
EFIAPI
the task priority level (TPL) to Lock->Tpl and mark the lock(
VOID
);
EFI_STATUS
EFIAPI
acquired. Asserts if the lock is already held or uninitialised.(
VOID
);
EFI_STATUS
EFIAPI
the TPL to the saved OwnerTpl and mark the lock as released.(
VOID
);
EFI_STATUS
EFIAPI
if the lock was not acquired.(
VOID
);
EFI_STATUS
EFIAPI
memory from source to destination, handling forward/backward copies(
VOID
);
EFI_STATUS
EFIAPI
support overlapping buffers. Uses 8-byte qmemcpy where possible.(
VOID
);
EFI_STATUS
EFIAPI
region: copy backward to avoid corruption.(
VOID
);
EFI_STATUS
EFIAPI
= &Source[Length - 1];(
VOID
);
EFI_STATUS
EFIAPI
overlap: copy forward in 8-byte chunks + tail.(
VOID
);
EFI_STATUS
EFIAPI
= Length >> 3;(
VOID
);
EFI_STATUS
EFIAPI
memory in 8-byte chunks with memset tail.(
VOID
);
EFI_STATUS
EFIAPI
the DataRecordList looking for the first record whose Flags match(
VOID
);
EFI_STATUS
EFIAPI
supplied Filter and whose MonotonicCount matches *MonotonicOutput(
VOID
);
EFI_STATUS
EFIAPI
success, returns the DATA_HUB_RECORD* (as LIST_ENTRY*) and sets(
VOID
);
EFI_STATUS
EFIAPI
SavedCount from the output parameter if present, else 0.(
VOID
);
EFI_STATUS
EFIAPI
= (*MonotonicOutput != NULL) ? (UINT64)*MonotonicOutput : 0;(
VOID
);
EFI_STATUS
EFIAPI
matches. Zero out the caller's output, then scan forward(
VOID
);
EFI_STATUS
EFIAPI
the next record with the same filter match to return the(
VOID
);
EFI_STATUS
EFIAPI
distinct MonotonicCount.(
VOID
);
EFI_STATUS
EFIAPI
the DataClassList for a node whose DataClassGuid matches the(
VOID
);
EFI_STATUS
EFIAPI
GUID pointer (identity comparison, not GUID content).(
VOID
);
EFI_STATUS
EFIAPI
logging function. Allocates a DATA_HUB_RECORD + user data payload(
VOID
);
EFI_STATUS
EFIAPI
it with the caller-supplied GUIDs and data, then appends it(
VOID
);
EFI_STATUS
EFIAPI
the DataRecordList. After the record is published, registered class(
VOID
);
EFI_STATUS
EFIAPI
whose filter matches the record's DataEntrySize are signalled.(
VOID
);
EFI_STATUS
EFIAPI
record structure layout at offset:(
VOID
);
EFI_STATUS
EFIAPI
the local timestamp buffer (16 bytes).(
VOID
);
EFI_STATUS
EFIAPI
(&RecordBuffer, 16);(
VOID
);
EFI_STATUS
EFIAPI
the TPL for possible RTC read; if <= TPL_APPLICATION, read CMOS.(
VOID
);
EFI_STATUS
EFIAPI
populate a proper timestamp, just a placeholder).(
VOID
);
EFI_STATUS
EFIAPI
(gBS->RaiseTPL (TPL_HIGH_LEVEL) <= 8) {(
VOID
);
/// restore and read timestamp.
EFI_STATUS
EFIAPI
is low enough for RTC access(
VOID
);
EFI_STATUS
EFIAPI
does not seem to do so. The timestamp field is left zeroed.(
VOID
);
EFI_STATUS
EFIAPI
too high, cannot read RTC; timestamp stays zero.(
VOID
);
EFI_STATUS
EFIAPI
the data lock.(
VOID
);
EFI_STATUS
EFIAPI
(Private->DataLock.Lock == EfiLockUninitialized) {(
VOID
);
EFI_STATUS
EFIAPI
the record: sizeof(DATA_HUB_RECORD) base (0x70) + payload.(
VOID
);
EFI_STATUS
EFIAPI
= AllocatePool (DataPayloadSize + 112);(
VOID
);
EFI_STATUS
EFIAPI
the record fields.(
VOID
);
EFI_STATUS
EFIAPI
into the DataRecordList head.(
VOID
);
EFI_STATUS
EFIAPI
(&Private->DataRecordListHead, &Record->RecordListEntry);(
VOID
);
EFI_STATUS
EFIAPI
the user data payload if non-empty.(
VOID
);
EFI_STATUS
EFIAPI
(DataPayloadSize > 0) {(
VOID
);
EFI_STATUS
EFIAPI
registered data class list and signal any listener whose(
VOID
);
EFI_STATUS
EFIAPI
mask matches, and either has a zeroed GUID storage(
VOID
);
EFI_STATUS
EFIAPI
= GetFirstNode (&Private->DataClassListHead);(
VOID
);
EFI_STATUS
EFIAPI
the next data record matching the optional MonotonicCount(
VOID
);
/// iterate all records.
EFI_STATUS
EFIAPI
class filter(
VOID
);
EFI_STATUS
EFIAPI
= DataHubFindDataRecordByFilter ((
VOID
);
/// find its registration node.
EFI_STATUS
EFIAPI
class GUID was provided(
VOID
);
EFI_STATUS
EFIAPI
= DataHubFindClassByGuid (&Private->DataClassListHead, (EFI_GUID *)*FilterEvent);(
VOID
);
EFI_STATUS
EFIAPI
from the saved MonotonicCount in the class node.(
VOID
);
EFI_STATUS
EFIAPI
a new data class for filtering. The class is identified by(
VOID
);
EFI_STATUS
EFIAPI
and ProducerName; records whose DataEntrySize & Filter(
VOID
);
EFI_STATUS
EFIAPI
a non-zero result will signal the caller's event.(
VOID
);
EFI_STATUS
EFIAPI
a new DATA_HUB_CLASS node (0x48 bytes).(
VOID
);
EFI_STATUS
EFIAPI
= AllocatePool (sizeof (DATA_HUB_CLASS));(
VOID
);
EFI_STATUS
EFIAPI
the class node.(
VOID
);
EFI_STATUS
EFIAPI
out if the class is already registered.(
VOID
);
EFI_STATUS
EFIAPI
(DataHubFindClassByGuid (&Private->DataClassListHead, DataClassGuid) != NULL) {(
VOID
);
EFI_STATUS
EFIAPI
into the class list under the lock.(
VOID
);
EFI_STATUS
EFIAPI
(&Private->DataLock);(
VOID
);
EFI_STATUS
EFIAPI
the class event so that callers blocking on it are woken up.(
VOID
);
EFI_STATUS
EFIAPI
a registered data class by its GUID pointer.(
VOID
);
EFI_STATUS
EFIAPI
the class node and remove it from the list.(
VOID
);
EFI_STATUS
EFIAPI
= DataHubFindClassByGuid (&Private->DataClassListHead, DataClassGuid);(
VOID
);
EFI_STATUS
EFIAPI
the HOB list via gBS->LocateProtocol. Caches the result.(
VOID
);
EFI_STATUS
EFIAPI
the TPL. Only continue if we are at a safe (low) TPL.(
VOID
);
EFI_STATUS
EFIAPI
(gBS->RaiseTPL (TPL_HIGH_LEVEL) <= TPL_APPLICATION) {(
VOID
);
EFI_STATUS
EFIAPI
debug print controlled by CMOS offset 0x4B (Boot/Diag(
VOID
);
EFI_STATUS
EFIAPI
register). Only prints if the boot mode matches the expected(
VOID
);
EFI_STATUS
EFIAPI
verbosity threshold.(
VOID
);
EFI_STATUS
EFIAPI
CMOS 0x70/0x71 register 0x4B (Boot/Diag flags).(
VOID
);
EFI_STATUS
EFIAPI
= __inbyte (0x70);(
VOID
);
EFI_STATUS
EFIAPI
: EFI_D_ERROR; // 0x80000006(
VOID
);
EFI_STATUS
EFIAPI
handler obtained from the HOB-linked debug properties.(
VOID
);
EFI_STATUS
EFIAPI
the assert handler at field +8 in the HOB structure.(
VOID
);
EFI_STATUS
EFIAPI
the gEfiHobListGuid entry in the System Table's configuration(
VOID
);
EFI_STATUS
EFIAPI
array and cache the pointer.(
VOID
);
EFI_STATUS
EFIAPI
HobLibConstructor ((
VOID
);
EFI_STATUS
EFIAPI
= 7739F24C-93D7-11D4-9A3A-0090273FC14D(
VOID
);
EFI_STATUS
EFIAPI
the private DATA_HUB_PRIVATE_DATA structure, set up the(
VOID
);
EFI_STATUS
EFIAPI
function table, initialise the linked lists and lock, then(
VOID
);
EFI_STATUS
EFIAPI
the EFI_DATA_HUB_PROTOCOL on a new UEFI handle.(
VOID
);
EFI_STATUS
EFIAPI
DataHubDriverEntryPoint ((
VOID
);
EFI_STATUS
EFIAPI
the private instance structure.(
VOID
);
EFI_STATUS
EFIAPI
up protocol function pointers.(
VOID
);
EFI_STATUS
EFIAPI
linked list heads to self-loop (empty list).(
VOID
);
EFI_STATUS
EFIAPI
the lock.(
VOID
);
EFI_STATUS
EFIAPI
mPrivateData.DataLock.Lock = EfiLockReleased; // 1(
VOID
);
EFI_STATUS
EFIAPI
LocateProtocol first (to see if this handle already exists)(
VOID
);
EFI_STATUS
EFIAPI
install the protocol on a new (or existing) handle.(
VOID
);
EFI_STATUS
EFIAPI
= NULL;(
VOID
);
EFI_STATUS
EFIAPI
-- UEFI DXE driver entry point.(
VOID
);
EFI_STATUS
EFIAPI
ImageHandle, SystemTable, BootServices, and RuntimeServices into(
VOID
);
EFI_STATUS
EFIAPI
module's global copies, initialises the HOB list, then calls(
VOID
);
EFI_STATUS
EFIAPI
HOB list pointer (needed by debug functions and(
VOID
);
EFI_STATUS
EFIAPI
();(
VOID
);
EFI_STATUS
EFIAPI
the Data Hub Protocol.(
VOID
);
EFI_STATUS
EFIAPI
DataHubDriverEntryPoint ();(
VOID
);
#endif /* __DATAHUBDXE_H__ */