xref: /netbsd-src/share/man/man4/scsi.4 (revision ccb8bdcbd40c2e777b48a7174aa7b96876f143d5)
1.\"	$NetBSD: scsi.4,v 1.32 2019/08/18 11:53:23 maya 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 August 18, 2019
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.
111Currently, only
112.Xr sd 4 ,
113.Xr cd 4 ,
114.Xr st 4 ,
115and
116.Xr uk 4
117can attach to an atapi bus.
118.Pp
119Please see the
120.Xr intro 4
121manual page to see which
122.Tn SCSI
123bus host adaptors are supported by
124.Nx
125on your computer system.
126.Sh KERNEL CONFIGURATION
127The
128.Nm
129software supports some
130.Nx
131kernel
132.Xr config 1
133options.
134They are:
135.Bl -tag -width SCSIVERBOSE
136.It Dv SCSIDEBUG
137Compile in a wide variety of
138.Fn printf
139statements that can be turned on by
140.Xr ioctl 2 .
141.It Dv SCSIVERBOSE
142Enable additional and more descriptive error and status messages
143from the
144.Nm
145software.
146.El
147.Pp
148All devices and the
149.Tn SCSI
150busses support boot time allocation so that an upper number of
151devices and controllers does not need to be configured.
152.Pp
153The devices are either
154.Em wired
155so they appear at a particular device unit number or
156.Em counted
157so that they appear as the next available unused unit number.
158.Pp
159To configure a driver in the kernel without wiring down the device use a
160config line similar to
161.Pp
162.Cd "ch* at scsibus? target ? lun ?"
163.Pp
164to include the
165.Xr ch 4
166changer driver.
167.Pp
168To wire down a unit use a config line similar to
169.Pp
170.Cd "ch1 at scsibus0 target 4 lun 0"
171.Pp
172to assign changer 1 as the changer with
173.Tn SCSI
174ID 4, logical unit 0, on bus 0.
175Individual
176.Tn SCSI
177busses can be wired down to specific controllers with a config line
178similar to
179.Pp
180.Cd "scsibus0 at ahc0"
181.Pp
182which assigns
183.Tn SCSI
184bus 0 to the first unit using the
185.Xr ahc 4
186driver.
187.Pp
188When you have a mixture of wired down and counted devices then the counting
189begins with the first non-wired down unit for a particular type.
190That is, if you have a disk wired down as
191.Pp
192.Cd "sd1 at scsibus0 target 1 lun 0"
193.Pp
194then the first non-wired disk shall come on line as
195.Em sd2 .
196.Sh IOCTLS
197There are a number of
198.Xr ioctl 2
199calls that work on any
200.Tn SCSI
201device.
202They are defined in
203.Pa sys/scsiio.h
204and can be applied against any
205.Tn SCSI
206device that permits them.
207For the tape, it must be applied against the control device.
208See the manual page for each device type for more information about
209how generic
210.Tn SCSI
211.Xr ioctl 2
212calls may be applied to a specific device.
213.Bl -tag -width DIOCSDINFO____
214.It Dv SCIOCRESET
215Reset a
216.Tn SCSI
217device.
218.It Dv SCIOCDEBUG
219Turn on debugging.
220All
221.Tn SCSI
222operations originating from this device's driver
223will be traced to the console, along with other information.
224Debugging is controlled by four bits, described in the header file.
225If no debugging is configured into the kernel, debugging will have
226no effect.
227.Tn SCSI
228debugging is controlled by the configuration option
229.Dv SCSIDEBUG .
230.It Dv SCIOCCOMMAND
231Take a
232.Tn SCSI
233command and data from a user process and apply them to the
234.Tn SCSI
235device.
236Return all status information and return data to the process.
237The
238.Xr ioctl 2
239call will return a successful status even if the device rejected the command.
240As all status is returned to the user, it is up to the user
241process to examine this information to decide the success of the command.
242.It Dv SCIOCIDENTIFY
243Ask the driver what its bus, target and LUN are.
244.It Dv SCIOCDECONFIG
245Ask the device to disappear.
246This may not happen if the device is in use.
247.El
248.Sh ADAPTERS
249The system allows common device drivers to work through many different
250types of adapters.
251The adapters take requests from the upper layers and do all IO between the
252.Tn SCSI
253bus and the system.
254The maximum size of a transfer is governed by the adapter.
255Most adapters can transfer 64KB in a single operation, however
256many can transfer larger amounts.
257.Sh TARGET MODE
258Some adapters support
259.Em Target Mode
260in which the system is capable of operating as a device, responding to
261operations initiated by another system.
262Target Mode will be supported for
263some host adapters, but is not yet complete for this version of the
264.Tn SCSI
265system.
266.Sh DIAGNOSTICS
267When the kernel is compiled with option
268.Dv SCSIDEBUG ,
269the
270.Dv SCIOCDEBUG
271.Xr ioctl 2
272can be used to enable various amounts of tracing information on any
273specific device.
274Devices not being traced will not produce trace information.
275The four bits that make up the debug level, each control certain types
276of debugging information.
277.Bl -tag -width "Bit 0"
278.It Dv Bit 0
279shows all
280.Tn SCSI
281bus operations including
282.Tn SCSI
283commands,
284error information and the first 48 bytes of any data transferred.
285.It Dv Bit 1
286shows routines called.
287.It Dv Bit 2
288shows information about what branches are taken and often some
289of the return values of functions.
290.It Dv Bit 3
291shows more detailed information including
292.Tn DMA
293scatter-gather logs.
294.El
295.Sh SEE ALSO
296.Xr config 1 ,
297.Xr ioctl 2 ,
298.Xr ata 4 ,
299.Xr cd 4 ,
300.Xr ch 4 ,
301.Xr intro 4 ,
302.Xr sd 4 ,
303.Xr se 4 ,
304.Xr ss 4 ,
305.Xr st 4 ,
306.Xr uk 4 ,
307.Xr scsictl 8
308.Sh HISTORY
309This
310.Nm
311system appeared in MACH 2.5 at TRW.
312.Pp
313This man page was originally written by Julian Elischer
314.Aq julian@freebsd.org
315for
316.Fx
317and extensively modified by
318.An Erik Fair
319.Aq fair@NetBSD.org
320for
321.Nx .
322.Sh BUGS
323Not every device obeys the
324.Tn SCSI
325specification as faithfully as it should.
326As such devices are discovered by the
327.Nx
328Project, their names are added to a
329.Em quirk list
330compiled into the
331.Nm
332driver along a list of flags indicating which particular bad behaviors the
333device exhibits (and that the driver should be prepared to work around).
334