⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module ahci

Module ahci 

Source
Expand description

AHCI (Advanced Host Controller Interface) / SATA Controller Driver

Implements AHCI HBA (Host Bus Adapter) discovery via PCI enumeration, port detection with device signature identification, and block-level read/write operations using the AHCI command infrastructure (FIS, Command List, PRDT). Includes NCQ (Native Command Queuing) stubs.

PCI identification: class 0x01 (Mass Storage), subclass 0x06 (SATA), prog-if 0x01 (AHCI 1.0).

Structs§

AhciBlockDevice
Wrapper around an AhciPort for the BlockDevice trait.
AhciController
AHCI Host Bus Adapter controller.
AhciPort
Represents a single AHCI port with its state and device info.
CommandHeader
Command Header (32 bytes, one per command slot).
CommandTableHeader
Command Table (variable size: 128-byte header + PRDT entries).
FisData
FIS Data – Bidirectional (variable length, header is 4 bytes).
FisDmaSetup
FIS DMA Setup – Bidirectional (28 bytes).
FisPioSetup
FIS PIO Setup – Device to Host (20 bytes).
FisRegD2H
FIS Register – Device to Host (20 bytes).
FisRegH2D
FIS Register – Host to Device (20 bytes).
PrdtEntry
Physical Region Descriptor Table entry (16 bytes).
ReceivedFis
Received FIS area for a single port (256 bytes, 256-byte aligned).

Enums§

AhciDeviceType
Type of device attached to an AHCI port.
PortState
State of an AHCI port.

Functions§

build_ncq_read_fis
Build a READ FPDMA QUEUED (NCQ) FIS.
build_ncq_write_fis
Build a WRITE FPDMA QUEUED (NCQ) FIS.
init
Discover and initialize AHCI controllers via PCI bus enumeration.
is_initialized
Check whether the AHCI subsystem has been initialized.
issue_ncq_command
Issue an NCQ command on a port (stub).
poll_ncq_completion
Poll for NCQ command completion on a port (stub).

Type Aliases§

NcqTag
NCQ command tag (0-31).