Newer
Older
AMI-Aptio-BIOS-Reversed / SlotDataUpdateDxeLightningRidgeEXRP / SlotDataUpdateDxeLightningRidgeEXRP.h
@Ajax Dong Ajax Dong 2 days ago 6 KB Init
/** @file
  SlotDataUpdateDxeLightningRidgeEXRP.h -- Header for SlotDataUpdateDxeLightningRidgeEXRP

Copyright (c) HR650X BIOS Decompilation Project
**/

#ifndef __SLOTDATAUPDATEDXELIGHTNINGRIDGEEXRP_H__
#define __SLOTDATAUPDATEDXELIGHTNINGRIDGEEXRP_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 (stored in .rdata section)(
  VOID
);

EFI_STATUS
EFIAPI
gUbaProtocolGuid          = UBA_PROTOCOL_GUID;(
  VOID
);

EFI_STATUS
EFIAPI
Variables(
  VOID
);

EFI_STATUS
EFIAPI
gImageHandle      = NULL;  ///< 0xBF8: 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 protocol(
  VOID
);

EFI_STATUS
EFIAPI
initialization.(
  VOID
);

EFI_STATUS
EFIAPI
Entry 1 (at 0xBB0, 40 bytes):(
  VOID
);

EFI_STATUS
EFIAPI
Entry 2 (at 0xBD8, 32 bytes):(
  VOID
);

EFI_STATUS
EFIAPI
function pointers at offsets 16 and 32 within Entry 1, and offset 16(
  VOID
);

EFI_STATUS
EFIAPI
Entry 2, are IMAGE_REL_BASED_DIR64 fixups applied by the PE loader(
  VOID
);

EFI_STATUS
EFIAPI
runtime to relocate from RVA to absolute address.(
  VOID
);

EFI_STATUS
EFIAPI
Entry 1 (at 0xBB0, size 40): Primary PSLT with GetSlotCount + GetSlotData(
  VOID
);

EFI_STATUS
EFIAPI
Entry 2 (at 0xBD8, size 32): Secondary PSLT with GetSlotCount only(
  VOID
);

EFI_STATUS
EFIAPI
Implementations(
  VOID
);

EFI_STATUS
EFIAPI
EXRP platform has exactly 2 slots.(
  VOID
);

EFI_STATUS
EFIAPI
2;(
  VOID
);

EFI_STATUS
EFIAPI
through the default slot data unchanged.(
  VOID
);

EFI_STATUS
EFIAPI
platform-specific slot data remapping is needed.(
  VOID
);

EFI_STATUS
EFIAPI
DefaultData;(
  VOID
);

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

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

EFI_STATUS
EFIAPI
current TPL level by raising to TPL_HIGH_LEVEL and restoring.(
  VOID
);

EFI_STATUS
EFIAPI
the old TPL was above TPL_NOTIFY (0x10), we cannot safely call(
  VOID
);

EFI_STATUS
EFIAPI
(which may block/allocate memory).(
  VOID
);

EFI_STATUS
EFIAPI
too high for LocateProtocol - skip and return NULL.(
  VOID
);

EFI_STATUS
EFIAPI
NULL;(
  VOID
);

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

EFI_STATUS
EFIAPI
registration key(
  VOID
);

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

EFI_STATUS
EFIAPI
= IoRead8 (RTC_CMOS_ADDRESS_PORT);(
  VOID
);

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

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

EFI_STATUS
EFIAPI
is in the valid platform type range (4-255), use as-is.(
  VOID
);

EFI_STATUS
EFIAPI
routing change needed.(
  VOID
);

EFI_STATUS
EFIAPI
type 0: read hardware strap from fixed memory address.(
  VOID
);

EFI_STATUS
EFIAPI
1 of the strap byte indicates debug capability.(
  VOID
);

EFI_STATUS
EFIAPI
= (*(volatile UINT8 *)PLATFORM_STRAP_ADDRESS & 0x02) | 0x01;(
  VOID
);

EFI_STATUS
EFIAPI
values 1, 2, 3: use directly (valid)(
  VOID
);

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

EFI_STATUS
EFIAPI
of 0 would have been remapped above, so 1+ is expected.(
  VOID
);

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

EFI_STATUS
EFIAPI
range: N3 is 1 to 255 (effectively all non-zero values).(
  VOID
);

EFI_STATUS
EFIAPI
(N3 == 1) {(
  VOID
);

EFI_STATUS
EFIAPI
} else {(
  VOID
);

EFI_STATUS
EFIAPI
}(
  VOID
);

EFI_STATUS
EFIAPI
the debug level matches the computed route mask, forward the message.(
  VOID
);

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

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

EFI_STATUS
EFIAPI
function is called with (Severity, FormatString, VaList).(
  VOID
);

EFI_STATUS
EFIAPI
= (UINT64 (*)(UINT64, CHAR8 *, UINT64 *))(
  VOID
);

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

EFI_STATUS
EFIAPI
assert handler is at the same function index as DebugPrint(
  VOID
);

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

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

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

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

EFI_STATUS
EFIAPI
+ 0x70 (112) = ConfigurationTable pointer(
  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
(Index = 0; Index < HobCount; Index++) {(
  VOID
);

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

EFI_STATUS
EFIAPI
= *(VOID **)(HobEntries + Index * sizeof(EFI_CONFIGURATION_TABLE) + sizeof(EFI_GUID));(
  VOID
);

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

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

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

EFI_STATUS
EFIAPI
(0x80000000LL, "UBA:SlotDataUpdate-TypeLightningRidgeEXRP\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
the UBA SetData function at protocol index 2 (offset 0x10).(
  VOID
);

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

EFI_STATUS
EFIAPI
= (UINT64 (*)(VOID *, EFI_GUID *, VOID *, UINT64))(
  VOID
);

EFI_STATUS
EFIAPI
PSLT Entry 1: Primary slot table with GetSlotCount + GetSlotData.(
  VOID
);

EFI_STATUS
EFIAPI
= UbaSetData (UbaProtocol, &gUbaSlotDataPsl1Guid, (VOID *)mPslEntry1, 40);(
  VOID
);

EFI_STATUS
EFIAPI
PSLT Entry 2: Secondary slot table with GetSlotCount only.(
  VOID
);

EFI_STATUS
EFIAPI
= UbaSetData (UbaProtocol, &gUbaSlotDataPsl2Guid, (VOID *)mPslEntry2, 32);(
  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 /* __SLOTDATAUPDATEDXELIGHTNINGRIDGEEXRP_H__ */