scsi.4 revision 13744
1249423Sdim.Dd August 27, 1993
2224135Sdim.Dt SD 4
3224135Sdim.Os FreeBSD
4224135Sdim.Sh NAME
5224135Sdim.Nm scsi
6224135Sdim.Nd scsi system
7224135Sdim.Sh SYNOPSIS
8224135Sdim.Nm controller scbus0
9224135Sdim.Nm controller scbus1 at ahc0
10224135Sdim.Nm controller scbus3 at ahc1 bus 0
11224135Sdim.Nm controller scbus2 at ahc1 bus 1
12224135Sdim.Nm device cd0
13224135Sdim.Nm device ch0
14224135Sdim.Nm disk sd0
15224135Sdim.Nm tape st0
16224135Sdim.Nm device ch1 at scbus0 target 4 unit 0
17224135Sdim.Sh DESCRIPTION
18224135SdimThe
19224135Sdim.Em scsi
20224135Sdimsystem provides a uniform and modular system for the implementation
21224135Sdimof drivers to control various scsi devices, and to utilize different
22224135Sdimscsi host adapters through host adapter drivers. When the system probes the 
23224135Sdim.Em SCSI
24224135Sdimbusses, it attaches any devices it finds to the appropriate
25224135Sdimdrivers. If no driver seems appropriate, then it attaches the device to the
26224135Sdimuk (unknown) driver so that user level scsi ioctls may
27224135Sdimstill be performed against the device.
28224135Sdim.Sh KERNEL CONFIGURATION
29224135SdimThe option SCSIDEBUG enables the debug ioctl.
30224135Sdim.Pp
31224135SdimAll devices and the SCSI busses support boot time allocation so that
32224135Sdiman upper number of devices and controllers does not need to be configured;
33224135Sdim.Em "device sd0"
34224135Sdimwill suffice for any number of disk drivers.
35224135Sdim.Pp
36224135SdimThe devices are either
37249423Sdim.Em wired
38224135Sdimso they appear as a particular device unit or
39224135Sdim.Em counted
40224135Sdimso that they appear as the next available unused unit.
41224135Sdim.Pp
42224135SdimTo configure a driver in the kernel without wiring down the device use a
43224135Sdimconfig line similar to
44224135Sdim.Em "device ch0"
45224135Sdimto include the changer driver.
46224135Sdim.Pp
47234353SdimTo wire down a unit use a config line similar to
48224135Sdim.Em "device ch1 at scbus0 target 4 unit 0"
49226633Sdimto assign changer 1 as the changer with SCSI ID 4,
50234353SdimSCSI logical unit 0 on SCSI bus 0.
51234353SdimIndividual scbuses can be wired down to specific controllers with
52234353Sdima config line similar to
53234353Sdim.Em "controller scbus0 at ahc0"
54234353Sdimwhich assigns scsi bus 0 to the first unit using the ahc driver.
55234353SdimFor controllers supporting more than one bus,
56234353Sdimthe particular bus can be specified as in
57234353Sdim.Em "controller scbus3 at ahc1 bus 1"
58224135Sdimwhich assigns scbus 1 to the second bus probed on the ahc1 device.
59224135Sdim.Pp
60224135SdimWhen you have a mixture of wired down and counted devices then the
61224135Sdimcounting begins with the first non-wired down unit for a particular
62224135Sdimtype.  That is, if you have a disk wired down as
63224135Sdim.Em "disk sd1" ,
64224135Sdimthen the first non-wired disk shall come on line as
65224135Sdim.Em sd2 .
66224135Sdim.Sh IOCTLS
67226633SdimThere are a number of ioctls that work on any 
68224135Sdim.Em SCSI
69224135Sdimdevice. They are defined in
70234353Sdim.Em sys/scsiio.h
71224135Sdimand can be applied against any scsi device that permits them.
72224135SdimFor the tape, it must be applied against the control
73234353Sdimdevice. See the manual page for each device type for more information about
74234353Sdimhow generic scsi ioctls may be applied to a specific device.
75224135Sdim.Bl -tag -width DIOCSDINFO____
76234353Sdim.It Dv SCIOCRESET*
77234353Sdimreset a device.
78234353Sdim.It Dv SCIOCDEBUG
79234353SdimTurn on debugging.. All scsi operations originating from this device's driver
80234353Sdimwill be traced to the console, along with other information. Debugging is
81234353Sdimcontrolled by four bits, described in the header file. If no debugging is
82234353Sdimconfigured into the kernel, debugging will have no effect. 
83234353Sdim.Em SCSI
84234353Sdimdebugging is controlled by the configuration option
85234353Sdim.Em SCSIDEBUG.
86234353Sdim.It Dv SCIOCCOMMAND
87234353SdimTake a scsi command and data from a user process and apply them to the scsi
88234353Sdimdevice. Return all status information and return data to the process. The 
89234353Sdimioctl will return a successful status even if the device rejected the
90234353Sdimcommand. As all status is returned to the user, it is up to the user
91234353Sdimprocess to examine this information to decide the success of the command.
92224135Sdim.It Dv SCIOCREPROBE
93226633SdimAsk the system to probe the scsi busses for any new devices. If it finds
94224135Sdimany, they will be attached to the appropriate drivers. The search can be
95224135Sdimnarrowed to a specific bus, target or lun. The new device may or may not
96224135Sdimbe related to the device on which the ioctl was performed.
97224135Sdim.It Dv SCIOCIDENTIFY
98234353SdimAsk the driver what it's bus, target and lun are.
99224135Sdim.It Dv SCIOCDECONFIG
100224135SdimAsk the device to disappear. This may not happen if the device is in use.
101224135Sdim.El
102224135Sdim.Sh NOTES
103224135Sdimthe generic scsi part of the system is still being mapped out.
104224135SdimWatch this space for changes.
105224135Sdim.Pp
106224135Sdim A device by the name of su (scsi_user)
107224135Sdim(e.g  su0-0-0) will map bus, target and lun to  minor numbers. I have not
108224135Sdimyet decided yet whether this device will be able to open a device that is
109224135Sdimalready controlled by an explicit driver.
110224135Sdim.Sh ADAPTERS
111224135SdimThe system allows common device drivers to work through many different
112224135Sdimtypes of adapters. The adapters take requests from the upper layers and do
113224135Sdimall IO between the 
114224135Sdim.Em SCSI
115224135Sdimbus and the system. The maximum size of a transfer is governed by the
116224135Sdimadapter. Most adapters can transfer 64KB in a single operation, however
117224135Sdimmany can transfer larger amounts.
118224135Sdim.Sh TARGET MODE
119224135SdimSome adapters support 
120224135Sdim.Em Target mode
121224135Sdimin which the system is capable of operating as a device, responding to
122224135Sdimoperations initiated by another system. Target mode will be supported for
123224135Sdimsome adapters, but is not yet complete for this version of the scsi system.
124224135Sdim.Sh FILES
125224135Sdimsee other scsi device entries.
126224135Sdim.Sh DIAGNOSTICS
127224135SdimWhen the kernel is compiled with option SCSIDEBUG, the SCIOCDEBUG ioctl 
128224135Sdimcan be used to enable various amounts of tracing information on any 
129224135Sdimspecific device. Devices not being traced will not produce trace information.
130224135SdimThe four bits that make up the debug level, each control certain types
131224135Sdimof debugging information. 
132224135Sdim.Bl -tag -width THIS_WIDE_PLEASE
133234353Sdim.It Dv Bit 0
134224135SdimBit 0  shows all scsi bus operations including scsi commands,
135234353Sdimerror information and the first 48 bytes of any data transferred.
136224135Sdim.It Dv Bit 1
137224135SdimBit 1 shows routines called.
138224135Sdim.It Dv Bit 2
139224135SdimBit 2 shows information about what branches are taken and often some
140224135Sdimof the return values of functions.
141234353Sdim.It Dv Bit 3
142234353SdimBit 3 shows more detailed information including DMA scatter-gather logs.
143234353Sdim.El
144249423Sdim.Sh SEE ALSO
145249423Sdim.Xr ch 4
146249423Sdim.Xr cd 4
147249423Sdim.Xr sd 4
148249423Sdim.Xr st 4
149249423Sdim.Xr uk 4
150234353Sdim.Xr su 4
151234353Sdim.Xr aha 4
152234353Sdim.Xr ahb 4
153234353Sdim.Xr bt 4
154234353Sdim.Xr uha 4
155234353Sdim.Sh HISTORY
156234353SdimThis
157234353Sdim.Nm
158224135Sdimsystem appeared in MACH 2.5 at TRW.
159224135Sdim
160224135Sdim