xref: /openbsd/share/man/man4/scsi.4 (revision e5dd7070)
1.\"	$OpenBSD: scsi.4,v 1.39 2015/11/21 17:43:33 jmc Exp $
2.\"
3.\" Copyright (c) 1996
4.\"	Julian Elischer <julian@freebsd.org>.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\"
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd $Mdocdate: November 21 2015 $
29.Dt SCSI 4
30.Os
31.Sh NAME
32.Nm scsi ,
33.Nm scsibus
34.Nd SCSI system
35.Sh SYNOPSIS
36.Cd "cd* at scsibus?"
37.Cd "ch* at scsibus?"
38.Cd "safte* at scsibus?"
39.Cd "sd* at scsibus?"
40.Cd "ses* at scsibus?"
41.Cd "st* at scsibus?"
42.Cd "uk* at scsibus?"
43.Pp
44.Cd "# multipath support"
45.Cd "emc* at scsibus?"
46.Cd "hds* at scsibus?"
47.Cd "rdac* at scsibus?"
48.Cd "sym* at scsibus?"
49.Sh DESCRIPTION
50The
51.Em SCSI
52system provides a uniform and modular system for the implementation
53of drivers to control various SCSI devices, and to utilize different
54SCSI host adapters through host adapter drivers.
55When the system probes the
56.Em SCSI
57buses, it attaches any devices it finds to the appropriate
58drivers.
59If no driver seems appropriate, then it attaches the device to the
60uk (unknown) driver so that user level SCSI ioctls may
61still be performed against the device.
62.Sh KERNEL CONFIGURATION
63The option SCSIDEBUG enables the debug ioctl.
64.Pp
65All devices and the SCSI buses support boot time allocation so that
66an upper number of devices and controllers does not need to be configured;
67.Cd "sd* at scsibus?"
68will suffice for any number of disk drivers.
69.Pp
70The devices are either
71.Em wired
72so they appear as a particular device unit or
73.Em counted
74so that they appear as the next available unused unit.
75.Pp
76To configure a driver in the kernel without wiring down the device use a
77config line similar to
78.Cd "ch* at scsibus?"
79to include the changer driver.
80.Pp
81To wire down a unit use a config line similar to
82.Cd "ch1 at scsibus0 target 4 lun 0"
83to assign changer 1 as the changer with SCSI ID 4,
84SCSI logical unit 0 on SCSI bus 0.
85Individual scsibuses can be wired down to specific controllers with
86a config line similar to
87.Cd "scsibus0 at ahc0"
88which assigns SCSI bus 0 to the first unit using the ahc driver.
89For controllers supporting more than one bus,
90the particular bus can be specified as in
91.Cd "scsibus3 at ahc1 bus 1"
92which assigns scsibus 1 to the second bus probed on the ahc1 device.
93.Pp
94When there is a mixture of wired down and counted devices then the
95counting begins with the first non-wired down unit for a particular
96type.
97That is, if a disk is wired down as
98.Cd "sd1 at scsibus?" ,
99then the first non-wired disk shall come on line as
100.Em sd2 .
101.Sh IOCTLS
102There are a number of ioctls that work on any
103.Em SCSI
104device.
105They are defined in
106.In sys/scsiio.h
107and can be applied against any SCSI device that permits them.
108For the tape, it must be applied against the control
109device.
110See the manual page for each device type for more information about
111how generic SCSI ioctls may be applied to a specific device.
112.Bl -tag -width DIOCSDINFO____
113.It Dv SCIOCRESET
114Reset a device.
115.It Dv SCIOCDEBUG Fa "int *"
116Turn on debugging.
117All SCSI operations originating from this device's driver
118will be traced to the console, along with other information.
119Debugging is controlled by four bits, described in the header file.
120If no debugging is configured into the kernel, debugging will have
121no effect.
122.Em SCSI
123debugging is controlled by the configuration option
124.Em SCSIDEBUG .
125.It Dv SCIOCCOMMAND Fa "scsireq_t *"
126Take a SCSI command and data from a user process and apply them to the SCSI
127device.
128Return all status information and return data to the process.
129The ioctl will return a successful status even if the device rejected the
130command.
131As all status is returned to the user, it is up to the user
132process to examine this information to decide the success of the command.
133.It Dv SCIOCIDENTIFY Fa "struct scsi_addr *"
134Ask the driver what its bus, target and lun are.
135In addition, the device type, ATAPI or SCSI, is returned.
136.El
137.Sh ADAPTERS
138The system allows common device drivers to work through many different
139types of adapters.
140The adapters take requests from the upper layers and do all I/O between the
141.Em SCSI
142bus and the system.
143The maximum size of a transfer is governed by the adapter.
144Most adapters can transfer 64KB in a single operation, and many can transfer
145larger amounts.
146.Sh DIAGNOSTICS
147When the kernel is compiled with option SCSIDEBUG, the SCIOCDEBUG ioctl
148can be used to enable various amounts of tracing information on any
149specific device.
150Devices not being traced will not produce trace information.
151The four bits that make up the debug level each control certain types
152of debugging information.
153.Bl -tag -width "Bit 0"
154.It Dv Bit 0
155shows all SCSI bus operations including SCSI commands,
156error information and the first 48 bytes of any data transferred.
157.It Dv Bit 1
158shows routines called.
159.It Dv Bit 2
160shows information about what branches are taken and often some
161of the return values of functions.
162.It Dv Bit 3
163shows more detailed information including DMA scatter-gather logs.
164.El
165.Sh SEE ALSO
166.Xr cd 4 ,
167.Xr ch 4 ,
168.Xr emc 4 ,
169.Xr hds 4 ,
170.Xr intro 4 ,
171.Xr mpath 4 ,
172.Xr rdac 4 ,
173.Xr safte 4 ,
174.Xr sd 4 ,
175.Xr ses 4 ,
176.Xr st 4 ,
177.Xr sym 4 ,
178.Xr uk 4 ,
179.Xr scsi 8
180.Sh HISTORY
181This
182.Nm
183system appeared in MACH 2.5 at TRW.
184