]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/scsi.4
scsi(4): fix "NMVe" typo
[FreeBSD/FreeBSD.git] / share / man / man4 / scsi.4
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 .Dd December 20, 2017
28 .Dt CAM 4
29 .Os
30 .Sh NAME
31 .Nm CAM
32 .Nd Common Access Method Storage subsystem
33 .Sh SYNOPSIS
34 .Cd "device scbus"
35 .Cd "device ada"
36 .Cd "device cd"
37 .Cd "device ch"
38 .Cd "device da"
39 .Cd "device pass"
40 .Cd "device pt"
41 .Cd "device sa"
42 .Cd "options CAMDEBUG"
43 .Cd "options CAM_DEBUG_BUS=-1"
44 .Cd "options CAM_DEBUG_TARGET=-1"
45 .Cd "options CAM_DEBUG_LUN=-1"
46 .Cd "options CAM_DEBUG_COMPILE=CAM_DEBUG_INFO|CAM_DEBUG_CDB|CAM_DEBUG_PROBE"
47 .Cd "options CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_CDB"
48 .Cd "options CAM_MAX_HIGHPOWER=4"
49 .Cd "options SCSI_NO_SENSE_STRINGS"
50 .Cd "options SCSI_NO_OP_STRINGS"
51 .Cd "options SCSI_DELAY=8000"
52 .Sh DESCRIPTION
53 The
54 .Nm
55 subsystem provides a uniform and modular system for the implementation
56 of drivers to control various
57 .Tn SCSI ,
58 .Tn ATA ,
59 .Tn NVMe ,
60 and
61 .Tn MMC / SD
62 devices, and to utilize different
63 .Tn SCSI ,
64 .Tn ATA ,
65 .Tn NVMe ,
66 and
67 .Tn MMC / SD
68 host adapters through host adapter drivers.
69 When the system probes buses, it attaches any devices it finds to the
70 appropriate drivers.
71 The
72 .Xr pass 4
73 driver, if it is configured in the kernel, will attach to all devices.
74 .Sh KERNEL CONFIGURATION
75 There are a number of generic kernel configuration options for the
76 .Nm
77 subsystem:
78 .Bl -tag -width SCSI_NO_SENSE_STRINGS
79 .It Dv CAMDEBUG
80 This option compiles in all the
81 .Nm
82 debugging printf code.
83 This will not actually
84 cause any debugging information to be printed out when included by itself.
85 See below for details.
86 .It Dv "CAM_MAX_HIGHPOWER=4"
87 This sets the maximum allowable number of concurrent "high power" commands.
88 A "high power" command is a command that takes more electrical power than
89 most to complete.
90 An example of this is the
91 .Tn SCSI
92 START UNIT command.
93 Starting a disk often takes significantly more electrical power than normal
94 operation.
95 This option allows the
96 user to specify how many concurrent high power commands may be outstanding
97 without overloading the power supply on his computer.
98 .It Dv SCSI_NO_SENSE_STRINGS
99 This eliminates text descriptions of each
100 .Tn SCSI
101 Additional Sense Code and Additional Sense Code Qualifier pair.
102 Since this
103 is a fairly large text database, eliminating it reduces the size of the
104 kernel somewhat.
105 This is primarily necessary for boot floppies and other
106 low disk space or low memory space environments.
107 In most cases, though,
108 this should be enabled, since it speeds the interpretation of
109 .Tn SCSI
110 error messages.
111 Do not let the "kernel bloat" zealots get to you -- leave
112 the sense descriptions in your kernel!
113 .It Dv SCSI_NO_OP_STRINGS
114 This disables text descriptions of each
115 .Tn SCSI
116 opcode.
117 This option, like the sense string option above, is primarily
118 useful for environments like a boot floppy where kernel size is critical.
119 Enabling this option for normal use is not recommended, since it slows
120 debugging of
121 .Tn SCSI
122 problems.
123 .It Dv SCSI_DELAY=8000
124 This is the
125 .Tn SCSI
126 "bus settle delay."
127 In
128 .Nm ,
129 it is specified in
130 .Em milliseconds ,
131 not seconds like the old
132 .Tn SCSI
133 layer used to do.
134 When the kernel boots, it sends a bus reset to each
135 .Tn SCSI
136 bus to tell each device to reset itself to a default set of transfer
137 negotiations and other settings.
138 Most
139 .Tn SCSI
140 devices need some amount of time to recover from a bus reset.
141 Newer disks
142 may need as little as 100ms, while old, slow devices may need much longer.
143 If the
144 .Dv SCSI_DELAY
145 is not specified, it defaults to 2 seconds.
146 The minimum allowable value for
147 .Dv SCSI_DELAY
148 is "100", or 100ms.
149 One special case is that if the
150 .Dv SCSI_DELAY
151 is set to 0, that will be taken to mean the "lowest possible value."
152 In that case, the
153 .Dv SCSI_DELAY
154 will be reset to 100ms.
155 .El
156 .Pp
157 All devices and buses support dynamic allocation so that
158 an upper number of devices and controllers does not need to be configured;
159 .Cd "device da"
160 will suffice for any number of disk drivers.
161 .Pp
162 The devices are either
163 .Em wired
164 so they appear as a particular device unit or
165 .Em counted
166 so that they appear as the next available unused unit.
167 .Pp
168 Units are wired down by setting kernel environment hints.
169 This is usually done either interactively from the
170 .Xr loader 8 ,
171 or automatically via the
172 .Pa /boot/device.hints
173 file.
174 The basic syntax is:
175 .Bd -literal -offset indent
176 hint.device.unit.property="value"
177 .Ed
178 .Pp
179 Individual
180 .Nm
181 bus numbers can be wired down to specific controllers with
182 a config line similar to the following:
183 .Bd -literal -offset indent
184 hint.scbus.0.at="ahd1"
185 .Ed
186 .Pp
187 This assigns
188 .Nm
189 bus number 0 to the
190 .Em ahd1
191 driver instance.
192 For controllers supporting more than one bus, a particular bus can be assigned
193 as follows:
194 .Bd -literal -offset indent
195 hint.scbus.0.at="ahc1"
196 hint.scbus.0.bus="1"
197 .Ed
198 .Pp
199 This assigns
200 .Nm
201 bus 0 to the bus 1 instance on
202 .Em ahc1 .
203 Peripheral drivers can be wired to a specific bus, target, and lun as so:
204 .Bd -literal -offset indent
205 hint.da.0.at="scbus0"
206 hint.da.0.target="0"
207 hint.da.0.unit="0"
208 .Ed
209 .Pp
210 This assigns
211 .Em da0
212 to target 0, unit (lun) 0 of scbus 0.
213 Omitting the target or unit hints will instruct
214 .Nm
215 to treat them as wildcards
216 and use the first respective counted instances.
217 These examples can be combined together to allow a peripheral device to be
218 wired to any particular controller, bus, target, and/or unit instance.
219 .Pp
220 This also works with
221 .Xr nvme 4
222 drives as well.
223 .Bd -literal -offset indent
224 hint.nvme.4.at="pci7:0:0"
225 hint.scbus.10.at="nvme4"
226 hint.nda.10.at="scbus10"
227 hint.nda.10.target="1"
228 hint.nda.10.unit="12"
229 hint.nda.11.at="scbus10"
230 hint.nda.11.target="1"
231 hint.nda.11.unit="2"
232 .Ed
233 .Pp
234 This assigns the NVMe card living at PCI bus 7 to scbus 10 (in PCIe,
235 slot and function are rarely used and usually 0).
236 The target for
237 .Xr nda 4
238 devices is always 1.
239 The unit is the namespace identifier from the drive.
240 The namespace id 1 is exported as
241 .Tn nda10
242 and namespace id 2 is exported as
243 .Tn nda11 .
244 .Pp
245 When you have a mixture of wired down and counted devices then the
246 counting begins with the first non-wired down unit for a particular
247 type.
248 That is, if you have a disk wired down as
249 .Em "device da1" ,
250 then the first non-wired disk shall come on line as
251 .Em da2 .
252 .Sh ADAPTERS
253 The system allows common device drivers to work through many different
254 types of adapters.
255 The adapters take requests from the upper layers and do
256 all IO between the
257 .Tn SCSI ,
258 .Tn ATA ,
259 .Tn NVMe ,
260 or
261 .Tn MMC / SD
262 bus and the system.
263 The maximum size of a transfer is governed by the
264 adapter.
265 Most adapters can transfer 64KB in a single operation, however
266 many can transfer larger amounts.
267 .Sh TARGET MODE
268 Some adapters support
269 .Em target mode
270 in which the system is capable of operating as a device, responding to
271 operations initiated by another system.
272 Target mode is supported for
273 some adapters, but is not yet complete for this version of the
274 .Nm
275 .Tn SCSI
276 subsystem.
277 .Sh FILES
278 see other
279 .Nm
280 device entries.
281 .Sh DIAGNOSTICS
282 An XPT_DEBUG CCB can be used to enable various amounts of tracing information
283 on any specific bus/device from the list of options compiled into the kernel.
284 There are currently seven debugging flags that may be compiled in and used:
285 .Bl -tag -width CAM_DEBUG_SUBTRACE
286 .It Dv CAM_DEBUG_INFO
287 This flag enables general informational printfs for the device
288 or devices in question.
289 .It Dv CAM_DEBUG_TRACE
290 This flag enables function-level command flow tracing i.e.,
291 kernel printfs will happen at the entrance and exit of various functions.
292 .It Dv CAM_DEBUG_SUBTRACE
293 This flag enables debugging output internal to various functions.
294 .It Dv CAM_DEBUG_CDB
295 This flag will cause the kernel to print out all
296 .Tn ATA
297 and
298 .Tn SCSI
299 commands sent to a particular device or devices.
300 .It Dv CAM_DEBUG_XPT
301 This flag will enable command scheduler tracing.
302 .It Dv CAM_DEBUG_PERIPH
303 This flag will enable peripheral drivers messages.
304 .It Dv CAM_DEBUG_PROBE
305 This flag will enable devices probe process tracing.
306 .El
307 .Pp
308 Some of these flags, most notably
309 .Dv CAM_DEBUG_TRACE
310 and
311 .Dv CAM_DEBUG_SUBTRACE ,
312 will produce kernel printfs in EXTREME numbers.
313 .Pp
314 Users can enable debugging from their kernel config file, by using
315 the following kernel config options:
316 .Bl -tag -width CAM_DEBUG_COMPILE
317 .It Dv CAMDEBUG
318 This builds into the kernel all possible
319 .Nm
320 debugging.
321 .It Dv CAM_DEBUG_COMPILE
322 This allows to specify support for which debugging flags described above
323 should be built into the kernel.
324 Flags may be ORed together if the user wishes to
325 see printfs for multiple debugging levels.
326 .It Dv CAM_DEBUG_FLAGS
327 This allows to set the various debugging flags from a kernel config file.
328 .It Dv CAM_DEBUG_BUS
329 Specify a bus to debug.
330 To debug all buses, set this to -1.
331 .It Dv CAM_DEBUG_TARGET
332 Specify a target to debug.
333 To debug all targets, set this to -1.
334 .It Dv CAM_DEBUG_LUN
335 Specify a lun to debug.
336 To debug all luns, set this to -1.
337 .El
338 .Pp
339 Users may also enable debugging on the fly by using the
340 .Xr camcontrol 8
341 utility, if wanted options built into the kernel.
342 See
343 .Xr camcontrol 8
344 for details.
345 .Sh SEE ALSO
346 .Xr ada 4 ,
347 .Xr aha 4 ,
348 .Xr ahc 4 ,
349 .Xr ahci 4 ,
350 .Xr ahd 4 ,
351 .Xr ata 4 ,
352 .Xr bt 4 ,
353 .Xr cd 4 ,
354 .Xr ch 4 ,
355 .Xr da 4 ,
356 .Xr nda 4 ,
357 .Xr nvme 4 ,
358 .Xr pass 4 ,
359 .Xr pt 4 ,
360 .Xr sa 4 ,
361 .Xr xpt 4 ,
362 .Xr camcontrol 8
363 .Sh HISTORY
364 The
365 .Nm
366 .Tn SCSI
367 subsystem first appeared in
368 .Fx 3.0 .
369 The
370 .Nm
371 ATA support was added in
372 .Fx 8.0 .
373 .Sh AUTHORS
374 .An -nosplit
375 The
376 .Nm
377 .Tn SCSI
378 subsystem was written by
379 .An Justin Gibbs
380 and
381 .An Kenneth Merry .
382 The
383 .Nm
384 .Tn ATA
385 support was added by
386 .An Alexander Motin Aq Mt mav@FreeBSD.org .
387 The
388 .Nm
389 .Tn NVMe
390 support was added by
391 .An Warner Losh Aq Mt imp@FreeBSD.org .