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