xref: /netbsd-src/share/man/man4/scsi.4 (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1.\"	$NetBSD: scsi.4,v 1.29 2008/04/13 04:03:23 dholland Exp $
2.\" Copyright (c) 1996
3.\"	Julian Elischer <julian@freebsd.org>.  All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\"
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd July 26, 2006
28.Dt SCSI 4
29.Os
30.Sh NAME
31.Nm scsi ,
32.Nm scsibus
33.Nd Small Computer Systems Interface (SCSI) bus driver
34.Sh SYNOPSIS
35.Cd "scsibus* at scsi?"
36.Cd "atapibus* at atapi?"
37.Cd options SCSIDEBUG
38.Cd options SCSIVERBOSE
39.Sh DESCRIPTION
40The
41.Nm
42driver is the top, machine-independent layer of the two-layer
43software system that provides an interface for the
44implementation of drivers to control various
45.Tn SCSI
46or
47.Tn ATAPI
48bus devices, and to use different
49.Tn SCSI
50bus host adapters or
51.Tn EIDE
52controllers.
53.Tn SCSI
54bus is capable of supporting a wide variety of peripherals, including
55hard disks, removable disks,
56.Tn CD-ROMs ,
57scanners, tape drives, and other miscellaneous high-speed devices.
58.Pp
59The bottom layer is composed of the drivers for individual
60.Tn EIDE
61or
62.Tn SCSI
63bus controller chips (e.g. NCR 5380), accessed through various host bus
64interfaces, including, but not limited to
65.Tn PCI ,
66.Tn ISA ,
67.Tn Sbus ,
68.Tn TURBOchannel ,
69and
70.Tn NuBus .
71These individual devices are referred to as
72.Qq host adaptors
73in
74.Tn SCSI
75terminology,
76because they connect the
77.Tn SCSI
78bus to the host computer.
79.Pp
80When
81.Nx
82probes the
83.Tn SCSI
84busses, it
85.Qq attaches
86any devices it finds to the appropriate drivers.
87.Pp
88.Bl -tag -compact -width "sd(4)"
89.It Xr sd 4
90hard disks
91.It Xr cd 4
92.Tn CD-ROM
93drives
94.It Xr st 4
95tape drives
96.It Xr ch 4
97media changers
98.It Xr ss 4
99scanners
100.El
101.Pp
102If no specific driver matches the device,
103then
104.Nm
105attaches the device to the
106.Xr uk 4
107driver so that user level
108.Tn SCSI
109.Xr ioctl 2
110calls may still be performed against the device. Currently, only
111.Xr sd 4 ,
112.Xr cd 4 ,
113.Xr st 4
114and
115.Xr uk 4
116can attach to an atapi bus.
117.Pp
118Please see the
119.Xr intro 4
120manual page to see which
121.Tn SCSI
122bus host adaptors are supported by
123.Nx
124on your computer system.
125.Sh KERNEL CONFIGURATION
126The
127.Nm
128software supports some
129.Nx
130kernel
131.Xr config 1
132options.
133They are:
134.Bl -tag -width SCSIVERBOSE
135.It Dv SCSIDEBUG
136Compile in a wide variety of
137.Fn printf
138statements that can be turned on by
139.Xr ioctl 2 .
140.It Dv SCSIVERBOSE
141Enable additional and more descriptive error and status messages
142from the
143.Nm
144software.
145.El
146.Pp
147All devices and the
148.Tn SCSI
149busses support boot time allocation so that an upper number of
150devices and controllers does not need to be configured.
151.Pp
152The devices are either
153.Em wired
154so they appear at a particular device unit number or
155.Em counted
156so that they appear as the next available unused unit number.
157.Pp
158To configure a driver in the kernel without wiring down the device use a
159config line similar to
160.Pp
161.Cd "ch* at scsibus? target ? lun ?"
162.Pp
163to include the
164.Xr ch 4
165changer driver.
166.Pp
167To wire down a unit use a config line similar to
168.Pp
169.Cd "ch1 at scsibus0 target 4 lun 0"
170.Pp
171to assign changer 1 as the changer with
172.Tn SCSI
173ID 4, logical unit 0, on bus 0.
174Individual
175.Tn SCSI
176busses can be wired down to specific controllers with a config line
177similar to
178.Pp
179.Cd "scsibus0 at ahc0"
180.Pp
181which assigns
182.Tn SCSI
183bus 0 to the first unit using the
184.Xr ahc 4
185driver.
186.Pp
187When you have a mixture of wired down and counted devices then the counting
188begins with the first non-wired down unit for a particular type.
189That is, if you have a disk wired down as
190.Pp
191.Cd "sd1 at scsibus0 target 1 lun 0"
192.Pp
193then the first non-wired disk shall come on line as
194.Em sd2 .
195.Sh IOCTLS
196There are a number of
197.Xr ioctl 2
198calls that work on any
199.Tn SCSI
200device.
201They are defined in
202.Pa sys/scsiio.h
203and can be applied against any
204.Tn SCSI
205device that permits them.
206For the tape, it must be applied against the control device.
207See the manual page for each device type for more information about
208how generic
209.Tn SCSI
210.Xr ioctl 2
211calls may be applied to a specific device.
212.Bl -tag -width DIOCSDINFO____
213.It Dv SCIOCRESET
214Reset a
215.Tn SCSI
216device.
217.It Dv SCIOCDEBUG
218Turn on debugging.
219All
220.Tn SCSI
221operations originating from this device's driver
222will be traced to the console, along with other information.
223Debugging is controlled by four bits, described in the header file.
224If no debugging is configured into the kernel, debugging will have
225no effect.
226.Tn SCSI
227debugging is controlled by the configuration option
228.Dv SCSIDEBUG .
229.It Dv SCIOCCOMMAND
230Take a
231.Tn SCSI
232command and data from a user process and apply them to the
233.Tn SCSI
234device.
235Return all status information and return data to the process.
236The
237.Xr ioctl 2
238call will return a successful status even if the device rejected the command.
239As all status is returned to the user, it is up to the user
240process to examine this information to decide the success of the command.
241.It Dv SCIOCREPROBE
242Ask the system to probe the
243.Tn SCSI
244busses for any new devices.
245If it finds any, they will be attached to the appropriate drivers.
246The search can be narrowed to a specific bus, target or Logical
247Unit Number (LUN).
248The new device may or may not be related to the device on which
249the ioctl was performed.
250.It Dv SCIOCIDENTIFY
251Ask the driver what its bus, target and LUN are.
252.It Dv SCIOCDECONFIG
253Ask the device to disappear.
254This may not happen if the device is in use.
255.El
256.Sh ADAPTERS
257The system allows common device drivers to work through many different
258types of adapters.
259The adapters take requests from the upper layers and do all IO between the
260.Tn SCSI
261bus and the system.
262The maximum size of a transfer is governed by the adapter.
263Most adapters can transfer 64KB in a single operation, however
264many can transfer larger amounts.
265.Sh TARGET MODE
266Some adapters support
267.Em Target Mode
268in which the system is capable of operating as a device, responding to
269operations initiated by another system.
270Target Mode will be supported for
271some host adapters, but is not yet complete for this version of the
272.Tn SCSI
273system.
274.Sh DIAGNOSTICS
275When the kernel is compiled with option
276.Dv SCSIDEBUG ,
277the
278.Dv SCIOCDEBUG
279.Xr ioctl 2
280can be used to enable various amounts of tracing information on any
281specific device.
282Devices not being traced will not produce trace information.
283The four bits that make up the debug level, each control certain types
284of debugging information.
285.Bl -tag -width "Bit 0"
286.It Dv Bit 0
287shows all
288.Tn SCSI
289bus operations including
290.Tn SCSI
291commands,
292error information and the first 48 bytes of any data transferred.
293.It Dv Bit 1
294shows routines called.
295.It Dv Bit 2
296shows information about what branches are taken and often some
297of the return values of functions.
298.It Dv Bit 3
299shows more detailed information including
300.Tn DMA
301scatter-gather logs.
302.El
303.Sh SEE ALSO
304.Xr config 1 ,
305.Xr ioctl 2 ,
306.Xr ata 4 ,
307.Xr cd 4 ,
308.Xr ch 4 ,
309.Xr intro 4 ,
310.Xr sd 4 ,
311.Xr se 4 ,
312.Xr ss 4 ,
313.Xr st 4 ,
314.Xr uk 4
315.Sh HISTORY
316This
317.Nm
318system appeared in MACH 2.5 at TRW.
319.Pp
320This man page was originally written by Julian Elischer
321.Aq julian@freebsd.org
322for
323.Fx
324and extensively modified by
325.An Erik Fair
326.Aq fair@NetBSD.org
327for
328.Nx .
329.Sh BUGS
330Not every device obeys the
331.Tn SCSI
332specification as faithfully as it should.
333As such devices are discovered by the
334.Nx
335Project, their names are added to a
336.Em quirk list
337compiled into the
338.Nm
339driver along a list of flags indicating which particular bad behaviors the
340device exhibits (and that the driver should be prepared to work around).
341