07_Study on AHCI - manojkumarpaladugu/UEFI-BIOS-Development GitHub Wiki
Introduction:
AHCI is a spec that defines functional behaviour and software interface of the Advanced Host Controller Interface, which is a hardware mechanism that allows software to communicate with SATA devices. AHCI is a PCI class device that acts as a data movement engine between system memory and SATA device. AHCI Host device (referred to as Host Bus Adapter (HBA)) supports from 1 to 32 ports.
Theory of Operation:
AHCI takes the basics of the scatter/gather list concept of Bus master IDE, and it expands to reduce CPU/software overhead and provide support for SATA features such as hot plug, power management, and accessing of several devices without performing master/slave emulation.
Communication between a device and software moves from the task file via byte-wide access to a command FIS located in system memory that is fetched by the HBA.
AHCI is defined to keep the HBA relatively simple so that it can act as data mover. All data transfers between the device and system memory occur through the HBA acting as a bus master to system memory. All transfers are performed using DMA. Transaction type can be DMA or PIO type. The AHCI defines a standard mechanism for implementing a SATA command queue using the DMA setup FIS. An HBA which supports queuing has individual slots in the Command List allocated in the system memory for all the commands. Software can place a command in empty slot, and upon notifying the HBA via register access, the HBA shall fetch the command and transfer it.