Merge branch 'vendor/OPENSSL'
[dragonfly.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: src/share/man/man4/scsi.4,v 1.18.2.7 2001/08/17 13:08:39 ru Exp $
27 .\" $DragonFly: src/share/man/man4/scsi.4,v 1.5 2008/02/10 00:01:01 pavalos Exp $
28 .Dd October 15, 1998
29 .Dt SCSI 4
30 .Os
31 .Sh NAME
32 .Nm SCSI ,
33 .Nm CAM
34 .Nd CAM SCSI subsystem
35 .Sh SYNOPSIS
36 .Cd "device scbus"
37 .Cd "device scbus1 at ahc0"
38 .Cd "device scbus3 at ahc1 bus 0"
39 .Cd "device scbus2 at ahc1 bus 1"
40 .Cd "device cd"
41 .Cd "device ch"
42 .Cd "device da"
43 .Cd "device pass"
44 .Cd "device pt"
45 .Cd "device sa"
46 .Cd "device ch1 at scbus0 target 4 unit 0"
47 .Cd "options CAMDEBUG"
48 .Cd "options CAM_DEBUG_BUS=-1"
49 .Cd "options CAM_DEBUG_TARGET=-1"
50 .Cd "options CAM_DEBUG_LUN=-1"
51 .Cd "options CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_CDB"
52 .Cd "options CAM_MAX_HIGHPOWER=4"
53 .Cd "options SCSI_NO_SENSE_STRINGS"
54 .Cd "options SCSI_NO_OP_STRINGS"
55 .Cd "options SCSI_DELAY=8000"
56 .Sh DESCRIPTION
57 The CAM
58 .Tn SCSI
59 subsystem provides a uniform and modular system for the implementation
60 of drivers to control various
61 .Tn SCSI
62 devices, and to utilize different
63 .Tn SCSI
64 host adapters through host adapter drivers.
65 When the system probes the
66 .Tn SCSI
67 busses, it attaches any devices it finds to the appropriate
68 drivers.  The
69 .Xr pass 4
70 driver, if it is configured in the kernel, will attach to all
71 .Tn SCSI
72 devices.
73 .Sh KERNEL CONFIGURATION
74 There are a number of generic kernel configuration options for the
75 CAM
76 .Tn SCSI
77 subsystem:
78 .Bl -tag -width SCSI_NO_SENSE_STRINGS
79 .It Dv CAMDEBUG
80 This option enables the CAM debugging printf code.  This won't actually
81 cause any debugging information to be printed out when included by itself.
82 Enabling printouts requires additional configuration.  See below for
83 details.
84 .It Dv "CAM_MAX_HIGHPOWER=4"
85 This sets the maximum allowable number of concurrent "high power" commands.
86 A "high power" command is a command that takes more electrical power than
87 most to complete.  An example of this (and the only command currently
88 tagged as "high power") is the
89 .Tn SCSI
90 START UNIT command.  Starting a SCSI disk often takes significantly more
91 electrical power than normal operation of the disk.  This option allows the
92 user to specify how many concurrent high power commands may be outstanding
93 without overloading the power supply on his computer.
94 .It Dv SCSI_NO_SENSE_STRINGS
95 This eliminates text descriptions of each
96 .Tn SCSI
97 Additional Sense Code and Additional Sense Code Qualifier pair.  Since this
98 is a fairly large text database, eliminating it reduces the size of the
99 kernel somewhat.  This is primarily necessary for boot floppies and other
100 low disk space or low memory space environments.  In most cases, though,
101 this should be enabled, since it speeds the interpretation of
102 .Tn SCSI
103 error messages.  Don't let the "kernel bloat" zealots get to you -- leave
104 the sense descriptions in your kernel!
105 .It Dv SCSI_NO_OP_STRINGS
106 This disables text descriptions of each
107 .Tn SCSI
108 opcode.  This option, like the sense string option above, is primarily
109 useful for environments like a boot floppy where kernel size is critical.
110 Enabling this option for normal use isn't recommended, since it slows
111 debugging of
112 .Tn SCSI
113 problems.
114 .It Dv SCSI_DELAY=8000
115 This is the
116 .Tn SCSI
117 "bus settle delay."  In CAM, it is specified in
118 .Em milliseconds ,
119 not seconds like the old
120 .Tn SCSI
121 layer used to do.  When the kernel boots, it sends a bus reset to each
122 .Tn SCSI
123 bus to tell each device to reset itself to a default set of transfer
124 negotiations and other settings.  Most
125 .Tn SCSI
126 devices need some amount of time to recover from a bus reset.  Newer disks
127 may need as little as 100ms, while old, slow devices may need much longer.
128 If the
129 .Dv SCSI_DELAY
130 isn't specified, it defaults to 2 seconds.  The minimum allowable value for
131 .Dv SCSI_DELAY
132 is "100", or 100ms.  One special case is that if the
133 .Dv SCSI_DELAY
134 is set to 0, that will be taken to mean the "lowest possible value."  In
135 that case, the
136 .Dv SCSI_DELAY
137 will be reset to 100ms.
138 .El
139 .Pp
140 All devices and the SCSI busses support boot time allocation so that
141 an upper number of devices and controllers does not need to be configured;
142 .Cd "device da0"
143 will suffice for any number of disk drivers.
144 .Pp
145 The devices are either
146 .Em wired
147 so they appear as a particular device unit or
148 .Em counted
149 so that they appear as the next available unused unit.
150 .Pp
151 To configure a driver in the kernel without wiring down the device use a
152 config line similar to
153 .Cd "device ch0"
154 to include the changer driver.
155 .Pp
156 To wire down a unit use a config line similar to
157 .Cd "device ch1 at scbus0 target 4 unit 0"
158 to assign changer 1 as the changer with SCSI ID 4,
159 SCSI logical unit 0 on SCSI bus 0.
160 Individual scbuses can be wired down to specific controllers with
161 a config line similar to
162 .Cd "device scbus0 at ahc0"
163 which assigns scsi bus 0 to the first unit using the ahc driver.
164 For controllers supporting more than one bus,
165 the particular bus can be specified as in
166 .Cd "device scbus3 at ahc1 bus 1"
167 which assigns scbus 1 to the second bus probed on the ahc1 device.
168 .Pp
169 When you have a mixture of wired down and counted devices then the
170 counting begins with the first non-wired down unit for a particular
171 type.  That is, if you have a disk wired down as
172 .Em "device da1" ,
173 then the first non-wired disk shall come on line as
174 .Em da2 .
175 .Sh ADAPTERS
176 The system allows common device drivers to work through many different
177 types of adapters.
178 The adapters take requests from the upper layers and do
179 all IO between the
180 .Em SCSI
181 bus and the system.
182 The maximum size of a transfer is governed by the
183 adapter.
184 Most adapters can transfer 64KB in a single operation, however
185 many can transfer larger amounts.
186 .Sh TARGET MODE
187 Some adapters support
188 .Em target mode
189 in which the system is capable of operating as a device, responding to
190 operations initiated by another system.
191 Target mode is supported for
192 some adapters, but is not yet complete for this version of the CAM
193 .Tn SCSI
194 subsystem.
195 .Sh FILES
196 see other scsi device entries.
197 .Sh DIAGNOSTICS
198 When the kernel is compiled with
199 .Cd "options CAMDEBUG" ,
200 an XPT_DEBUG CCB can be
201 used to enable various amounts of tracing information on any
202 specific device.
203 Devices not being traced will not produce trace information.
204 There are currently four debugging flags that may be turned on:
205 .Bl -tag -width CAM_DEBUG_SUBTRACE
206 .It Dv CAM_DEBUG_INFO
207 This debugging flag enables general informational printfs for the device
208 or devices in question.
209 .It Dv CAM_DEBUG_TRACE
210 This debugging flag enables function-level command flow tracing.  i.e.\&
211 kernel printfs will happen at the entrance and exit of various functions.
212 .It Dv CAM_DEBUG_SUBTRACE
213 This debugging flag enables debugging output internal to various functions.
214 .It Dv CAM_DEBUG_CDB
215 This debugging flag will cause the kernel to print out all
216 .Tn SCSI
217 commands sent to a particular device or devices.
218 .El
219 .Pp
220 Some of these flags, most notably
221 .Dv CAM_DEBUG_TRACE
222 and
223 .Dv CAM_DEBUG_SUBTRACE
224 will produce kernel printfs in EXTREME numbers.  Because of that, they
225 aren't especially useful.  There aren't many things logged at the
226 .Dv CAM_DEBUG_INFO
227 level, so it isn't especially useful.  The most useful debugging flag is
228 the
229 .Dv CAM_DEBUG_CDB
230 flag.  Users can enable debugging from their kernel config file, by using
231 the following kernel config options:
232 .Bl -tag -width CAM_DEBUG_TARGET
233 .It Dv CAMDEBUG
234 This enables CAM debugging.  Without this option, users will not even be able
235 to turn on debugging from userland via
236 .Xr camcontrol 8 .
237 .It Dv CAM_DEBUG_FLAGS
238 This allows the user to set the various debugging flags described above
239 in a kernel config file.  Flags may be ORed together if the user wishes to
240 see printfs for multiple debugging levels.
241 .It Dv CAM_DEBUG_BUS
242 Specify a bus to debug.  To debug all busses, set this to -1.
243 .It Dv CAM_DEBUG_TARGET
244 Specify a target to debug.  To debug all targets, set this to -1.
245 .It Dv CAM_DEBUG_LUN
246 Specify a lun to debug.  To debug all luns, set this to -1.
247 .El
248 .Pp
249 When specifying a bus, target or lun to debug, you
250 .Em MUST
251 specify all three bus/target/lun options above.  Using wildcards, you
252 should be able to enable debugging on most anything.
253 .Pp
254 Users may also enable debugging printfs on the fly, if the
255 .Dv CAMDEBUG
256 option is their config file, by using the
257 .Xr camcontrol 8
258 utility.  See
259 .Xr camcontrol 8
260 for details.
261 .Sh SEE ALSO
262 .Xr aha 4 ,
263 .Xr ahb 4 ,
264 .Xr ahc 4 ,
265 .Xr bt 4 ,
266 .Xr cd 4 ,
267 .Xr ch 4 ,
268 .Xr da 4 ,
269 .Xr pass 4 ,
270 .Xr pt 4 ,
271 .Xr sa 4 ,
272 .Xr xpt 4 ,
273 .Xr camcontrol 8
274 .Sh HISTORY
275 The CAM
276 .Tn SCSI
277 subsystem first appeared in
278 .Fx 3.0 .
279 .Sh AUTHORS
280 .An -nosplit
281 The CAM
282 .Tn SCSI
283 subsystem was written by
284 .An Justin Gibbs
285 and
286 .An Kenneth Merry .