/** @file
AmiTcgPlatformDxe.h -- Header for AmiTcgPlatformDxe
Copyright (c) HR650X BIOS Decompilation Project
**/
#ifndef __AMITCGPLATFORMDXE_H__
#define __AMITCGPLATFORMDXE_H__
#include "../uefi_headers/Uefi.h"
//
// Function Prototypes
//
EFI_STATUS
EFIAPI
ModuleEntryPoint(
VOID
);
EFI_STATUS
EFIAPI
Variable Definitions(
VOID
);
EFI_STATUS
EFIAPI
UEFI global variables from library constructors(
VOID
);
EFI_STATUS
EFIAPI
ImageHandle = NULL;(
VOID
);
EFI_STATUS
EFIAPI
byte_8D18; // SecureBoot status shadow(
VOID
);
EFI_STATUS
EFIAPI
platform type shadow(
VOID
);
EFI_STATUS
EFIAPI
protocol handle(
VOID
);
EFI_STATUS
EFIAPI
HOB list pointer(
VOID
);
EFI_STATUS
EFIAPI
handle cache(
VOID
);
EFI_STATUS
EFIAPI
Database Protocol(
VOID
);
EFI_STATUS
EFIAPI
instance slots(
VOID
);
EFI_STATUS
EFIAPI
Handle(
VOID
);
EFI_STATUS
EFIAPI
ready-to-boot event(
VOID
);
EFI_STATUS
EFIAPI
type parameter(
VOID
);
EFI_STATUS
EFIAPI
presence flag (non-zero = 2.0)(
VOID
);
EFI_STATUS
EFIAPI
Definitions(
VOID
);
EFI_STATUS
EFIAPI
notify registrations(
VOID
);
EFI_STATUS
EFIAPI
*off_8CB0;(
VOID
);
EFI_STATUS
EFIAPI
constants for known algorithm identifiers(
VOID
);
EFI_STATUS
EFIAPI
UINT64 xmmword_6B40[2] = { 0, 0 }; // SHA-1 algorithm GUID(
VOID
);
EFI_STATUS
EFIAPI
algorithm GUID(
VOID
);
EFI_STATUS
EFIAPI
Helper Functions(
VOID
);
EFI_STATUS
EFIAPI
Module Entry Point(
VOID
);
EFI_STATUS
EFIAPI
UEFI table pointers and locate HII protocols.(
VOID
);
EFI_STATUS
EFIAPI
(ImageHandle, SystemTable);(
VOID
);
EFI_STATUS
EFIAPI
HII package list, measure secure variables, and register(
VOID
);
EFI_STATUS
EFIAPI
reset notification callback.(
VOID
);
EFI_STATUS
EFIAPI
Initialization(
VOID
);
EFI_STATUS
EFIAPI
the image handle and system table.(
VOID
);
EFI_STATUS
EFIAPI
the boot services and runtime services pointers.(
VOID
);
EFI_STATUS
EFIAPI
= SystemTable->BootServices;(
VOID
);
EFI_STATUS
EFIAPI
the HOB list pointer.(
VOID
);
EFI_STATUS
EFIAPI
();(
VOID
);
EFI_STATUS
EFIAPI
the image handle for protocol lookups.(
VOID
);
EFI_STATUS
EFIAPI
= sub_4BC4 ();(
VOID
);
EFI_STATUS
EFIAPI
TPM type (enable TPM 2.0 path if applicable).(
VOID
);
EFI_STATUS
EFIAPI
(*(CHAR8 *)sub_6000 (1024068) >= 0) {(
VOID
);
EFI_STATUS
EFIAPI
for TPM interface to become ready.(
VOID
);
EFI_STATUS
EFIAPI
HII protocols.(
VOID
);
EFI_STATUS
EFIAPI
= BootServices->LocateProtocol (&unk_8BE0, NULL, &qword_8D70);(
VOID
);
EFI_STATUS
EFIAPI
Package List and Measurement Registration(
VOID
);
EFI_STATUS
EFIAPI
the HII Package List protocol on our image handle.(
VOID
);
EFI_STATUS
EFIAPI
the HII Database protocol and register the package list.(
VOID
);
EFI_STATUS
EFIAPI
= sub_5E18 ();(
VOID
);
EFI_STATUS
EFIAPI
HII Database protocol and register the new package list.(
VOID
);
EFI_STATUS
EFIAPI
= BootServices->LocateProtocol (&unk_8BD0, NULL, &HiiDatabase);(
VOID
);
EFI_STATUS
EFIAPI
secure boot variables (PK, KEK, db, dbx).(
VOID
);
EFI_STATUS
EFIAPI
(EFI_ERROR (sub_1A2C ())) {(
VOID
);
EFI_STATUS
EFIAPI
a TCG reset-short event and return.(
VOID
);
EFI_STATUS
EFIAPI
(7);(
VOID
);
EFI_STATUS
EFIAPI
Hash/Extend Event Functions(
VOID
);
EFI_STATUS
EFIAPI
the TCG protocol.(
VOID
);
EFI_STATUS
EFIAPI
= BootServices->LocateProtocol ((
VOID
);
EFI_STATUS
EFIAPI
the TCG event descriptor buffer.(
VOID
);
EFI_STATUS
EFIAPI
= BootServices->AllocatePages ((
VOID
);
EFI_STATUS
EFIAPI
the event log data buffer.(
VOID
);
EFI_STATUS
EFIAPI
TcgHashLogExtendEvent.(
VOID
);
EFI_STATUS
EFIAPI
= TcgProtocol->HashLogExtendEvent ((
VOID
);
EFI_STATUS
EFIAPI
the TCG2 protocol.(
VOID
);
EFI_STATUS
EFIAPI
the TCG2 event descriptor (44 extra bytes).(
VOID
);
EFI_STATUS
EFIAPI
Tcg2HashLogExtendEvent.(
VOID
);
EFI_STATUS
EFIAPI
= Tcg2Protocol->HashLogExtendEvent ((
VOID
);
EFI_STATUS
EFIAPI
TCG2 protocol.(
VOID
);
EFI_STATUS
EFIAPI
TCG1.2 protocol for measuring during boot.(
VOID
);
EFI_STATUS
EFIAPI
if we have already entered this callback.(
VOID
);
EFI_STATUS
EFIAPI
(qword_8D10 != 0) {(
VOID
);
EFI_STATUS
EFIAPI
invocation: measure boot variables and call OpRomStartEnd.(
VOID
);
EFI_STATUS
EFIAPI
"Calling EFI Application from Boot Option" event.(
VOID
);
EFI_STATUS
EFIAPI
(IsTpm20) {(
VOID
);
EFI_STATUS
EFIAPI
boot variables.(
VOID
);
EFI_STATUS
EFIAPI
(EFI_ERROR (sub_1BCC ())) {(
VOID
);
EFI_STATUS
EFIAPI
that we are done with boot measurements.(
VOID
);
EFI_STATUS
EFIAPI
for TPM physical presence request.(
VOID
);
EFI_STATUS
EFIAPI
(qword_8D10 == 0) {(
VOID
);
EFI_STATUS
EFIAPI
to locate the physical presence protocol first.(
VOID
);
EFI_STATUS
EFIAPI
(EFI_ERROR (BootServices->LocateProtocol ((
VOID
);
EFI_STATUS
EFIAPI
PPI protocol: issue TPM reset command directly.(
VOID
);
EFI_STATUS
EFIAPI
= 1024;(
VOID
);
EFI_STATUS
EFIAPI
Presence Interface (PPI) Functions(
VOID
);
EFI_STATUS
EFIAPI
to locate an existing PPI protocol handler.(
VOID
);
EFI_STATUS
EFIAPI
(!EFI_ERROR (BootServices->LocateProtocol ((
VOID
);
EFI_STATUS
EFIAPI
the TPM Platform Protocol.(
VOID
);
EFI_STATUS
EFIAPI
TPM PER BIOS flags via TCG Platform Protocol.(
VOID
);
EFI_STATUS
EFIAPI
= 0;(
VOID
);
EFI_STATUS
EFIAPI
TPMPERBIOSFLAGS variable.(
VOID
);
EFI_STATUS
EFIAPI
((
VOID
);
EFI_STATUS
EFIAPI
or initialize the AMITCGPPIVAR variable.(
VOID
);
EFI_STATUS
EFIAPI
= RuntimeServices->GetVariable ((
VOID
);
EFI_STATUS
EFIAPI
the TcgINTPPI variable (PPI request code from OS).(
VOID
);
EFI_STATUS
EFIAPI
= 7;(
VOID
);
EFI_STATUS
EFIAPI
PPI request if one is pending.(
VOID
);
EFI_STATUS
EFIAPI
(PpiFlags != 0) {(
VOID
);
EFI_STATUS
EFIAPI
TPM platform type context.(
VOID
);
EFI_STATUS
EFIAPI
2.0 path(
VOID
);
EFI_STATUS
EFIAPI
(PpiFlags == 168) {(
VOID
);
EFI_STATUS
EFIAPI
Enable + Activate(
VOID
);
EFI_STATUS
EFIAPI
= sub_10E8 (TcgProtocol, 113, 1, &SetupValue);(
VOID
);
EFI_STATUS
EFIAPI
Disable + Deactivate(
VOID
);
EFI_STATUS
EFIAPI
(TcgProtocol, 93, 0, NULL);(
VOID
);
EFI_STATUS
EFIAPI
Clear (owner clear + clear control)(
VOID
);
EFI_STATUS
EFIAPI
= sub_10E8 (TcgProtocol, 32879, 0, NULL);(
VOID
);
EFI_STATUS
EFIAPI
1.2 path(
VOID
);
EFI_STATUS
EFIAPI
Clear(
VOID
);
EFI_STATUS
EFIAPI
= sub_10E8 (TcgProtocol, 111, 0, NULL);(
VOID
);
EFI_STATUS
EFIAPI
PPI processing, check for pending AMI PPI VAR and install(
VOID
);
EFI_STATUS
EFIAPI
appropriate protocol notify handler.(
VOID
);
EFI_STATUS
EFIAPI
(PpiRequestNewValue == 13) {(
VOID
);
EFI_STATUS
EFIAPI
setup value "PPI request sync" - install the PPI member protocol.(
VOID
);
EFI_STATUS
EFIAPI
(!EFI_ERROR (BootServices->AllocatePool ((
VOID
);
EFI_STATUS
EFIAPI
request in range 1-22: install PPI protocol with the(
VOID
);
EFI_STATUS
EFIAPI
handler (sub_3BA0 for user confirmation flows).(
VOID
);
EFI_STATUS
EFIAPI
BootServices->InstallProtocolInterface ((
VOID
);
EFI_STATUS
EFIAPI
PPI protocol first (already installed).(
VOID
);
EFI_STATUS
EFIAPI
TCG1.2 protocol and TCG2 protocol.(
VOID
);
EFI_STATUS
EFIAPI
TPM capability information.(
VOID
);
EFI_STATUS
EFIAPI
(TcgProtocol, TpmCapData);(
VOID
);
EFI_STATUS
EFIAPI
"TpmOldvar" UEFI variable (tracks previous TPM state).(
VOID
);
EFI_STATUS
EFIAPI
= 3;(
VOID
);
EFI_STATUS
EFIAPI
does not exist yet - create it.(
VOID
);
EFI_STATUS
EFIAPI
= TpmPlatformInfo.Enable;(
VOID
);
EFI_STATUS
EFIAPI
old TPM state with current state from setup.(
VOID
);
EFI_STATUS
EFIAPI
(Status == EFI_SUCCESS) {(
VOID
);
EFI_STATUS
EFIAPI
state changed: sync required.(
VOID
);
EFI_STATUS
EFIAPI
= TpmActive;(
VOID
);
EFI_STATUS
EFIAPI
the platform type context.(
VOID
);
EFI_STATUS
EFIAPI
= PlatformTypeContext[0];(
VOID
);
EFI_STATUS
EFIAPI
TPM PER BIOS flags and setup synchronisation.(
VOID
);
EFI_STATUS
EFIAPI
= sub_647C (&SyncRequired);(
VOID
);
EFI_STATUS
EFIAPI
a periodic timer callback to retry PER BIOS processing.(
VOID
);
EFI_STATUS
EFIAPI
= BootServices->SetTimer ((
VOID
);
EFI_STATUS
EFIAPI
the TPM platform type.(
VOID
);
EFI_STATUS
EFIAPI
if TPM state needs to change.(
VOID
);
EFI_STATUS
EFIAPI
(TpmOldVarNew == TpmActive) {(
VOID
);
EFI_STATUS
EFIAPI
was requested.(
VOID
);
EFI_STATUS
EFIAPI
((EFI_D_INFO, "\n ENABLE == Setup in setup \n"));(
VOID
);
EFI_STATUS
EFIAPI
state mismatch: trigger a TPM enable/disable request.(
VOID
);
EFI_STATUS
EFIAPI
((EFI_D_INFO, "\n TMP_ENABLE != Setup in setup \n"));(
VOID
);
EFI_STATUS
EFIAPI
the new TPM state.(
VOID
);
EFI_STATUS
EFIAPI
Reset Functions(
VOID
);
EFI_STATUS
EFIAPI
to clear the "LastBootFailed" flag.(
VOID
);
EFI_STATUS
EFIAPI
the system reset.(
VOID
);
EFI_STATUS
EFIAPI
a DoResetNow callback in case ResetSystem failed.(
VOID
);
EFI_STATUS
EFIAPI
= BootServices->CreateEvent ((
VOID
);
EFI_STATUS
EFIAPI
GetCapability(
VOID
);
EFI_STATUS
EFIAPI
the TPM GetCapability command buffer.(
VOID
);
EFI_STATUS
EFIAPI
= TPM_ST_NO_SESSIONS;(
VOID
);
EFI_STATUS
EFIAPI
*(UINT32 *)((UINT8 *)&TcgCapCmd + 6) = 0x4000000;(
VOID
);
EFI_STATUS
EFIAPI
via the TCG2 protocol.(
VOID
);
EFI_STATUS
EFIAPI
= ((EFI_STATUS (*)(VOID *, UINT32, VOID *, UINT32, VOID *))((
VOID
);
EFI_STATUS
EFIAPI
capability response to the caller's buffer.(
VOID
);
EFI_STATUS
EFIAPI
(a2, ResponseBuffer, 36);(
VOID
);
EFI_STATUS
EFIAPI
and log capability response fields (byte-order swap).(
VOID
);
EFI_STATUS
EFIAPI
= ((*(UINT32 *)((UINT8 *)a2 + 16) & 0xFF00 |(
VOID
);
EFI_STATUS
EFIAPI
Measurement Event Helpers(
VOID
);
EFI_STATUS
EFIAPI
TCG protocol.(
VOID
);
EFI_STATUS
EFIAPI
event size and allocate buffer.(
VOID
);
EFI_STATUS
EFIAPI
= sub_4A10 (String);(
VOID
);
EFI_STATUS
EFIAPI
event data into the buffer.(
VOID
);
EFI_STATUS
EFIAPI
(TcgEvent + 1, String, EventSize);(
VOID
);
EFI_STATUS
EFIAPI
the measurement.(
VOID
);
EFI_STATUS
EFIAPI
event size and allocate buffer (44 extra bytes for TCG2 header).(
VOID
);
EFI_STATUS
EFIAPI
event data after the header (offset 44 for TCG2).(
VOID
);
EFI_STATUS
EFIAPI
((UINT8 *)TcgEvent + 44, String, EventSize);(
VOID
);
EFI_STATUS
EFIAPI
Boot Variable Measurement(
VOID
);
EFI_STATUS
EFIAPI
variable name and event type tables.(
VOID
);
EFI_STATUS
EFIAPI
the algorithm GUID.(
VOID
);
EFI_STATUS
EFIAPI
((Index >= 3) && (Index <= 4)) {(
VOID
);
EFI_STATUS
EFIAPI
the UEFI variable.(
VOID
);
EFI_STATUS
EFIAPI
= sub_18E8 (VariableNames[Index], &Guid, &VariableSize);(
VOID
);
EFI_STATUS
EFIAPI
if this is the SecureBoot variable.(
VOID
);
EFI_STATUS
EFIAPI
(Index == 0) {(
VOID
);
EFI_STATUS
EFIAPI
ROM Measurement(
VOID
);
EFI_STATUS
EFIAPI
2.0 measurement path.(
VOID
);
EFI_STATUS
EFIAPI
1.2 measurement path.(
VOID
);
EFI_STATUS
EFIAPI
I/O Protocol Notify and OpROM Measurement(
VOID
);
EFI_STATUS
EFIAPI
all handles that support the OpRomStartEnd protocol.(
VOID
);
EFI_STATUS
EFIAPI
= BootServices->LocateHandle ((
VOID
);
EFI_STATUS
EFIAPI
the OpRomStartEnd protocol on each handle.(
VOID
);
EFI_STATUS
EFIAPI
(!EFI_ERROR (Status)) {(
VOID
);
EFI_STATUS
EFIAPI
PFA from the PCI I/O protocol.(
VOID
);
EFI_STATUS
EFIAPI
= sub_1234 (OpRomStartEnd);(
VOID
);
EFI_STATUS
EFIAPI
the option ROM image.(
VOID
);
EFI_STATUS
EFIAPI
(RomImage, (UINT32)RomSize, Pfa);(
VOID
);
EFI_STATUS
EFIAPI
PER BIOS Flag Processing(
VOID
);
EFI_STATUS
EFIAPI
the TPM tag ("TPM_" = 0x5F504D54 as an integer(
VOID
);
EFI_STATUS
EFIAPI
into the buffer).(
VOID
);
EFI_STATUS
EFIAPI
= 1600085855; // Magic constant for tag search(
VOID
);
EFI_STATUS
EFIAPI
for the tag in the buffer.(
VOID
);
EFI_STATUS
EFIAPI
= -1;(
VOID
);
EFI_STATUS
EFIAPI
if the preceding byte is a valid continuation indicator.(
VOID
);
EFI_STATUS
EFIAPI
(((*(BytePtr - 1) - 92) & 0xFD) == 0) {(
VOID
);
EFI_STATUS
EFIAPI
the value type and update accordingly.(
VOID
);
EFI_STATUS
EFIAPI
(*(BytePtr - 1) == 8) {(
VOID
);
EFI_STATUS
EFIAPI
a valid field - examine its type.(
VOID
);
EFI_STATUS
EFIAPI
(*(BytePtr + 4)) {(
VOID
);
EFI_STATUS
EFIAPI
- only update if the new value fits.(
VOID
);
EFI_STATUS
EFIAPI
(NewValue >= 2) {(
VOID
);
EFI_STATUS
EFIAPI
List Initialization(
VOID
);
EFI_STATUS
EFIAPI
String Retrieval(
VOID
);
EFI_STATUS
EFIAPI
HII handle.(
VOID
);
EFI_STATUS
EFIAPI
(qword_9420 != NULL);(
VOID
);
EFI_STATUS
EFIAPI
the HII package list for the given handle.(
VOID
);
EFI_STATUS
EFIAPI
= sub_63D8 (qword_9420);(
VOID
);
EFI_STATUS
EFIAPI
to get the string via HII String Protocol.(
VOID
);
EFI_STATUS
EFIAPI
(((EFI_STATUS (*)(VOID *, UINT16 *, UINT64, UINT16(
VOID
);
EFI_STATUS
EFIAPI
a temporary buffer for the string.(
VOID
);
EFI_STATUS
EFIAPI
= sub_69E0 (StringSize);(
VOID
);
EFI_STATUS
EFIAPI
TCG Reset-Short Event(
VOID
);
EFI_STATUS
EFIAPI
the TCG_PCR_EVENT structure.(
VOID
);
EFI_STATUS
EFIAPI
HashLogExtendEvent.(
VOID
);
EFI_STATUS
EFIAPI
((EFI_STATUS (*)(VOID *, INT32 *, UINT32, UINT32(
VOID
);
EFI_STATUS
EFIAPI
Command Submission(
VOID
);
EFI_STATUS
EFIAPI
the TPM command buffer and call SubmitCommand via(
VOID
);
EFI_STATUS
EFIAPI
protocol interface (offset +24 from protocol base).(
VOID
);
EFI_STATUS
EFIAPI
exact buffer format depends on the TPM command type(
VOID
);
EFI_STATUS
EFIAPI
the TCG/TCG2 protocol version.(
VOID
);
EFI_STATUS
EFIAPI
((UINT32 (*)(VOID *, UINT32, UINT32, UINT32, UINT32))((
VOID
);
#endif /* __AMITCGPLATFORMDXE_H__ */