# McBankErrorInjection
**Index:** 0225 | **Size:** 7,328 bytes | **Phase:** SMM

## Overview
SMM debug/test driver that injects Machine Check Bank (MCBANK) error records into the UEFI variable store for RAS testing on Intel Purley platforms. On each boot, it checks an OEM policy variable via SMM Variable protocol to decide whether to inject a pre-built error injection descriptor (Type=3, INTEL MCEJ format). Builds a 320-byte error injection descriptor with "INTEL " vendor signature, registers an SMI handler via SMM SW Dispatch, and writes a 159-byte error record. Only built in DEBUG configuration.

## Key Functions
- **_ModuleEntryPoint** -- SMM entry: init services, SetJump protection, call main
- **sub_8F0** -- Main: OEM policy check via SMM Variable protocol, error injection flow
- **sub_754** -- Build INTEL error injection descriptor: allocate 320-byte buffer, fill Type=3 header, vendor signature "INTEL ", register SMI handler
- **sub_510** -- UEFI/SMM services init: locate SMM Base2, allocate SMRAM, init PCD and SMM CPU IO
- **sub_FB8** -- Cleanup: free SMRAM buffer on failure

## Protocols/Dependencies
- gEfiSmmBase2ProtocolGuid, gEfiSmmSwDispatch2ProtocolGuid
- gEfiSmmVariableProtocolGuid, gEfiPcdProtocolGuid
- SmmCpuIo protocol, INTEL MCEJ SMI handler protocol

## Platform
Intel Purley (Skylake-SP Xeon), HR650X -- DEBUG build only
Source: PurleyPlatPkg/Ras/Smm/McBankErrorInjection/