/** @file
AmiRedFishApi.h -- Header for AmiRedFishApi
Copyright (c) HR650X BIOS Decompilation Project
**/
#ifndef __AMIREDFISHAPI_H__
#define __AMIREDFISHAPI_H__
#include "../uefi_headers/Uefi.h"
//
// Function Prototypes
//
EFI_STATUS
EFIAPI
AmiRedfishReadUnaligned64(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishWriteUnaligned64(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishDebugPrint(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishAssert(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishFreePool(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishGetDebugLevel(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishInitHobList(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishGetSecureBootMode(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishGetSecureBoot(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishSetSecureBootSetup(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishSetVariable(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishProcessPK(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishGetRawImage(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishProcessAllVariables(
VOID
);
EFI_STATUS
EFIAPI
AmiRedfishEntryPoint(
VOID
);
EFI_STATUS
EFIAPI
definitions(
VOID
);
EFI_STATUS
EFIAPI
data(
VOID
);
EFI_STATUS
EFIAPI
handle GUID array used for InstallMultipleProtocolInterfaces.(
VOID
);
EFI_STATUS
EFIAPI
value 17039617 (0x01040001) may encode version/attributes info.(
VOID
);
EFI_STATUS
EFIAPI
CONST UINT32 mAmiRedfishProtocolVersion = 17039617;(
VOID
);
EFI_STATUS
EFIAPI
of Secure Boot variable names (dbx, dbt, dbr, db).(
VOID
);
EFI_STATUS
EFIAPI
CONST CHAR16 *mSecureBootVarNames[] = {(
VOID
);
EFI_STATUS
EFIAPI
of default value variable names (dbxDefault, dbtDefault, ...).(
VOID
);
EFI_STATUS
EFIAPI
CONST CHAR16 *mSecureBootDefaultNames[] = {(
VOID
);
EFI_STATUS
EFIAPI
of image GUIDs associated with each Secure Boot variable.(
VOID
);
EFI_STATUS
EFIAPI
EFI_GUID *mSecureBootImageGuids[] = {(
VOID
);
EFI_STATUS
EFIAPI
variable GUID for Secure Boot variables.(
VOID
);
EFI_STATUS
EFIAPI
EFI_GUID mSecureBootDefaultGuid = AMI_SECUREBOOT_DEFAULT_GUID;(
VOID
);
EFI_STATUS
EFIAPI
HOB list pointer.(
VOID
);
EFI_STATUS
EFIAPI
VOID *mHobList = NULL;(
VOID
);
EFI_STATUS
EFIAPI
debug/report protocol pointer.(
VOID
);
EFI_STATUS
EFIAPI
VOID *mDebugProtocol = NULL;(
VOID
);
EFI_STATUS
EFIAPI
helper functions(
VOID
);
EFI_STATUS
EFIAPI
report status code protocol buffer.(
VOID
);
EFI_STATUS
EFIAPI
= AllocateZeroPool (0x10);(
VOID
);
EFI_STATUS
EFIAPI
the protocol via gBS->LocateProtocol.(
VOID
);
EFI_STATUS
EFIAPI
= gBS->LocateProtocol ((
VOID
);
EFI_STATUS
EFIAPI
as debug protocol GUID(
VOID
);
EFI_STATUS
EFIAPI
to protocol API(
VOID
);
EFI_STATUS
EFIAPI
debug protocol's output function at offset 0.(
VOID
);
EFI_STATUS
EFIAPI
debug protocol assertion handler at offset 8.(
VOID
);
EFI_STATUS
EFIAPI
CMOS index 0x70 to preserve NMI bit, then select index 0x4B.(
VOID
);
EFI_STATUS
EFIAPI
= IoRead8 (0x70);(
VOID
);
EFI_STATUS
EFIAPI
the HOB list from the system table configuration table array.(
VOID
);
EFI_STATUS
EFIAPI
(gST->NumberOfTableEntries > 0) {(
VOID
);
EFI_STATUS
EFIAPI
HOBs to find the gEfiHobMemoryAllocModuleGuid entry.(
VOID
);
EFI_STATUS
EFIAPI
specific GUID used here is the AmiRedfishHobGuid which matches(
VOID
);
EFI_STATUS
EFIAPI
AMI-specific HOB entry containing Redfish configuration data.(
VOID
);
EFI_STATUS
EFIAPI
Boot mode detection(
VOID
);
EFI_STATUS
EFIAPI
query the variable to determine its current size/attributes.(
VOID
);
EFI_STATUS
EFIAPI
= gRT->GetVariable ((
VOID
);
EFI_STATUS
EFIAPI
management(
VOID
);
EFI_STATUS
EFIAPI
parameters.(
VOID
);
EFI_STATUS
EFIAPI
(VarName == NULL || VarGuid == NULL) {(
VOID
);
EFI_STATUS
EFIAPI
data buffer requirements.(
VOID
);
EFI_STATUS
EFIAPI
((Flags & REDFISH_OP_RUNTIME_ACCESS) != 0) {(
VOID
);
EFI_STATUS
EFIAPI
if the variable already exists (and if we should skip NV write).(
VOID
);
EFI_STATUS
EFIAPI
= 0;(
VOID
);
EFI_STATUS
EFIAPI
does not exist or exists with a different size.(
VOID
);
EFI_STATUS
EFIAPI
attempt to get the variable from the default storage.(
VOID
);
EFI_STATUS
EFIAPI
(Status == EFI_BUFFER_TOO_SMALL || Status == EFI_SUCCESS) {(
VOID
);
/// skip unless REDFISH_OP_BOOTSERVICE_ACCESS forces write.
EFI_STATUS
EFIAPI
exists(
VOID
);
EFI_STATUS
EFIAPI
((Flags & REDFISH_OP_BOOTSERVICE_ACCESS) == 0) {(
VOID
);
EFI_STATUS
EFIAPI
not found. Try to read it from the default location(
VOID
);
EFI_STATUS
EFIAPI
gRT->GetVariable with the appropriate time-based attributes.(
VOID
);
EFI_STATUS
EFIAPI
(NULL);(
VOID
);
EFI_STATUS
EFIAPI
the default variable using time-based variable access.(
VOID
);
EFI_STATUS
EFIAPI
the default variable is not found, clear the NV flag and retry.(
VOID
);
EFI_STATUS
EFIAPI
the runtime variable.(
VOID
);
EFI_STATUS
EFIAPI
the RT variable with the user-supplied data.(
VOID
);
EFI_STATUS
EFIAPI
= gRT->SetVariable ((
VOID
);
EFI_STATUS
EFIAPI
variable name(
VOID
);
EFI_STATUS
EFIAPI
the non-volatile variable.(
VOID
);
EFI_STATUS
EFIAPI
((Flags & REDFISH_OP_BOOTSERVICE_ACCESS) != 0) {(
VOID
);
EFI_STATUS
EFIAPI
the variable was written successfully, re-read its size for logging.(
VOID
);
EFI_STATUS
EFIAPI
(Status == EFI_SUCCESS) {(
VOID
);
EFI_STATUS
EFIAPI
((Flags & REDFISH_OP_SIZE_CHECK) != 0) {(
VOID
);
EFI_STATUS
EFIAPI
image extraction from Firmware Volumes(
VOID
);
EFI_STATUS
EFIAPI
the Loaded Image Protocol for the current image.(
VOID
);
EFI_STATUS
EFIAPI
= gBS->HandleProtocol ((
VOID
);
EFI_STATUS
EFIAPI
the section extraction protocol from the FV handle.(
VOID
);
EFI_STATUS
EFIAPI
searching all handles for a matching FV section.(
VOID
);
EFI_STATUS
EFIAPI
= gBS->LocateHandleBuffer ((
VOID
);
EFI_STATUS
EFIAPI
if this handle's device path matches our FV.(
VOID
);
EFI_STATUS
EFIAPI
(LoadedImage->DeviceHandle == FvHandle) {(
VOID
);
EFI_STATUS
EFIAPI
to open the section data by the image GUID.(
VOID
);
EFI_STATUS
EFIAPI
= NULL;(
VOID
);
EFI_STATUS
EFIAPI
FV section with the image GUID using the appropriate(
VOID
);
EFI_STATUS
EFIAPI
extraction protocol interface.(
VOID
);
EFI_STATUS
EFIAPI
over all Secure Boot variables(
VOID
);
EFI_STATUS
EFIAPI
*ImageGuid;(
VOID
);
EFI_STATUS
EFIAPI
ActualSize;(
VOID
);
EFI_STATUS
EFIAPI
GUID for Secure Boot variables.(
VOID
);
EFI_STATUS
EFIAPI
= &mSecureBootDefaultGuid;(
VOID
);
EFI_STATUS
EFIAPI
over the 4 Secure Boot variables (dbx, dbt, dbr, db).(
VOID
);
EFI_STATUS
EFIAPI
(VarIndex = 0; VarIndex < ARRAY_SIZE (mSecureBootVarNames); VarIndex++) {(
VOID
);
EFI_STATUS
EFIAPI
whether the variable already exists in NVRAM.(
VOID
);
EFI_STATUS
EFIAPI
the variable exists and we should not overwrite it, skip.(
VOID
);
EFI_STATUS
EFIAPI
(!EFI_ERROR (Status) && (Flags & REDFISH_OP_BOOTSERVICE_ACCESS) == 0) {(
VOID
);
EFI_STATUS
EFIAPI
raw image data from the FV for this variable.(
VOID
);
EFI_STATUS
EFIAPI
the variable.(
VOID
);
EFI_STATUS
EFIAPI
= AmiRedfishSetVariable ((
VOID
);
EFI_STATUS
EFIAPI
the section data if it was allocated by the extraction routine.(
VOID
);
EFI_STATUS
EFIAPI
(Data);(
VOID
);
EFI_STATUS
EFIAPI
Point(
VOID
);
EFI_STATUS
EFIAPI
global pointers from the System Table.(
VOID
);
EFI_STATUS
EFIAPI
= ImageHandle;(
VOID
);
EFI_STATUS
EFIAPI
all required global pointers are non-NULL.(
VOID
);
EFI_STATUS
EFIAPI
(gImageHandle != NULL);(
VOID
);
EFI_STATUS
EFIAPI
the HOB list for this driver.(
VOID
);
EFI_STATUS
EFIAPI
(ImageHandle);(
VOID
);
EFI_STATUS
EFIAPI
the AmiRedfishProtocolGuid onto the image handle.(
VOID
);
EFI_STATUS
EFIAPI
= gBS->InstallMultipleProtocolInterfaces ((
VOID
);
#endif /* __AMIREDFISHAPI_H__ */