Newer
Older
AMI-Aptio-BIOS-Reversed / WheaSupport / WheaSupport.md
@Ajax Dong Ajax Dong 2 days ago 5 KB Init

WheaSupport

Function Table

Address Name Description
_ModuleEntryPoint
WheaSupportEntry
WheaCreateHestErrorSrcDescriptor
WheaGetErstRecordCount
WheaSetEinjConfig
WheaGetEinjContext
WheaGetBertContext
WheaSetErstConfig
WheaInstallTables
WheaReadyToBootNotify
WheaDriverInit
DebugLibConstructor
DebugPrint
DebugAssert
EfiGetSystemConfigurationTable
RegisterWheaReadyToBoot
InitAcpiTableHeader
CompareGuid
ReadUnaligned64
PE file: 0309_WheaSupport_95b18380d0d5 (from HR650X_3647_AJAX_BIOS)
Build info:
This DXE driver implements Windows Hardware Error Architecture (WHEA)
via SMM communication at ReadyToBoot:
The driver also allocates a shared communication buffer (0xE000 bytes)
at 0x4000 offset for HEST+ERST data, 0x6000 offset for BERT.
Global Variables (from IDA - .data section, imagebase 0x0)
Module globals (set during WheaSupportEntry)
0x1FF0 EFI_SYSTEM_TABLE *gSystemTable = NULL; // 0x1FE0
0x1FE8 EFI_RUNTIME_SERVICES *gRuntimeServices = NULL; // 0x1FF8
WHEA instance allocations (from WheaDriverInit)
Shared SMM communication buffer
Pointers into comm buffer
0x1F58 VOID *gHestErstData = NULL; // 0x1F78: at +0x4000
0x1F60 UINT32 gSize0x2000 = 0x2000; // 0x1F70
0x1F80 CHAR8 gWheaStr[] = "WHEA"; // 0x1F30
Protocol handles
0x1FD0 VOID *gDebugPort = NULL; // 0x2000
0x2020 VOID *gDS = NULL; // 0x2008
0x2010 VOID *gHobList = NULL; // 0x2018
Function table for WHEA protocol
0x1FA0 VOID *gFnGetErst = NULL; // 0x1FA8
0x1FB0 VOID *gFnGetEinjCtx = NULL; // 0x1FB8
0x1FC0 VOID *gFnSetErst = NULL; // 0x1FC8
CR (CONTAINING_RECORD) macros
The WHEA instance uses signature 0x41424344 ("ABCD") at offset -112 bytes
from the checked field pointer.
InternalCopyMem (0x2A0)
memmove with overlap handling.
Backward copy for overlapping regions
Forward copy in 8-byte chunks
InternalZeroMem (0x2F0)
_ModuleEntryPoint / WheaSupportEntry / WheaDriverInit
WheaSupportEntry (0x358)
Initializes UEFI boot services / runtime services globals
locates DxeServicesTable, PCI USRA protocol, HOB list, PCD protocol.
Save globals
Locate DxeServicesTable
Locate PCI USRA protocol (for MM PCI config access)
WheaCreateHestErrorSrcDescriptor (0x524)
Creates a HEST error source descriptor in the HEST table area.
0 = IA-32 Machine Check (standard) 656 bytes
1 = IPMI 664 bytes
6 = PCIe Root Port AER 48 bytes (16+32)
7 = PCIe Device AER 44 bytes (16+28)
8 = PCIe Bridge AER 56 bytes (16+40)
9 = Generic Hardware Error Source variable
HEST table ptr
current end offset
Type 9: Generic Hardware Error Source
Types 6, 7, 8 (PCIe AER)
WheaGetErstRecordCount (0x7DC)
WheaSetEinjConfig (0x7E0)
Configure EINJ table error injection entries.
CR offset: -0x70 (112 bytes)
Set EinjContext at Instance+0x68, EinjEntryCount in table
EINJ table length based on entries
WheaGetEinjContext (0x8BC)
WheaGetBertContext (0x91C)
WheaSetErstConfig (0x9A8)
WheaInstallTables (0xA5C)
Installs HEST, ERST, BERT, EINJ tables via SMM communication protocol.
Calls ->Communicate() for each table, then frees buffers.
already installed
HEST v15 = 0;
Mark installed and free tables
WheaReadyToBootNotify (0xBBC)
ReadyToBoot callback: calls WheaInstallTables.
Tolerates EFI_ALREADY_STARTED (0x8000000000000014).
WheaDriverInit (0xC10) - Main init function
ImageHandle capture
Locate WHEA protocol - if found, skip init (already registered)
Allocate tables
HEST header
EINJ header (determine entries from HW-reduced flag)
Allocate SMM communication buffer (0xE000)
placeholder gHestErstData = (UINT8 *)gCommBuffer + 0x4000;
BERT error region
Function table for protocol
Locate SMM Communication protocol
Register ReadyToBoot event
DebugLibConstructor (0x1068)
DebugPrint (0x10E8)
DebugAssert (0x1170)
Standard UEFI debug library functions used by MDE modules.
See edk2/MdePkg/Library/UefiDebugLibStdErr/
Read debug level from CMOS reg 0x4B
Memory allocation helpers
EfiGetSystemConfigurationTable (0x1208)
RegisterWheaReadyToBoot (0x12CC)
GetHobList (0x1354)
GetPcdProtocol (0x15D0)
InitAcpiTableHeader (0x13D8)
CopyMem (0x1458)
ZeroMem (0x14F8)
CompareGuid (0x1568)
ReadUnaligned64 (0x165C)
Set initial OEM placeholder
Get OEM values from PCD protocol
Creator ID
Creator Rev
OEM Revision

Generated by HR650X BIOS Decompilation Project