Newer
Older
AMI-Aptio-BIOS-Reversed / RegAccessSMM / README.md
@Ajax Dong Ajax Dong 2 days ago 1 KB Init

RegAccessSMM

Index: 0265 | Size: 27.5 KB | Phase: SMM | Arch: X64

Overview

SMM register access driver that provides a unified interface for reading/writing platform registers across PCI configuration space, memory-mapped IO (MMIO), and model-specific registers (MSR). Uses the USRA (Unified System Register Access) protocol to decode addresses and route CSR accesses to the correct IIO (Integrated IO) module. Manages S3 boot script operations -- saving/restoring register state to/from the SMM LockBox for S3 resume, and tracks per-socket topology data.

Key Functions

  • RegAccessSmmConstructor / RegAccessSmmDestructor: Module construction/destruction -- initializes S3 boot script library, allocates cache-aligned spinlock regions
  • RegAccessSmmEntryPoint: Main entry -- detects IIO protocol and CSR/MSR routing, initializes socket topology data (up to 4 sockets, 6 bytes per socket)
  • UsraDecodeAddress: Decodes register address to determine access method (PCI config, MMIO, MSR)
  • UsraSocketDataInit: Initializes per-socket topology data including BDF data, socket type, and MMCFG base address
  • S3BootScriptLibInitialize / S3BootScriptNotifyDxeSmmReadyToLock: Boot script lifecycle management for S3 resume
  • AcquireSpinLock / ReleaseSpinLock: Spinlock synchronization for register access

Protocols/Dependencies

  • USRA (Unified System Register Access) Protocol
  • IIO Protocol (for per-socket topology -- socket count, presence mask, max PCIe ports, CPU stepping)
  • EFI_SMM_S3_PROTOCOL (S3 boot script + LockBox for register state persistence)
  • SMM Debug Protocol, CMOS (port 0x70 index 0x4C for debug level)

Platform

Intel Purley platform (PurleySktPkg), Lenovo HR650X. Supports 4-socket IIO topology with MSR/CSR routing and S3 boot script persistence.