/** @file
WatchdogTimer.h -- Header for WatchdogTimer
Copyright (c) HR650X BIOS Decompilation Project
**/
#ifndef __WATCHDOGTIMER_H__
#define __WATCHDOGTIMER_H__
#include "../uefi_headers/Uefi.h"
//
// Function Prototypes
//
EFI_STATUS
EFIAPI
WatchdogTimerDriverEntryPoint(
VOID
);
EFI_STATUS
EFIAPI
WatchdogTimerNotifyHandler(
VOID
);
EFI_STATUS
EFIAPI
WatchdogTimerRegisterHandler(
VOID
);
EFI_STATUS
EFIAPI
WatchdogTimerSetTimerPeriod(
VOID
);
EFI_STATUS
EFIAPI
WatchdogTimerGetTimerPeriod(
VOID
);
EFI_STATUS
EFIAPI
DebugAssertPrint(
VOID
);
EFI_STATUS
EFIAPI
DebugAssert(
VOID
);
EFI_STATUS
EFIAPI
SmmCommunicationSend(
VOID
);
EFI_STATUS
EFIAPI
ReadUnaligned64(
VOID
);
EFI_STATUS
EFIAPI
HobCompareGuidEntry(
VOID
);
EFI_STATUS
EFIAPI
GUIDs(
VOID
);
EFI_STATUS
EFIAPI
/// {665E3FF5-46CC-11D4-9A38-0090273FC14D}(
VOID
);
EFI_STATUS
EFIAPI
gEfiWatchdogTimerArchProtocolGuid =(
VOID
);
EFI_STATUS
EFIAPI
/// {7739F24C-93D7-11D4-9A3A-0090273FC14D}(
VOID
);
EFI_STATUS
EFIAPI
gEfiHobListGuid =(
VOID
);
EFI_STATUS
EFIAPI
/// {D2B2B828-0826-48A7-B3DF-983C006024F0}(
VOID
);
EFI_STATUS
EFIAPI
gEfiSmmCommunicationProtocolGuid =(
VOID
);
EFI_STATUS
EFIAPI
(HOB GUID for debug output device)(
VOID
);
EFI_STATUS
EFIAPI
gEfiGenericMemTestPatternGuid =(
VOID
);
EFI_STATUS
EFIAPI
Variables(
VOID
);
EFI_STATUS
EFIAPI
EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance installed on the handle.(
VOID
);
EFI_STATUS
EFIAPI
function pointers for RegisterHandler and SetTimerPeriod.(
VOID
);
EFI_STATUS
EFIAPI
third field (GetTimerPeriod) is overlapped with mWatchdogTimerPeriod.(
VOID
);
EFI_STATUS
EFIAPI
mWatchdogTimerProtocol = {(
VOID
);
EFI_STATUS
EFIAPI
is implicitly at &mWatchdogTimerPeriod(
VOID
);
EFI_STATUS
EFIAPI
the current watchdog timer period in 100ns units.(
VOID
);
EFI_STATUS
EFIAPI
to WATCHDOG_TIMER_DEFAULT_PERIOD (1500 = 150us).(
VOID
);
EFI_STATUS
EFIAPI
also aliases with the third entry of the protocol structure(
VOID
);
EFI_STATUS
EFIAPI
GetTimerPeriod to return the period value directly.(
VOID
);
EFI_STATUS
EFIAPI
mWatchdogTimerPeriod = WATCHDOG_TIMER_DEFAULT_PERIOD;(
VOID
);
EFI_STATUS
EFIAPI
to the registered watchdog notification function, or NULL.(
VOID
);
EFI_STATUS
EFIAPI
*mWatchdogNotifyFunction = NULL;(
VOID
);
EFI_STATUS
EFIAPI
indicating whether a watchdog notification handler is registered.(
VOID
);
EFI_STATUS
EFIAPI
*mWatchdogNotifyRegistered = NULL;(
VOID
);
EFI_STATUS
EFIAPI
pointer to the HOB list, obtained from the system configuration table.(
VOID
);
EFI_STATUS
EFIAPI
*mHobList = NULL;(
VOID
);
EFI_STATUS
EFIAPI
pointer to the SMM Communication Protocol interface.(
VOID
);
EFI_STATUS
EFIAPI
*mSmmCommunicationProtocol = NULL;(
VOID
);
EFI_STATUS
EFIAPI
flag byte. Accessed via CMOS I/O ports 0x70/0x71.(
VOID
);
EFI_STATUS
EFIAPI
layout: bit 7 of CMOS index 0x4B stores an NMI status value.(
VOID
);
EFI_STATUS
EFIAPI
mNmiFlag = 0;(
VOID
);
EFI_STATUS
EFIAPI
Implementations(
VOID
);
EFI_STATUS
EFIAPI
UEFI global variables (gImageHandle, gST, gBS, gRT)(
VOID
);
EFI_STATUS
EFIAPI
= ImageHandle;(
VOID
);
EFI_STATUS
EFIAPI
the HOB list(
VOID
);
EFI_STATUS
EFIAPI
();(
VOID
);
EFI_STATUS
EFIAPI
the EFI_WATCHDOG_TIMER_ARCH_PROTOCOL(
VOID
);
EFI_STATUS
EFIAPI
= gBS->LocateProtocol ((
VOID
);
/// this is unexpected
EFI_STATUS
EFIAPI
already installed(
VOID
);
EFI_STATUS
EFIAPI
((
VOID
);
EFI_STATUS
EFIAPI
pool for the protocol interface structure(
VOID
);
EFI_STATUS
EFIAPI
type, 16 bytes (2 function pointers)(
VOID
);
EFI_STATUS
EFIAPI
= gBS->AllocatePool ((
VOID
);
EFI_STATUS
EFIAPI
the protocol structure(
VOID
);
EFI_STATUS
EFIAPI
aliased at the same offset as the third protocol function pointer.(
VOID
);
EFI_STATUS
EFIAPI
the protocol on the image handle(
VOID
);
EFI_STATUS
EFIAPI
= gBS->InstallMultipleProtocolInterfaces ((
VOID
);
EFI_STATUS
EFIAPI
SMM communication to update SMM watchdog handler state(
VOID
);
EFI_STATUS
EFIAPI
registered notify function if present(
VOID
);
EFI_STATUS
EFIAPI
(mWatchdogNotifyRegistered != NULL) {(
VOID
);
EFI_STATUS
EFIAPI
the reset event(
VOID
);
EFI_STATUS
EFIAPI
the system(
VOID
);
EFI_STATUS
EFIAPI
(NotifyFunction != NULL) {(
VOID
);
EFI_STATUS
EFIAPI
if handler is already registered(
VOID
);
EFI_STATUS
EFIAPI
(mWatchdogNotifyRegistered == NULL) {(
VOID
);
EFI_STATUS
EFIAPI
= (VOID *)NotifyFunction;(
VOID
);
EFI_STATUS
EFIAPI
the period value (aliased with the GetTimerPeriod function pointer)(
VOID
);
EFI_STATUS
EFIAPI
= TimerPeriod;(
VOID
);
EFI_STATUS
EFIAPI
the hardware timer(
VOID
);
EFI_STATUS
EFIAPI
gBS->SetTimer ((
VOID
);
EFI_STATUS
EFIAPI
cached value if already initialized(
VOID
);
EFI_STATUS
EFIAPI
= mHobList;(
VOID
);
EFI_STATUS
EFIAPI
a buffer from EFI HOB space to read the HOB entry(
VOID
);
EFI_STATUS
EFIAPI
= (UINTN)gBS->GetHobList ();(
VOID
);
EFI_STATUS
EFIAPI
is too small or invalid; return NULL(
VOID
);
EFI_STATUS
EFIAPI
NULL;(
VOID
);
EFI_STATUS
EFIAPI
the debug output device via protocol lookup(
VOID
);
EFI_STATUS
EFIAPI
= NULL;(
VOID
);
EFI_STATUS
EFIAPI
the result(
VOID
);
EFI_STATUS
EFIAPI
= DebugDevice;(
VOID
);
EFI_STATUS
EFIAPI
the debug output device(
VOID
);
EFI_STATUS
EFIAPI
= GetDebugOutputDevice ();(
VOID
);
EFI_STATUS
EFIAPI
CMOS NMI flag to determine assert severity(
VOID
);
EFI_STATUS
EFIAPI
1: Save current CMOS index, mask to keep NMI enabled(
VOID
);
EFI_STATUS
EFIAPI
= IoRead8 (0x70);(
VOID
);
EFI_STATUS
EFIAPI
2: Read the NMI status value at CMOS index 0x4B(
VOID
);
EFI_STATUS
EFIAPI
= IoRead8 (0x71);(
VOID
);
EFI_STATUS
EFIAPI
3: Determine effective error level from NMI value(
VOID
);
EFI_STATUS
EFIAPI
= NmiValue;(
VOID
);
EFI_STATUS
EFIAPI
NMI value is zero, read from fixed memory location(
VOID
);
EFI_STATUS
EFIAPI
= (*(volatile UINT8 *)0xFDAF0490) & 2 | 1;(
VOID
);
EFI_STATUS
EFIAPI
NMI status to error level:(
VOID
);
EFI_STATUS
EFIAPI
== 1 -> EFI_ERROR_MAJOR (0x80000004)(
VOID
);
EFI_STATUS
EFIAPI
!= 1 -> EFI_ERROR_MINOR (0x80000006)(
VOID
);
EFI_STATUS
EFIAPI
((NmiStatus - 1) <= 0xFD) {(
VOID
);
EFI_STATUS
EFIAPI
/ DEBUG_ERROR level(
VOID
);
EFI_STATUS
EFIAPI
(major)(
VOID
);
EFI_STATUS
EFIAPI
(minor)(
VOID
);
EFI_STATUS
EFIAPI
if the determined error level matches the caller's mask(
VOID
);
EFI_STATUS
EFIAPI
((EffectiveErrorLevel & ErrorLevel) != 0) {(
VOID
);
EFI_STATUS
EFIAPI
to debug output device(
VOID
);
EFI_STATUS
EFIAPI
= (DEBUG_PRINT_ASSERT_FUNCTION)((DEBUG_PRINT_PROTOCOL *)DebugDevice)->Print;(
VOID
);
EFI_STATUS
EFIAPI
the device's assert function(
VOID
);
EFI_STATUS
EFIAPI
= (DEBUG_ASSERT_FUNCTION)((DEBUG_PRINT_PROTOCOL *)DebugDevice)->Assert;(
VOID
);
EFI_STATUS
EFIAPI
(mHobList != NULL) {(
VOID
);
EFI_STATUS
EFIAPI
to failure state(
VOID
);
EFI_STATUS
EFIAPI
the number of configuration table entries(
VOID
);
EFI_STATUS
EFIAPI
= gST->NumberOfTableEntries;(
VOID
);
EFI_STATUS
EFIAPI
the configuration table looking for gEfiHobListGuid(
VOID
);
EFI_STATUS
EFIAPI
= gST->ConfigurationTable;(
VOID
);
EFI_STATUS
EFIAPI
= ConfigTable[Index].VendorTable;(
VOID
);
/// generate assert
EFI_STATUS
EFIAPI
list not found(
VOID
);
EFI_STATUS
EFIAPI
cached protocol if available(
VOID
);
EFI_STATUS
EFIAPI
= (EFI_SMM_COMMUNICATION_PROTOCOL *)mSmmCommunicationProtocol;(
VOID
);
EFI_STATUS
EFIAPI
the watchdog command via SMM communication(
VOID
);
EFI_STATUS
EFIAPI
= sizeof (SMM_COMMUNICATION_BUFFER);(
VOID
);
EFI_STATUS
EFIAPI
call: validate Boot Services table(
VOID
);
EFI_STATUS
EFIAPI
(gBS == NULL) {(
VOID
);
EFI_STATUS
EFIAPI
the SMM Communication Protocol(
VOID
);
EFI_STATUS
EFIAPI
the protocol pointer(
VOID
);
EFI_STATUS
EFIAPI
= (VOID *)SmmComm;(
VOID
);
EFI_STATUS
EFIAPI
the first 8 bytes of each GUID(
VOID
);
EFI_STATUS
EFIAPI
= ReadUnaligned64 (Entry);(
VOID
);
EFI_STATUS
EFIAPI
the second 8 bytes of each GUID(
VOID
);
EFI_STATUS
EFIAPI
= ReadUnaligned64 ((UINT8 *)Entry + 8);(
VOID
);
EFI_STATUS
EFIAPI
both 64-bit halves(
VOID
);
EFI_STATUS
EFIAPI
(BOOLEAN)(EntryGuidPart1 == ExpectedGuidPart1 &&(
VOID
);
#endif /* __WATCHDOGTIMER_H__ */