AhciRecovery
Index: 364 | Size: 19,364 bytes (4BA4h) | Phase: PEIM (Pre-EFI Initialization Module)
Overview
PEIM implementing AHCI SATA controller recovery/boot-from-disk functionality during the PEI phase. This module enumerates SATA controllers via PCI bus scan, initializes their AHCI HBA registers (BAR5 MMIO space), detects attached ATA/ATAPI devices on each port, and installs a SATA port protocol for block-level recovery I/O. Used by the recovery boot path when the main firmware volume is corrupted and the system must boot from a SATA-attached recovery image.
Key Functions
- AhciEnumerateSataControllers -- Scans PCI bus for AHCI-capable SATA controllers (up to 6), allocates per-controller context, and sets up MMIO BAR5 access
- AhciDeviceDetectionAndConfig -- Orchestrates full HBA init: controller enumeration, root bridge config, port-by-port device detection and identification (ATA IDENTIFY), builds HOBs for discovered devices
- AhciInitController -- Initializes a single AHCI controller: HBA reset, port configuration, command list and FIS area setup
- AhciPortCOMRESET -- Performs SATA COMRESET sequence on a port for device detection
- SataPortReadMultiBlock -- Reads multiple blocks from a SATA device via the port protocol
- AhciRecoveryInstallProtocol -- Installs the SATA port protocol interface with SataPortGetDevice/GetDeviceInfo/ReadMultiBlock entry points
Protocols/Dependencies
- PCI I/O protocol (USRA-based MMIO config access for ECAM)
- PEI Services: memory allocation, HOB creation, PCD database
- AHCI HBA MMIO registers (BAR5) for port command/status
- SATA 3.x host controller specification
HR650X (Purley) -- Intel LBG PCH (Lewisburg), x86 PE32 image