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