AHCI
This document describes the AHCI (Advanced Host Controller Interface) driver in the Kyronix kernel. It is the child of Drivers.
Source
kernel/drivers/ahci.c
Overview
AHCI provides access to SATA storage devices. The driver initializes AHCI controllers discovered via PCI enumeration and registers block devices for each attached drive.
Initialization
- Scan PCI devices for AHCI class (class=0x01, subclass=0x06)
- Read ABAR (AHCI Base Address Register) from PCI BAR5
- Map AHCI HBA registers into kernel virtual space
- Reset the HBA and detect attached ports
- For each active port, initialize command list and FIS structures
- Register as block device via
block_register()
Block Device Interface
AHCI block devices are accessed through the generic block device layer:
struct block_device {
void (*read)(uint64_t lba, uint32_t count, void *buf);
void (*write)(uint64_t lba, uint32_t count, const void *buf);
uint64_t total_sectors;
// ...
};
Functions
| Function | Description |
|---|---|
ahci_init() | Initialize AHCI controller(s) |
ahci_ready() | Check if AHCI is operational |
NOTE: AHCI devices appear as /dev/ahci0 via devfs.
Last reviewed: 2026-07-22