1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
<table class="head">
<tr>
<td class="head-ltitle">SCSI(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">SCSI(4)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">scsi</code>, <code class="Nm">scsibus</code>
— <span class="Nd">Small Computer Systems Interface (SCSI) bus
driver</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="Cd">scsibus* at scsi?</code>
<br/>
<code class="Cd">atapibus* at atapi?</code>
<br/>
<code class="Cd">options SCSIDEBUG</code>
<br/>
<code class="Cd">options SCSIVERBOSE</code></p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <code class="Nm">scsi</code> driver is the top,
machine-independent layer of the two-layer software system that provides an
interface for the implementation of drivers to control various SCSI or ATAPI
bus devices, and to use different SCSI bus host adapters or EIDE
controllers. SCSI bus is capable of supporting a wide variety of
peripherals, including hard disks, removable disks, CD-ROMs, scanners, tape
drives, and other miscellaneous high-speed devices.</p>
<p class="Pp">The bottom layer is composed of the drivers for individual EIDE or
SCSI bus controller chips (e.g. NCR 5380), accessed through various host bus
interfaces, including, but not limited to PCI, ISA, Sbus, TURBOchannel, and
NuBus. These individual devices are referred to as "host adaptors"
in SCSI terminology, because they connect the SCSI bus to the host
computer.</p>
<p class="Pp">When <span class="Ux">NetBSD</span> probes the SCSI busses, it
"attaches" any devices it finds to the appropriate drivers.</p>
<p class="Pp"></p>
<dl class="Bl-tag Bl-compact">
<dt><a class="Xr">sd(4)</a></dt>
<dd>hard disks</dd>
<dt><a class="Xr">cd(4)</a></dt>
<dd>CD-ROM drives</dd>
<dt><a class="Xr">st(4)</a></dt>
<dd>tape drives</dd>
<dt><a class="Xr">ch(4)</a></dt>
<dd>media changers</dd>
<dt><a class="Xr">ss(4)</a></dt>
<dd>scanners</dd>
</dl>
<p class="Pp">If no specific driver matches the device, then
<code class="Nm">scsi</code> attaches the device to the
<a class="Xr">uk(4)</a> driver so that user level SCSI
<a class="Xr">ioctl(2)</a> calls may still be performed against the device.
Currently, only <a class="Xr">sd(4)</a>, <a class="Xr">cd(4)</a>,
<a class="Xr">st(4)</a>, and <a class="Xr">uk(4)</a> can attach to an atapi
bus.</p>
<p class="Pp">Please see the <a class="Xr">intro(4)</a> manual page to see which
SCSI bus host adaptors are supported by <span class="Ux">NetBSD</span> on
your computer system.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="KERNEL_CONFIGURATION"><a class="permalink" href="#KERNEL_CONFIGURATION">KERNEL
CONFIGURATION</a></h1>
<p class="Pp">The <code class="Nm">scsi</code> software supports some
<span class="Ux">NetBSD</span> kernel <a class="Xr">config(1)</a> options.
They are:</p>
<dl class="Bl-tag">
<dt id="SCSIDEBUG"><a class="permalink" href="#SCSIDEBUG"><code class="Dv">SCSIDEBUG</code></a></dt>
<dd>Compile in a wide variety of
<a class="permalink" href="#printf"><code class="Fn" id="printf">printf</code></a>()
statements that can be turned on by <a class="Xr">ioctl(2)</a>.</dd>
<dt id="SCSIVERBOSE"><a class="permalink" href="#SCSIVERBOSE"><code class="Dv">SCSIVERBOSE</code></a></dt>
<dd>Enable additional and more descriptive error and status messages from the
<code class="Nm">scsi</code> software.</dd>
</dl>
<p class="Pp">All devices and the SCSI busses support boot time allocation so
that an upper number of devices and controllers does not need to be
configured.</p>
<p class="Pp" id="wired">The devices are either
<a class="permalink" href="#wired"><i class="Em">wired</i></a> so they
appear at a particular device unit number or
<a class="permalink" href="#counted"><i class="Em" id="counted">counted</i></a>
so that they appear as the next available unused unit number.</p>
<p class="Pp">To configure a driver in the kernel without wiring down the device
use a config line similar to</p>
<p class="Pp"><code class="Cd">ch* at scsibus? target ? lun ?</code></p>
<p class="Pp">to include the <a class="Xr">ch(4)</a> changer driver.</p>
<p class="Pp">To wire down a unit use a config line similar to</p>
<p class="Pp"><code class="Cd">ch1 at scsibus0 target 4 lun 0</code></p>
<p class="Pp">to assign changer 1 as the changer with SCSI ID 4, logical unit 0,
on bus 0. Individual SCSI busses can be wired down to specific controllers
with a config line similar to</p>
<p class="Pp"><code class="Cd">scsibus0 at ahc0</code></p>
<p class="Pp">which assigns SCSI bus 0 to the first unit using the
<a class="Xr">ahc(4)</a> driver.</p>
<p class="Pp">When you have a mixture of wired down and counted devices then the
counting begins with the first non-wired down unit for a particular type.
That is, if you have a disk wired down as</p>
<p class="Pp"><code class="Cd">sd1 at scsibus0 target 1 lun 0</code></p>
<p class="Pp" id="sd2">then the first non-wired disk shall come on line as
<a class="permalink" href="#sd2"><i class="Em">sd2</i></a>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="IOCTLS"><a class="permalink" href="#IOCTLS">IOCTLS</a></h1>
<p class="Pp">There are a number of <a class="Xr">ioctl(2)</a> calls that work
on any SCSI device. They are defined in <span class="Pa">sys/scsiio.h</span>
and can be applied against any SCSI device that permits them. For the tape,
it must be applied against the control device. See the manual page for each
device type for more information about how generic SCSI
<a class="Xr">ioctl(2)</a> calls may be applied to a specific device.</p>
<dl class="Bl-tag">
<dt id="SCIOCRESET"><a class="permalink" href="#SCIOCRESET"><code class="Dv">SCIOCRESET</code></a></dt>
<dd>Reset a SCSI device.</dd>
<dt id="SCIOCDEBUG"><a class="permalink" href="#SCIOCDEBUG"><code class="Dv">SCIOCDEBUG</code></a></dt>
<dd>Turn on debugging. All SCSI operations originating from this device's
driver will be traced to the console, along with other information.
Debugging is controlled by four bits, described in the header file. If no
debugging is configured into the kernel, debugging will have no effect.
SCSI debugging is controlled by the configuration option
<code class="Dv">SCSIDEBUG</code>.</dd>
<dt id="SCIOCCOMMAND"><a class="permalink" href="#SCIOCCOMMAND"><code class="Dv">SCIOCCOMMAND</code></a></dt>
<dd>Take a SCSI command and data from a user process and apply them to the
SCSI device. Return all status information and return data to the process.
The <a class="Xr">ioctl(2)</a> call will return a successful status even
if the device rejected the command. As all status is returned to the user,
it is up to the user process to examine this information to decide the
success of the command.</dd>
<dt id="SCIOCIDENTIFY"><a class="permalink" href="#SCIOCIDENTIFY"><code class="Dv">SCIOCIDENTIFY</code></a></dt>
<dd>Ask the driver what its bus, target and LUN are.</dd>
<dt id="SCIOCDECONFIG"><a class="permalink" href="#SCIOCDECONFIG"><code class="Dv">SCIOCDECONFIG</code></a></dt>
<dd>Ask the device to disappear. This may not happen if the device is in
use.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="ADAPTERS"><a class="permalink" href="#ADAPTERS">ADAPTERS</a></h1>
<p class="Pp">The system allows common device drivers to work through many
different types of adapters. The adapters take requests from the upper
layers and do all IO between the SCSI bus and the system. The maximum size
of a transfer is governed by the adapter. Most adapters can transfer 64KB in
a single operation, however many can transfer larger amounts.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="TARGET_MODE"><a class="permalink" href="#TARGET_MODE">TARGET
MODE</a></h1>
<p class="Pp">Some adapters support
<a class="permalink" href="#Target"><i class="Em" id="Target">Target
Mode</i></a> in which the system is capable of operating as a device,
responding to operations initiated by another system. Target Mode will be
supported for some host adapters, but is not yet complete for this version
of the SCSI system.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DIAGNOSTICS"><a class="permalink" href="#DIAGNOSTICS">DIAGNOSTICS</a></h1>
<p class="Pp">When the kernel is compiled with option
<code class="Dv">SCSIDEBUG</code>, the <code class="Dv">SCIOCDEBUG</code>
<a class="Xr">ioctl(2)</a> can be used to enable various amounts of tracing
information on any specific device. Devices not being traced will not
produce trace information. The four bits that make up the debug level, each
control certain types of debugging information.</p>
<dl class="Bl-tag">
<dt id="Bit"><a class="permalink" href="#Bit"><code class="Dv">Bit
0</code></a></dt>
<dd>shows all SCSI bus operations including SCSI commands, error information
and the first 48 bytes of any data transferred.</dd>
<dt id="Bit~2"><a class="permalink" href="#Bit~2"><code class="Dv">Bit
1</code></a></dt>
<dd>shows routines called.</dd>
<dt id="Bit~3"><a class="permalink" href="#Bit~3"><code class="Dv">Bit
2</code></a></dt>
<dd>shows information about what branches are taken and often some of the
return values of functions.</dd>
<dt id="Bit~4"><a class="permalink" href="#Bit~4"><code class="Dv">Bit
3</code></a></dt>
<dd>shows more detailed information including DMA scatter-gather logs.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">config(1)</a>, <a class="Xr">ioctl(2)</a>,
<a class="Xr">ata(4)</a>, <a class="Xr">cd(4)</a>, <a class="Xr">ch(4)</a>,
<a class="Xr">intro(4)</a>, <a class="Xr">sd(4)</a>,
<a class="Xr">se(4)</a>, <a class="Xr">ss(4)</a>, <a class="Xr">st(4)</a>,
<a class="Xr">uk(4)</a>, <a class="Xr">scsictl(8)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">This <code class="Nm">scsi</code> system appeared in MACH 2.5 at
TRW.</p>
<p class="Pp">This man page was originally written by Julian Elischer
⟨julian@freebsd.org⟩ for <span class="Ux">FreeBSD</span> and
extensively modified by <span class="An">Erik Fair</span>
⟨fair@NetBSD.org⟩ for <span class="Ux">NetBSD</span>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="BUGS"><a class="permalink" href="#BUGS">BUGS</a></h1>
<p class="Pp">Not every device obeys the SCSI specification as faithfully as it
should. As such devices are discovered by the <span class="Ux">NetBSD</span>
Project, their names are added to a
<a class="permalink" href="#quirk"><i class="Em" id="quirk">quirk
list</i></a> compiled into the <code class="Nm">scsi</code> driver along a
list of flags indicating which particular bad behaviors the device exhibits
(and that the driver should be prepared to work around).</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">August 18, 2019</td>
<td class="foot-os">NetBSD 10.1</td>
</tr>
</table>
|