1.\" Copyright (c) 2009-2013 Alexander Motin <mav@FreeBSD.org> 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.Dd December 17, 2021 26.Dt AHCI 4 27.Os 28.Sh NAME 29.Nm ahci 30.Nd Serial ATA Advanced Host Controller Interface driver 31.Sh SYNOPSIS 32To compile this driver into the kernel, 33place the following lines in your 34kernel configuration file: 35.Bd -ragged -offset indent 36.Cd "device pci" 37.Cd "device scbus" 38.Cd "device ahci" 39.Ed 40.Pp 41Alternatively, to load the driver as a 42module at boot time, place the following line in 43.Xr loader.conf 5 : 44.Bd -literal -offset indent 45ahci_load="YES" 46.Ed 47.Pp 48The following tunables are settable from the 49.Xr loader 8 : 50.Bl -ohang 51.It Va hint.ahci. Ns Ar X Ns Va .msi 52controls Message Signaled Interrupts (MSI) usage by the specified controller. 53.Pp 54.Bl -tag -width 4n -offset indent -compact 55.It 0 56MSI disabled; 57.It 1 58single MSI vector used, if supported; 59.It 2 60multiple MSI vectors used, if supported (default); 61.El 62.It Va hint.ahci. Ns Ar X Ns Va .ccc 63controls Command Completion Coalescing (CCC) usage by the specified controller. 64Non-zero value enables CCC and defines maximum time (in ms), request can wait 65for interrupt, if there are some more requests present on controller queue. 66CCC reduces number of context switches on systems with many parallel requests, 67but it can decrease disk performance on some workloads due to additional 68command latency. 69.It Va hint.ahci. Ns Ar X Ns Va .direct 70controls whether the driver should use direct command completion from 71interrupt thread(s), or queue them to CAM completion threads. 72Default value depends on number of MSI interrupts supported and number of 73implemented SATA ports. 74.It Va hint.ahci. Ns Ar X Ns Va .em 75controls whether the driver should implement virtual enclosure management 76device on top of SGPIO or other interface. 77Default value depends on controller capabilities. 78.It Va hint.ahcich. Ns Ar X Ns Va .pm_level 79controls SATA interface Power Management for the specified channel, 80allowing some power to be saved at the cost of additional command 81latency. 82Possible values: 83.Pp 84.Bl -tag -width 4n -offset indent -compact 85.It 0 86interface Power Management is disabled (default); 87.It 1 88device is allowed to initiate PM state change, host is passive; 89.It 2 90host initiates PARTIAL PM state transition every time port becomes idle; 91.It 3 92host initiates SLUMBER PM state transition every time port becomes idle. 93.It 4 94driver initiates PARTIAL PM state transition 1ms after port becomes idle; 95.It 5 96driver initiates SLUMBER PM state transition 125ms after port becomes idle. 97.El 98.Pp 99Some controllers, such as ICH8, do not implement modes 2 and 3 with NCQ used. 100Because of artificial entering latency, performance degradation in modes 1014 and 5 is much smaller then in modes 2 and 3. 102.Pp 103Note that interface Power Management complicates device presence detection. 104A manual bus reset/rescan may be needed after device hot-plug, unless hardware 105implements Cold Presence Detection. 106.It Va hint.ahcich. Ns Ar X Ns Va .sata_rev 107setting to nonzero value limits maximum SATA revision (speed). 108Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. 109.It Va hw.ahci.force 110setting to nonzero value forces driver attach to some known AHCI-capable 111chips even if they are configured for legacy IDE emulation. 112Default is 1. 113.El 114.Sh DESCRIPTION 115This driver provides the 116.Xr CAM 4 117subsystem with native access to the 118.Tn SATA 119ports of AHCI-compatible controllers. 120Each SATA port found is represented to CAM as a separate bus with one 121target, or, if HBA supports Port Multipliers, 16 targets. 122Most of the bus-management details are handled by the SATA-specific 123transport of CAM. 124Connected ATA disks are handled by the ATA protocol disk peripheral driver 125.Xr ada 4 . 126ATAPI devices are handled by the SCSI protocol peripheral drivers 127.Xr cd 4 , 128.Xr da 4 , 129.Xr sa 4 , 130etc. 131.Pp 132Driver features include support for Serial ATA and ATAPI devices, 133Port Multipliers (including FIS-based switching, when supported), 134hardware command queues (up to 32 commands per port), 135Native Command Queuing, SATA interface Power Management, device hot-plug 136and Message Signaled Interrupts. 137.Pp 138Driver supports "LED" enclosure management messages, defined by the AHCI. 139When supported by hardware, it allows to control per-port activity, locate 140and fault LEDs via the 141.Xr led 4 142API or emulated 143.Xr ses 4 144device for localization and status reporting purposes. 145Supporting AHCI controllers may transmit that information to the backplane 146controllers via SGPIO interface. 147Backplane controllers interpret received 148statuses in some way (IBPI standard) to report them using present indicators. 149.Sh HARDWARE 150The 151.Nm 152driver supports AHCI compatible controllers having PCI class 1 (mass storage), 153subclass 6 (SATA) and programming interface 1 (AHCI). 154.Pp 155Also, in cooperation with atamarvell and atajmicron drivers of ata(4), 156it supports AHCI part of legacy-PATA + AHCI-SATA combined controllers, 157such as JMicron JMB36x and Marvell 88SE61xx. 158.Pp 159The 160.Nm 161driver also supports AHCI devices that act as PCI bridges for 162.Xr nvme 4 163using Intel Rapid Storage Technology (RST). 164To use the 165.Xr nvme 4 166device, either one must set the SATA mode in the BIOS to AHCI (from RST), 167or one must accept the performance with RST enabled due to interrupt sharing. 168.Fx 169will automatically detect AHCI devices with this extension that are in RST 170mode. 171When that happens, 172.Nm 173will attach 174.Xr nvme 4 175children to the 176.Nm 177device. 178.Sh FILES 179.Bl -tag -width /dev/led/ahcich*.locate 180.It Pa /dev/led/ahci*.*.act 181activity LED device nodes 182.It Pa /dev/led/ahci*.*.fault 183fault LED device nodes 184.It Pa /dev/led/ahci*.*.locate 185locate LED device nodes 186.El 187.Sh SYSCTL 188.Bl -tag 189.It Pa dev.ahcich.X.disable_phy 190Set to 1 to disable the phy for the drive on channel X. 191Set to 0 to enable the phy. 192Useful for turning off troublemakers. 193Also useful for debugging when you need the ada drive to come and go. 194.El 195.Sh SEE ALSO 196.Xr ada 4 , 197.Xr ata 4 , 198.Xr cam 4 , 199.Xr cd 4 , 200.Xr da 4 , 201.Xr sa 4 , 202.Xr ses 4 203.Sh HISTORY 204The 205.Nm 206driver first appeared in 207.Fx 8.0 . 208.Sh AUTHORS 209.An Alexander Motin Aq Mt mav@FreeBSD.org 210