xref: /freebsd/share/man/man4/da.4 (revision faf25f48d601ae39f5752602f3020e2e92605625)
1.\" Copyright (c) 1996
2.\"	Julian Elischer <julian@FreeBSD.org>.  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 DA 4
30.Os
31.Sh NAME
32.Nm da
33.Nd SCSI Direct Access device driver
34.Sh SYNOPSIS
35.Cd device da
36.Sh DESCRIPTION
37The
38.Nm
39driver provides support for all
40.Tn SCSI
41devices of the direct access class that are attached to the system
42through a supported
43.Tn SCSI
44Host Adapter.
45The direct access class includes disk, magneto-optical,
46and solid-state devices.
47.Pp
48A
49.Tn SCSI
50Host
51adapter must also be separately configured into the system
52before a
53.Tn SCSI
54direct access device can be configured.
55.Sh CACHE EFFECTS
56Many direct access devices are equipped with read and/or write caches.
57Parameters affecting the device's cache are stored in mode page 8,
58the caching control page.
59Mode pages can be examined and modified via the
60.Xr camcontrol 8
61utility.
62.Pp
63The read cache is used to store data from device-initiated read ahead
64operations as well as frequently used data.
65The read cache is transparent
66to the user and can be enabled without any adverse effect.
67Most devices
68with a read cache come from the factory with it enabled.
69The read cache can be disabled by setting the
70.Tn RCD
71(Read Cache Disable) bit in the caching control mode page.
72.Pp
73The write cache can greatly decrease the latency of write operations
74and allows the device to reorganize writes to increase efficiency and
75performance.
76This performance gain comes at a price.
77Should the device
78lose power while its cache contains uncommitted write operations, these
79writes will be lost.
80The effect of a loss of write transactions on
81a file system is non-deterministic and can cause corruption.
82Most
83devices age write transactions to limit vulnerability to a few transactions
84recently reported as complete, but it is none-the-less recommended that
85systems with write cache enabled devices reside on an Uninterruptible
86Power Supply (UPS).
87The
88.Nm
89device driver ensures that the cache and media are synchronized upon
90final close of the device or an unexpected shutdown (panic) event.
91This ensures that it is safe to disconnect power once the operating system
92has reported that it has halted.
93The write cache can be enabled by setting the
94.Tn WCE
95(Write Cache Enable) bit in the caching control mode page.
96.Sh TAGGED QUEUING
97The
98.Nm
99device driver will take full advantage of the SCSI feature known as tagged
100queueing.
101Tagged queueing allows the device to process multiple transactions
102concurrently, often re-ordering them to reduce the number and length of
103seeks.
104To ensure that transactions to distant portions of the media,
105which may be deferred indefinitely by servicing requests nearer the current
106head position, are completed in a timely fashion, an ordered tagged
107transaction is sent every 15 seconds during continuous device operation.
108.Sh BAD BLOCK RECOVERY
109Direct Access devices have the capability of mapping out portions of
110defective media.
111Media recovery parameters are located in mode page 1,
112the Read-Write Error Recovery mode page.
113The most important media
114remapping features are 'Auto Write Reallocation' and 'Auto Read
115Reallocation' which can be enabled via the AWRE and ARRE bits,
116respectively, of the Read-Write Error Recovery page.
117Many devices do not ship from the factory with these feature enabled.
118Mode pages can be examined and modified
119via the
120.Xr camcontrol 8
121utility.
122.Sh KERNEL CONFIGURATION
123It is only necessary to explicitly configure one
124.Nm
125device; data structures are dynamically allocated as disks are found
126on the
127.Tn SCSI
128bus.
129.Sh SYSCTL VARIABLES
130The following variables are available as both
131.Xr sysctl 8
132variables and
133.Xr loader 8
134tunables:
135.Bl -tag -width 12
136.It Va kern.cam.da.retry_count
137This variable determines how many times the
138.Nm
139driver will retry a READ or WRITE command.
140This does not affect the number of retries used during probe time or for
141the
142.Nm
143driver dump routine.
144This value currently defaults to 4.
145.It Va kern.cam.da.default_timeout
146This variable determines how long the
147.Nm
148driver will wait before timing out an outstanding command.
149The units for this value are seconds, and the default is currently 60
150seconds.
151.It Va kern.cam.sort_io_queue
152.It Va kern.cam.da. Ns Ar X Ns Va .sort_io_queue
153These variables determine whether request queue should be sorted trying
154to optimize head seeks.
155Set to 1 to enable sorting, 0 to disable, -1 to leave it as-is.
156The default is sorting enabled for HDDs and disabled for SSDs.
157.It Va kern.cam.da. Ns Ar X Ns Va .delete_method
158This variable specifies method to handle BIO_DELETE requests:
159.Bl -tag -width "ATA_TRIM"
160.It ATA_TRIM
161ATA TRIM via ATA COMMAND PASS THROUGH command,
162.It UNMAP
163UNMAP command,
164.It WS16
165WRITE SAME(16) command with UNMAP flag,
166.It WS10
167WRITE SAME(10) command with UNMAP flag,
168.It ZERO
169WRITE SAME(10) command without UNMAP flag,
170.It DISABLE
171disable BIO_DELETE support.
172.El
173.It Va kern.cam.da. Ns Ar X Ns Va .minimum_cmd_size
174This variable determines what the minimum READ/WRITE CDB size is for a
175given
176.Nm
177unit.
178Valid minimum command size values are 6, 10, 12 and 16 bytes.
179The default is 6 bytes.
180.Pp
181The
182.Nm
183driver issues a CAM Path Inquiry CCB at probe time to determine whether the
184protocol the device in question speaks (e.g.\& ATAPI) typically does not allow
1856 byte commands.
186If it does not, the
187.Nm
188driver will default to using at least 10 byte CDBs.
189If a 6 byte READ or WRITE fails with an ILLEGAL REQUEST error, the
190.Nm
191driver will then increase the default CDB size for the device to 10 bytes and
192retry the command.
193CDB size is always
194chosen as the smallest READ/WRITE CDB that will satisfy the specified minimum
195command size, and the LBA and length of the READ or WRITE in question.
196(e.g., a write to an LBA larger than 2^32 will require a 16 byte CDB.)
197.El
198.Sh NOTES
199If a device becomes invalidated (media is removed, device becomes unresponsive)
200the disklabel and information held within the kernel about the device will
201be invalidated.
202To avoid corruption of a newly inserted piece of media or
203a replacement device, all accesses to the device will be discarded until
204the last file descriptor referencing the old device is closed.
205During this period, all new open attempts will be rejected.
206.Sh FILES
207.Bl -tag -width ".Pa /dev/da*" -compact
208.It Pa /dev/da*
209SCSI disk device nodes
210.El
211.Sh DIAGNOSTICS
212None.
213.Sh SEE ALSO
214.Xr ada 4 ,
215.Xr cam 4 ,
216.Xr geom 4 ,
217.Xr nda 4 ,
218.Xr gpart 8
219.Sh HISTORY
220The
221.Nm
222driver was written for the
223.Tn CAM
224.Tn SCSI
225subsystem by
226.An Justin T. Gibbs .
227Many ideas were gleaned from the
228.Nm sd
229device driver written and ported from
230.Tn Mach
2312.5
232by
233.An Julian Elischer .
234