xref: /dragonfly/share/man/man4/ahci.4 (revision 7d3e9a5b)
1.\"	$OpenBSD: ahci.4,v 1.7 2008/04/19 01:18:39 djm Exp $
2.\"
3.\" Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
4.\" Copyright (c) 2009-2016 Matthew Dillon <dillon@backplane.com>
5.\"
6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" TORTIOUS ACTION, ARISING OUT OF
16.\" PERFORMANCE OF THIS SOFTWARE.
17.\"
18.\" Copyright (c) 2016 The DragonFly Project.  All rights reserved.
19.\"
20.\" This code is derived from software contributed to The DragonFly Project
21.\" by Matthew Dillon <dillon@backplane.com>
22.\"
23.\" Redistribution and use in source and binary forms, with or without
24.\" modification, are permitted provided that the following conditions
25.\" are met:
26.\"
27.\" 1. Redistributions of source code must retain the above copyright
28.\"    notice, this list of conditions and the following disclaimer.
29.\" 2. Redistributions in binary form must reproduce the above copyright
30.\"    notice, this list of conditions and the following disclaimer in
31.\"    the documentation and/or other materials provided with the
32.\"    distribution.
33.\" 3. Neither the name of The DragonFly Project nor the names of its
34.\"    contributors may be used to endorse or promote products derived
35.\"    from this software without specific, prior written permission.
36.\"
37.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
38.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
39.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
40.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
41.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
42.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
43.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
44.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
45.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48.\" SUCH DAMAGE.
49.\"
50.Dd November 28, 2014
51.Dt AHCI 4
52.Os
53.Sh NAME
54.Nm ahci
55.Nd Advanced Host Controller Interface for Serial ATA
56.Sh SYNOPSIS
57To compile this driver into the kernel,
58place the following line in your
59kernel configuration file:
60.Bd -ragged -offset indent
61.Cd "device ahci"
62.Ed
63.Pp
64Alternatively, to load the driver as a
65module at boot time, place the following line in
66.Xr loader.conf 5 :
67.Bd -literal -offset indent
68ahci_load="YES"
69.Ed
70.Pp
71Note that
72.Dx
73compiles this driver into the kernel by default, so you normally do not
74have to do anything..
75.Sh DESCRIPTION
76The
77.Nm
78driver provides support for Serial ATA controllers conforming to the
79Advanced Host Controller Interface specification.
80.Pp
81Several AHCI capable controllers also provide a compatibility mode that
82causes them to appear as a traditional ATA controller supported by
83.Xr nata 4 .
84.Pp
85Although
86.Nm
87controllers are actual ATA controllers, the driver emulates SCSI via a
88translation layer.
89.Sh Special Features
90This driver detects chipsets with the FBS capability, indicating FIS-Based
91Switching support.
92This capability allows I/O to be queued to multiple targets behind a
93port-multiplier and will substantially increase performance when
94operating on multiple targets at once.
95Unfortunately, most AHCI controllers do not implement FBS.  Without it,
96concurrent access to multiple targets behind a port-multiplier will
97serialize and wind up being quite slow.
98.Pp
99This driver detects and supports chipsets with the SPM capability,
100indicating Port-Multiplier support.
101This capability allows you to connect a port-multiplier to the SATA port.
102The driver will then probe and attach all targets loaded into the
103port-multiplier.
104A few provisios... most port-multipliers implode if no drives are loaded
105into them, and most port-multipliers also fail to properly follow the
106AHCI port-multiplier standards, so YMMV.  The driver will do everything it
107can to attach to a port-multiplier if it sees one.
108.Sh WARNINGS
109eSATA PCIe cards -
110There are many consumer PCIe cards which provide on-board AHCI controllers
111and internal or external ports.
112This driver should work with most of them.
113However, we strongly recommend that you avoid purchasing any AHCI PCIe
114cards which provide both external eSATA and internal SATA ports and
115have jumpers to select between the two.
116The jumper header seriously interferes with delicate SATA
117communications and can cause instability and I/O errors even at slower
1183Gbps speeds.
119.Pp
120Port-Multipliers -
121There are many consumer port multipliers.  Nearly all of them fail to
122properly follow the spec.  This driver works hard to attach to whatever
123port-mutilplier it sees.  A good rule of thumb to follow is to
124always plug something into the first target slot on the PM.
125Dual eSATA/USB port-multipliers are very common but tend to have poorly
126implemented firmwares.  Still, you might not have a choice, so YMMV.
127Issues that can arise: The PM fails to probe, or the driver only sees
128one drive, or hot-swap detection fails to operate properly.
129.Pp
130Port-Multipliers require PM-capable AHCI chipsets.
131Most AHCI chipsets are not PM-capable... Intel is particularly bad (for
132reasons unknown).  Marvell chipsets tend to either be PM-capable or
133implement virtual PM handling on a (single) normal SATA port.  ASMedia
134chipsets are usually PM-capable, but the PCIe card might be poorly designed
135and generate lots of I/O errors due to electrical noise.
136.Pp
137The asynchronous attach described below may cause problems detecting your
138boot drive quickly enough for the kernel to be able to mount it.
139If you use the feature, the boot drive should normally be on the first
140AHCI controller and not be behind a port-multiplier.
141Only use the feature if you have a lot of controllers (like three or more).
142.Sh LOADER TUNABLES
143The following hints may be set in
144.Xr loader.conf 5
145to control the
146.Nm
147driver's behavior.
148Note that the hint need only exist, so removing it requires commenting it out.
149.Pp
150Usually both the
151.Xr nata 4
152and the
153.Nm
154drivers are loaded.
155The
156.Xr nata 4
157driver will pick up any ata-like devices which the
158.Nm
159driver misses.
160If the
161.Nm
162driver is disabled the
163.Xr nata 4
164driver will typically pick up the
165.Nm
166devices, albeit under the
167.Pa ad
168disk name rather than the
169.Pa da
170disk name.
171.Bd -literal -offset indent
172hint.ahci.disabled=1
173.Ed
174.Pp
175The
176.Nm
177driver can be told to force a lower-speed 1.5Gb or 3.0Gb link speed
178if necessary, and can also be told to refrain from attempting to send
179certain higher-level ATA commands to initialize ATA features which
180some devices might not properly implement.
181Dropping the link speed is sometimes necessary to avoid chipset comm errors
182when a machine's cabling is sub-standard.
183.Bd -literal -offset indent
184hint.ahci.force150=1
185hint.ahci.force300=1
186hint.ahci.force600=1
187hint.ahci.nofeatures=1
188.Ed
189.Pp
190By default, the driver will use MSI if it is supported.
191This behavior can be turned off by setting the following tunable:
192.Bd -literal -offset indent
193hw.ahci.msi.enable=0
194.Ed
195.Pp
196By default, on startup the driver will synchronously wait for all ports
197to probe and attach them in order before allowing the kernel boot to
198proceed to the next controller.
199Even though ports are probed in parallel, this can slow booting down
200if your system has multiple AHCI controllers.
201You can force a full asynchronous probe by setting the following
202tunable.
203The kernel will still wait for all controllers to finish before
204proceeding to the mountroot, but all ports will probe in parallel
205so booting will be a lot faster.
206WARNING!  When probing asynchronously /dev/da* assignments for drives can
207change from boot to boot, so be sure to only access drives by their
208/dev/serno/* path and not by their /dev/da* drive.
209.Bd -literal -offset indent
210# Attach everything asynchronously
211hw.ahci.synchronous_boot=0
212.Ed
213.Sh SYSCTL VARIABLES
214Link power management can be set with the sysctl
215.Va dev.ahci.%d.%d.link_pwr_mgmt
216to 0 for `disabled', 1 for `medium', and 2 for `aggressive'.
217Link power state can be read with the sysctl
218.Va dev.ahci.%d.%d.link_pwr_state .
219.Sh SEE ALSO
220.Xr intro 4 ,
221.Xr nata 4 ,
222.Xr nvme 4 ,
223.Xr pci 4 ,
224.Xr scsi 4 ,
225.Xr sili 4 ,
226.Xr loader.conf 5
227.Sh HISTORY
228The
229.Nm
230driver first appeared in
231.Dx 2.3 .
232.Sh AUTHORS
233.An -nosplit
234The
235.Nm
236driver was originally written by
237.An David Gwynne Aq Mt dlg@openbsd.org
238and
239.An Christopher Pascoe Aq Mt pascoe@openbsd.org
240for
241.Ox .
242.Pp
243It was ported to
244.Dx
245by
246.An Matt Dillon Aq Mt dillon@apollo.backplane.com ,
247who substantially rewrote the driver (honestly, just about from scratch
248but having the openbsd code as a reference helped a lot), and
249added new features such as hot-plug, FIS-based switching, and port
250multiplier support.
251