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