scsi.4 revision 9571
1.Dd August 27, 1993
2.Dt SD 4
3.Os FreeBSD
4.Sh NAME
5.Nm scsi
6.Nd scsi system
7.Sh SYNOPSIS
8.Nm controller scbus0
9.Nm controller scbus1 at ahc0
10.Nm controller scbus3 at ahc1 bus 0
11.Nm controller scbus2 at ahc1 bus 1
12.Nm device cd0
13.Nm device ch0
14.Nm disk sd0
15.Nm tape st0
16.Nm device ch1 at scbus0 target 4 unit 0
17.Sh DESCRIPTION
18The
19.Em scsi
20system provides a uniform and modular system for the implementation
21of drivers to control various scsi devices, and to utilise different
22scsi host adapters through host adapter drivers. When the system probes the 
23.Em SCSI
24busses, it attaches any devices it finds to the appropriate
25drivers. If no driver seems appropriate, then it attaches the device to the
26uk (unknown) driver so that user level scsi ioctls may
27still be performed against the device.
28.Sh KERNEL CONFIGURATION
29The option SCSIDEBUG enables the debug ioctl.
30.Pp
31All devices and the SCSI busses support boot time allocation so that
32an upper number of devices and controllers does not need to be configured;
33.Em "device sd0"
34will suffice for any number of disk drivers.
35.Pp
36The devices are either
37.Em wired
38so they appear as a particular device unit or
39.Em counted
40so that they appear as the next available unused unit.
41.Pp
42To configure a driver in the kernel without wiring down the device use a
43config line similar to
44.Em "device ch0"
45to include the changer driver.
46.Pp
47To wire down a unit use a config line similar to
48.Em "device ch1 at scbus0 target 4 unit 0"
49to assign changer 1 as the changer with SCSI ID 4,
50SCSI logical unit 0 on SCSI bus 0.
51Individual scbuses can be wired down to specific controllers with
52a config line similar to
53.Em "controller scbus0 at ahc0"
54which assigns scsi bus 0 to the first unit using the ahc driver.
55For controllers supporting more than one bus,
56the particualar bus can be specified as in
57.Em "controller scbus3 at ahc1 bus 1"
58which assigns scbus 1 to the second bus probled on the ahc1 device.
59.Pp
60When you have a mixture of wired down and counted devices then the
61counting begins with the first non-wired down unit for a particular
62type.  That is, if you have a disk wired down as
63.Em "disk sd1" ,
64then the first non-wired disk shall come on line as
65.Em sd2 .
66.Sh IOCTLS
67There are a number of ioctls that work on any 
68.Em SCSI
69device. They are defined in
70.Em sys/scsiio.h
71and can be applied against any scsi device that permits them.
72For the tape, it must be applied against the control
73device. See the manual page for each device type for more information about
74how generic scsi ioctls may be applied to a specific device.
75.Bl -tag -width DIOCSDINFO____
76.It Dv SCIOCRESET*
77reset a device.
78.It Dv SCIOCDEBUG
79Turn on debugging.. All scsi operations originating from this device's driver
80will be traced to the console, along with other information. Debugging is
81controlled by four bits, described in the header file. If no debugging is
82configured into the kernel, debugging will have no effect. 
83.Em SCSI
84debugging is controlled by the configuration option
85.Em SCSIDEBUG.
86.It Dv SCIOCCOMMAND
87Take a scsi command and data from a user process and apply them to the scsi
88device. Return all status information and return data to the process. The 
89ioctl will return a successful status even if the device rejected the
90command. As all status is returned to the user, it is up to the user
91process to examine this information to decide the success of the command.
92.It Dv SCIOCREPROBE
93Ask the system to probe the scsi busses for any new devices. If it finds
94any, they will be attached to the appropriate drivers. The search can be
95narrowed to a specific bus, target or lun. The new device may or may not
96be related to the device on which the ioctl was performed.
97.It Dv SCIOCIDENTIFY
98Ask the driver what it's bus, target and lun are.
99.It Dv SCIOCDECONFIG
100Ask the device to dissappear. This may not happen if the device is in use.
101.El
102.Sh NOTES
103the generic scsi part of the system is still being mapped out.
104Watch this space for changes.
105.Pp
106 A device by the name of su (scsi_user)
107(e.g  su0-0-0) will map bus, target and lun to  minor numbers. I have not
108yet decided yet whether this device will be able to open a device that is
109already controlled by an explicit driver.
110.Sh ADAPTERS
111The system allows common device drivers to work through many different
112types of adapters. The adapters take requests from the upper layers and do
113all IO between the 
114.Em SCSI
115bus and the system. The maximum size of a transfer is governed by the
116adapter. Most adapters can transfer 64KB in a single operation, however
117many can transfer larger amounts.
118.Sh TARGET MODE
119Some adapters support 
120.Em Target mode
121in which the system is capable of operating as a device, responding to
122operations initioated by another system. Target mode will be supported for
123some adapters, but is not yet complete for this version of the scsi system.
124.Sh FILES
125see other scsi device entries.
126.Sh DIAGNOSTICS
127When the kernel is compiled with option SCSIDEBUG, the SCIOCDEBUG ioctl 
128can be used to enable various amounts of tracing information on any 
129specific device. Devices not being traced will not produce trace information.
130The four bits that make up the debug level, each control certain types
131of debugging information. 
132.Bl -tag -width THIS_WIDE_PLEASE
133.It Dv Bit 0
134Bit 0  shows all scsi bus operations including scsi commands,
135error information and the first 48 bytes of any data transferred.
136.It Dv Bit 1
137Bit 1 shows routines called.
138.It Dv Bit 2
139Bit 2 shows information about what branches are taken and often some
140of the return values of functions.
141.It Dv Bit 3
142Bit 3 shows more detailed information including DMA scatter-gather logs.
143.El
144.Sh SEE ALSO
145.Xr ch 4
146.Xr cd 4
147.Xr sd 4
148.Xr st 4
149.Xr uk 4
150.Xr su 4
151.Xr aha 4
152.Xr ahb 4
153.Xr bt 4
154.Xr uha 4
155.Sh HISTORY
156This
157.Nm
158system appeared in MACH 2.5 at TRW.
159
160