# AmiErrorHandlerMain
**Index:** 0219 | **Size:** 39,812 bytes (163,456 body) | **Phase:** SMM

## Overview
SMM error handler from American Megatrends (AMI) that receives error notifications via SMM communication protocol, classifies them by error source type (1-9), and dispatches to platform-specific handlers. Manages CPU topology tracking (socket/core/thread) for error source correlation and reports Configuration Status Register (CSR) data to BMC via IPMI/SMM communicate. Handles MCA errors, PCIe AER errors, and generic bus/memory/I/O errors.

## Key Functions
- **ModuleEntryPoint** -- Driver entry: initializes libraries (18 constructors), registers SMI handler
- **sub_27E4** -- Core error dispatch: switch(error_source=1..9) routes to domain-specific handlers
- **sub_2724** -- MCA error severity classification (corrected/uncorrected/fatal/deferred)
- **sub_2F2C** -- Report CSR info to BMC via SmmCommunication with formatted 12-byte record
- **sub_1500** -- MP sync data init: builds 3D topology (socket x core x thread) indexed by APIC ID
- **sub_1BE4** -- MC bank list population based on CPU model selection

## Protocols/Dependencies
- EFI_SMM_BASE2_PROTOCOL, EFI_SMM_ACCESS2_PROTOCOL, EFI_SMM_MP_PROTOCOL
- AMI EMCA_PLATFORM_HOOKS protocol, MP_SYNC_DATA protocol
- SMM CSR Report Protocol (1DBD1503-...) for BMC communication

## Platform
Intel Purley (Xeon Scalable), HR650X
Source: PurleyPlatPkg/Ras/Smm/ErrHandling/AmiErrorHandlerMain/