xref: /freebsd/share/man/man4/ada.4 (revision b00ab754)
1.\" Copyright (c) 2009 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.\"
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD$
27.\"
28.Dd December 20, 2017
29.Dt ADA 4
30.Os
31.Sh NAME
32.Nm ada
33.Nd ATA Direct Access device driver
34.Sh SYNOPSIS
35.Cd device ada
36.Sh DESCRIPTION
37The
38.Nm
39driver provides support for direct access devices, implementing the
40.Tn ATA
41command protocol, that are attached to the system through a host adapter
42supported by the CAM subsystem.
43.Pp
44The host adapter must also be separately configured into the system before an
45.Tn ATA
46direct access device can be configured.
47.Sh COMMAND QUEUING
48Command queuing allows the device to process multiple transactions
49concurrently, often re-ordering them to reduce the number and length of
50seeks.
51.Tn ATA
52defines two types of queuing:
53.Tn TCQ (Tagged Command Queuing, PATA legacy)
54and
55.Tn NCQ (Native Command Queuing, SATA) .
56The
57.Nm
58device driver takes full advantage of NCQ, when supported.
59To ensure that transactions to distant parts of the media,
60which may be deferred indefinitely by servicing requests closer to the current
61head position, are completed in a timely fashion, an ordered
62transaction is sent every 7 seconds during continuous device operation.
63.Sh CACHE EFFECTS
64Many direct access devices are equipped with read and/or write caches.
65Parameters affecting the device's cache are reported in device IDENTIFY data
66and can be examined and modified via the
67.Xr camcontrol 8
68utility.
69.Pp
70The read cache is used to store data from device-initiated read ahead
71operations as well as frequently used data.
72The read cache is transparent
73to the user and can be enabled without any adverse effect.
74Most devices
75with a read cache come from the factory with it enabled.
76.Pp
77The write cache can greatly decrease the latency of write operations
78and allows the device to reorganize writes to increase efficiency and
79performance.
80This performance gain comes at a price.
81Should the device
82lose power while its cache contains uncommitted write operations, these
83writes will be lost.
84The effect of a loss of write transactions on
85a file system is non-deterministic and can cause corruption.
86Most
87devices age write transactions to limit the vulnerability to a few transactions
88recently reported as complete, but it is nonetheless recommended that
89systems with write cache enabled devices reside on an Uninterruptible
90Power Supply (UPS).
91The
92.Nm
93device driver ensures that the cache and media are synchronized upon
94final close of the device or an unexpected shutdown (panic) event.
95This ensures that it is safe to disconnect power once the operating system
96has reported that it has halted.
97.Sh SYSCTL VARIABLES
98The following variables are available as both
99.Xr sysctl 8
100variables and
101.Xr loader 8
102tunables:
103.Bl -tag -width 12
104.It Va kern.cam.ada.retry_count
105.Pp
106This variable determines how many times the
107.Nm
108driver will retry a READ or WRITE command.
109This does not affect the number of retries used during probe time or for
110the
111.Nm
112driver dump routine.
113This value currently defaults to 4.
114.It Va kern.cam.ada.default_timeout
115.Pp
116This variable determines how long the
117.Nm
118driver will wait before timing out an outstanding command.
119The units for this value are seconds, and the default is currently 30
120seconds.
121.It Va kern.cam.ada.spindown_shutdown
122.Pp
123This variable determines whether to spin-down disks when shutting down.
124Set to 1 to enable spin-down, 0 to disable.
125The default is currently enabled.
126.It Va kern.cam.sort_io_queue
127.It Va kern.cam.ada. Ns Ar X Ns Va .sort_io_queue
128.Pp
129These variables determine whether request queue should be sorted trying
130to optimize head seeks.
131Set to 1 to enable sorting, 0 to disable, -1 to leave it as-is.
132The default is sorting enabled for HDDs and disabled SSDs.
133.It Va kern.cam.ada.read_ahead
134.It Va kern.cam.ada. Ns Ar X Ns Va .read_ahead
135.It Va kern.cam.ada.write_cache
136.It Va kern.cam.ada. Ns Ar X Ns Va .write_cache
137.Pp
138These variables determine whether device read-ahead and write caches
139should be enabled globally or per-device or disabled.
140Set to 1 to enable write cache, 0 to disable, -1 to leave it as-is.
141Values modified at runtime take effect only after device reset
142.Pq using the reset subcommand of Xr camcontrol 8 .
143Because of that, this setting should be changed in
144.Pa /boot/loader.conf
145instead of
146.Pa /etc/sysctl.conf .
147The global default is currently 1.
148The per-device default is to leave it as-is (follow global setting).
149.El
150.Sh FILES
151.Bl -tag -width ".Pa /dev/ada*" -compact
152.It Pa /dev/ada*
153ATA device nodes
154.El
155.Sh SEE ALSO
156.Xr ahci 4 ,
157.Xr cam 4 ,
158.Xr da 4 ,
159.Xr mvs 4 ,
160.Xr nda 4 ,
161.Xr siis 4
162.Sh HISTORY
163The
164.Nm
165driver first appeared in
166.Fx 8.0 .
167.Sh AUTHORS
168.An Alexander Motin Aq Mt mav@FreeBSD.org
169