AHCI(4)
π¦ AHCI(4) β Serial ATA Advanced Host Controller Interface driver π¦
okay so real talk: this is ahci(4), and it lives in the Kernel Interfaces Manual. it's the driver that gives you native access to your SATA ports, and honestly? it's kind of a big deal. let's get into it bestie π
β¨ NAME β¨
ahci β Serial ATA Advanced Host Controller Interface driver π
π« SYNOPSIS π«
wanna bake this driver right into your kernel? drop these lines in your kernel configuration file, no cap:
device pci
device scbus
device ahci
or, if you'd rather vibe with it as a module at boot time (so much easier fr fr), put this line in loader.conf(5):
ahci_load="YES"
the following tunables are settable from loader(8), and they're the little knobs that change how everything behaves:
hint.ahci.X.msiβ controls Message Signaled Interrupts (MSI) usage by the specified controller. the values are:0β MSI disabled, we're going old school;1β single MSI vector used, if supported;2β multiple MSI vectors used, if supported (this is the default, and it's iconic β¨).
hint.ahci.X.cccβ controls Command Completion Coalescing (CCC) usage by the specified controller. a non-zero value enables CCC and defines the maximum time (in ms) a request can wait for an interrupt, if there are some more requests present on the controller queue. CCC reduces the number of context switches on systems with many parallel requests, but heads up β it can decrease disk performance on some workloads because of the additional command latency. it's giving tradeoff π .hint.ahci.X.directβ controls whether the driver should use direct command completion from interrupt thread(s), or queue them to CAM completion threads. the default value depends on the number of MSI interrupts supported and the number of implemented SATA ports. iykyk.hint.ahcich.X.pm_levelβ controls SATA interface Power Management for the specified channel, which lets you save some power at the cost of additional command latency. possible values:0β interface Power Management is disabled (default);1β device is allowed to initiate PM state change, host is passive;2β host initiates PARTIAL PM state transition every time the port becomes idle;3β host initiates SLUMBER PM state transition every time the port becomes idle;4β driver initiates PARTIAL PM state transition 1ms after the port becomes idle;5β driver initiates SLUMBER PM state transition 125ms after the port becomes idle.
some controllers, such as ICH8, do not implement modes 2 and 3 with NCQ used. because of the artificial entering latency, performance degradation in modes 4 and 5 is much smaller than in modes 2 and 3.
note that interface Power Management complicates device presence detection. a manual bus reset/rescan may be needed after device hot-plug, unless the hardware implements Cold Presence Detection. so like, keep that in mind bestie π.
hint.ahcich.X.sata_revβ setting this to a nonzero value limits the maximum SATA revision (speed). the values1,2and3are respectively 1.5, 3 and 6Gbps.hw.ahci.forceβ setting this to a nonzero value forces the driver to attach to some known AHCI-capable chips even if they are configured for legacy IDE emulation. default is1.
π«Ά DESCRIPTION π«Ά
this driver provides the CAM(4) subsystem with native access to the SATA ports of AHCI-compatible controllers. every SATA port it finds gets represented to CAM as a separate bus with one target β or, if the HBA supports Port Multipliers, 16 targets. most of the bus-management details are handled by the SATA-specific transport of CAM. connected ATA disks are handled by the ATA protocol disk peripheral driver ada(4). ATAPI devices are handled by the SCSI protocol peripheral drivers cd(4), da(4), sa(4), etc.
driver features include support for:
- Serial ATA and ATAPI devices;
- Port Multipliers (including FIS-based switching, when supported);
- hardware command queues (up to 32 commands per port);
- Native Command Queuing;
- SATA interface Power Management;
- device hot-plug;
- Message Signaled Interrupts.
the driver also supports "LED" enclosure management messages, defined by the AHCI. when supported by hardware, it allows you to control per-port activity, locate and fault LEDs via the led(4) API or an emulated ses(4) device for localization and status reporting purposes. supporting AHCI controllers may transmit that information to the backplane controllers via the SGPIO interface. backplane controllers interpret the received statuses in some way (IBPI standard) to report them using present indicators. slay π
β¨
π₯ HARDWARE π₯
the ahci driver supports AHCI compatible controllers having PCI class 1 (mass storage), subclass 6 (SATA) and programming interface 1 (AHCI). yes, all three. periodt.
also, in cooperation with the atamarvell and atajmicron drivers of ata(4), it supports the AHCI part of legacy-PATA + AHCI-SATA combined controllers, such as JMicron JMB36x and Marvell 88SE61xx. iconic combo ngl.
the ahci driver also supports AHCI devices that act as PCI bridges for nvme(4) using Intel Rapid Storage Technology (RST). to use the nvme(4) device, either one must set the SATA mode in the BIOS to AHCI (from RST), or one must accept the performance with RST enabled due to interrupt sharing. FreeBSD will automatically detect AHCI devices with this extension that are in RST mode. when that happens, ahci will attach nvme(4) children to the ahci(4) device. main character energy fr fr π
π FILES π
/dev/led/ahci*.*.actβ activity LED device nodes/dev/led/ahci*.*.faultβ fault LED device nodes/dev/led/ahci*.*.locateβ locate LED device nodes
π SYSCTL π
dev.ahcich.X.disable_phy
set to 1 to disable the phy for the drive on channel X. set to 0 to enable the phy. useful for turning off troublemakers π. also useful for debugging when you need the ada drive to come and go.
π SEE ALSO π
ada(4), ata(4), cam(4), cd(4), da(4), sa(4), ses(4)
β HISTORY β
the ahci driver first appeared in FreeBSD 8.0. a legend from day one, honestly.
π AUTHORS π
Alexander Motin <mav@FreeBSD.org>
and that's the whole page bestie π this lil writeup came from the Debian edition, dated August 21, 2019, and it's filed under AHCI(4). now go forth and queue some commands β¨π¦
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2009-2013 Alexander Motin <mav@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms