1fdee5abcSAlexander Motin.\" Copyright (c) 2009-2013 Alexander Motin <mav@FreeBSD.org> 252c9ce25SScott Long.\" All rights reserved. 352c9ce25SScott Long.\" 452c9ce25SScott Long.\" Redistribution and use in source and binary forms, with or without 552c9ce25SScott Long.\" modification, are permitted provided that the following conditions 652c9ce25SScott Long.\" are met: 752c9ce25SScott Long.\" 1. Redistributions of source code must retain the above copyright 852c9ce25SScott Long.\" notice, this list of conditions and the following disclaimer. 952c9ce25SScott Long.\" 2. Redistributions in binary form must reproduce the above copyright 1052c9ce25SScott Long.\" notice, this list of conditions and the following disclaimer in the 1152c9ce25SScott Long.\" documentation and/or other materials provided with the distribution. 1252c9ce25SScott Long.\" 13522a3b5fSAlexander Motin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14522a3b5fSAlexander Motin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15522a3b5fSAlexander Motin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16522a3b5fSAlexander Motin.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17522a3b5fSAlexander Motin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18522a3b5fSAlexander Motin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19522a3b5fSAlexander Motin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20522a3b5fSAlexander Motin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21522a3b5fSAlexander Motin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22522a3b5fSAlexander Motin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23522a3b5fSAlexander Motin.\" SUCH DAMAGE. 2452c9ce25SScott Long.\" 259aba757eSAlexander Motin.Dd December 17, 2021 2652c9ce25SScott Long.Dt AHCI 4 2752c9ce25SScott Long.Os 2852c9ce25SScott Long.Sh NAME 2952c9ce25SScott Long.Nm ahci 3052c9ce25SScott Long.Nd Serial ATA Advanced Host Controller Interface driver 3152c9ce25SScott Long.Sh SYNOPSIS 3252c9ce25SScott LongTo compile this driver into the kernel, 3352c9ce25SScott Longplace the following lines in your 3452c9ce25SScott Longkernel configuration file: 3552c9ce25SScott Long.Bd -ragged -offset indent 3652c9ce25SScott Long.Cd "device pci" 3752c9ce25SScott Long.Cd "device scbus" 3852c9ce25SScott Long.Cd "device ahci" 3952c9ce25SScott Long.Ed 4052c9ce25SScott Long.Pp 4152c9ce25SScott LongAlternatively, to load the driver as a 4252c9ce25SScott Longmodule at boot time, place the following line in 4352c9ce25SScott Long.Xr loader.conf 5 : 4452c9ce25SScott Long.Bd -literal -offset indent 4552c9ce25SScott Longahci_load="YES" 4652c9ce25SScott Long.Ed 4752c9ce25SScott Long.Pp 48550cc032SAlexander MotinThe following tunables are settable from the 49550cc032SAlexander Motin.Xr loader 8 : 5052c9ce25SScott Long.Bl -ohang 51550cc032SAlexander Motin.It Va hint.ahci. Ns Ar X Ns Va .msi 5250d922a0SGlen Barbercontrols Message Signaled Interrupts (MSI) usage by the specified controller. 537e3de069SJoel Dahl.Pp 547e3de069SJoel Dahl.Bl -tag -width 4n -offset indent -compact 5552c9ce25SScott Long.It 0 5652c9ce25SScott LongMSI disabled; 5752c9ce25SScott Long.It 1 58fdee5abcSAlexander Motinsingle MSI vector used, if supported; 5952c9ce25SScott Long.It 2 60fdee5abcSAlexander Motinmultiple MSI vectors used, if supported (default); 6152c9ce25SScott Long.El 62550cc032SAlexander Motin.It Va hint.ahci. Ns Ar X Ns Va .ccc 634dbabf10SAlexander Motincontrols Command Completion Coalescing (CCC) usage by the specified controller. 644dbabf10SAlexander MotinNon-zero value enables CCC and defines maximum time (in ms), request can wait 654dbabf10SAlexander Motinfor interrupt, if there are some more requests present on controller queue. 664dbabf10SAlexander MotinCCC reduces number of context switches on systems with many parallel requests, 674dbabf10SAlexander Motinbut it can decrease disk performance on some workloads due to additional 684dbabf10SAlexander Motincommand latency. 69fdee5abcSAlexander Motin.It Va hint.ahci. Ns Ar X Ns Va .direct 70fdee5abcSAlexander Motincontrols whether the driver should use direct command completion from 71fdee5abcSAlexander Motininterrupt thread(s), or queue them to CAM completion threads. 72fdee5abcSAlexander MotinDefault value depends on number of MSI interrupts supported and number of 73fdee5abcSAlexander Motinimplemented SATA ports. 749aba757eSAlexander Motin.It Va hint.ahci. Ns Ar X Ns Va .em 759aba757eSAlexander Motincontrols whether the driver should implement virtual enclosure management 769aba757eSAlexander Motindevice on top of SGPIO or other interface. 779aba757eSAlexander MotinDefault value depends on controller capabilities. 78550cc032SAlexander Motin.It Va hint.ahcich. Ns Ar X Ns Va .pm_level 79550cc032SAlexander Motincontrols SATA interface Power Management for the specified channel, 8052c9ce25SScott Longallowing some power to be saved at the cost of additional command 8152c9ce25SScott Longlatency. 8252c9ce25SScott LongPossible values: 837e3de069SJoel Dahl.Pp 847e3de069SJoel Dahl.Bl -tag -width 4n -offset indent -compact 8552c9ce25SScott Long.It 0 8652c9ce25SScott Longinterface Power Management is disabled (default); 8752c9ce25SScott Long.It 1 8852c9ce25SScott Longdevice is allowed to initiate PM state change, host is passive; 8952c9ce25SScott Long.It 2 9052c9ce25SScott Longhost initiates PARTIAL PM state transition every time port becomes idle; 9152c9ce25SScott Long.It 3 9252c9ce25SScott Longhost initiates SLUMBER PM state transition every time port becomes idle. 934dbabf10SAlexander Motin.It 4 944dbabf10SAlexander Motindriver initiates PARTIAL PM state transition 1ms after port becomes idle; 954dbabf10SAlexander Motin.It 5 964dbabf10SAlexander Motindriver initiates SLUMBER PM state transition 125ms after port becomes idle. 9752c9ce25SScott Long.El 987e3de069SJoel Dahl.Pp 994dbabf10SAlexander MotinSome controllers, such as ICH8, do not implement modes 2 and 3 with NCQ used. 1004dbabf10SAlexander MotinBecause of artificial entering latency, performance degradation in modes 1014dbabf10SAlexander Motin4 and 5 is much smaller then in modes 2 and 3. 1024dbabf10SAlexander Motin.Pp 1032266ba7bSAlexander MotinNote that interface Power Management complicates device presence detection. 1042266ba7bSAlexander MotinA manual bus reset/rescan may be needed after device hot-plug, unless hardware 1052266ba7bSAlexander Motinimplements Cold Presence Detection. 106550cc032SAlexander Motin.It Va hint.ahcich. Ns Ar X Ns Va .sata_rev 10752c9ce25SScott Longsetting to nonzero value limits maximum SATA revision (speed). 10852c9ce25SScott LongValues 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. 109c8973d9eSAlexander Motin.It Va hw.ahci.force 110c8973d9eSAlexander Motinsetting to nonzero value forces driver attach to some known AHCI-capable 11167e85209SMarius Stroblchips even if they are configured for legacy IDE emulation. 11267e85209SMarius StroblDefault is 1. 11352c9ce25SScott Long.El 11452c9ce25SScott Long.Sh DESCRIPTION 115550cc032SAlexander MotinThis driver provides the 116550cc032SAlexander Motin.Xr CAM 4 117550cc032SAlexander Motinsubsystem with native access to the 11852c9ce25SScott Long.Tn SATA 11952c9ce25SScott Longports of AHCI-compatible controllers. 12052c9ce25SScott LongEach SATA port found is represented to CAM as a separate bus with one 121eb31708aSAlexander Motintarget, or, if HBA supports Port Multipliers, 16 targets. 12252c9ce25SScott LongMost of the bus-management details are handled by the SATA-specific 12352c9ce25SScott Longtransport of CAM. 12452c9ce25SScott LongConnected ATA disks are handled by the ATA protocol disk peripheral driver 12552c9ce25SScott Long.Xr ada 4 . 12652c9ce25SScott LongATAPI devices are handled by the SCSI protocol peripheral drivers 12752c9ce25SScott Long.Xr cd 4 , 12852c9ce25SScott Long.Xr da 4 , 12952c9ce25SScott Long.Xr sa 4 , 13052c9ce25SScott Longetc. 13152c9ce25SScott Long.Pp 13252c9ce25SScott LongDriver features include support for Serial ATA and ATAPI devices, 13350237026SAlexander MotinPort Multipliers (including FIS-based switching, when supported), 13450237026SAlexander Motinhardware command queues (up to 32 commands per port), 13552c9ce25SScott LongNative Command Queuing, SATA interface Power Management, device hot-plug 13652c9ce25SScott Longand Message Signaled Interrupts. 13752c9ce25SScott Long.Pp 13896b7988fSAlexander MotinDriver supports "LED" enclosure management messages, defined by the AHCI. 13996b7988fSAlexander MotinWhen supported by hardware, it allows to control per-port activity, locate 14096b7988fSAlexander Motinand fault LEDs via the 14196b7988fSAlexander Motin.Xr led 4 142d19f06b3SAlexander MotinAPI or emulated 143d19f06b3SAlexander Motin.Xr ses 4 144d19f06b3SAlexander Motindevice for localization and status reporting purposes. 14596b7988fSAlexander MotinSupporting AHCI controllers may transmit that information to the backplane 14625972509SEdward Tomasz Napieralacontrollers via SGPIO interface. 14725972509SEdward Tomasz NapieralaBackplane controllers interpret received 14896b7988fSAlexander Motinstatuses in some way (IBPI standard) to report them using present indicators. 14952c9ce25SScott Long.Sh HARDWARE 15052c9ce25SScott LongThe 15152c9ce25SScott Long.Nm 15252c9ce25SScott Longdriver supports AHCI compatible controllers having PCI class 1 (mass storage), 15352c9ce25SScott Longsubclass 6 (SATA) and programming interface 1 (AHCI). 15450237026SAlexander Motin.Pp 15550237026SAlexander MotinAlso, in cooperation with atamarvell and atajmicron drivers of ata(4), 15650237026SAlexander Motinit supports AHCI part of legacy-PATA + AHCI-SATA combined controllers, 15793644902SAlexander Motinsuch as JMicron JMB36x and Marvell 88SE61xx. 15851c5de5fSWarner Losh.Pp 15951c5de5fSWarner LoshThe 16051c5de5fSWarner Losh.Nm 16151c5de5fSWarner Loshdriver also supports AHCI devices that act as PCI bridges for 16251c5de5fSWarner Losh.Xr nvme 4 16351c5de5fSWarner Loshusing Intel Rapid Storage Technology (RST). 16451c5de5fSWarner LoshTo use the 16551c5de5fSWarner Losh.Xr nvme 4 16651c5de5fSWarner Loshdevice, either one must set the SATA mode in the BIOS to AHCI (from RST), 16751c5de5fSWarner Loshor one must accept the performance with RST enabled due to interrupt sharing. 16851c5de5fSWarner Losh.Fx 16951c5de5fSWarner Loshwill automatically detect AHCI devices with this extension that are in RST 17051c5de5fSWarner Loshmode. 17151c5de5fSWarner LoshWhen that happens, 17251c5de5fSWarner Losh.Nm 17351c5de5fSWarner Loshwill attach 17451c5de5fSWarner Losh.Xr nvme 4 17551c5de5fSWarner Loshchildren to the 176*68445e34SChristian Brueffer.Nm 17751c5de5fSWarner Loshdevice. 17896b7988fSAlexander Motin.Sh FILES 17996b7988fSAlexander Motin.Bl -tag -width /dev/led/ahcich*.locate 180d19f06b3SAlexander Motin.It Pa /dev/led/ahci*.*.act 18196b7988fSAlexander Motinactivity LED device nodes 182d19f06b3SAlexander Motin.It Pa /dev/led/ahci*.*.fault 18396b7988fSAlexander Motinfault LED device nodes 184d19f06b3SAlexander Motin.It Pa /dev/led/ahci*.*.locate 18596b7988fSAlexander Motinlocate LED device nodes 18696b7988fSAlexander Motin.El 187f23a91c2SWarner Losh.Sh SYSCTL 188f23a91c2SWarner Losh.Bl -tag 189f23a91c2SWarner Losh.It Pa dev.ahcich.X.disable_phy 190f23a91c2SWarner LoshSet to 1 to disable the phy for the drive on channel X. 191f23a91c2SWarner LoshSet to 0 to enable the phy. 192f23a91c2SWarner LoshUseful for turning off troublemakers. 193f23a91c2SWarner LoshAlso useful for debugging when you need the ada drive to come and go. 1949ba19d8fSWarner Losh.El 19552c9ce25SScott Long.Sh SEE ALSO 19652c9ce25SScott Long.Xr ada 4 , 197550cc032SAlexander Motin.Xr ata 4 , 1982baf3a13SAlexander Motin.Xr cam 4 , 19952c9ce25SScott Long.Xr cd 4 , 20052c9ce25SScott Long.Xr da 4 , 201d19f06b3SAlexander Motin.Xr sa 4 , 202d19f06b3SAlexander Motin.Xr ses 4 20352c9ce25SScott Long.Sh HISTORY 20452c9ce25SScott LongThe 20552c9ce25SScott Long.Nm 20652c9ce25SScott Longdriver first appeared in 20752c9ce25SScott Long.Fx 8.0 . 20852c9ce25SScott Long.Sh AUTHORS 2096c899950SBaptiste Daroussin.An Alexander Motin Aq Mt mav@FreeBSD.org 210