1.\" $OpenBSD: scsi.4,v 1.35 2011/10/06 20:17:22 sobrado Exp $ 2.\" 3.\" Copyright (c) 1996 4.\" Julian Elischer <julian@freebsd.org>. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.Dd $Mdocdate: October 6 2011 $ 29.Dt SCSI 4 30.Os 31.Sh NAME 32.Nm scsi 33.Nd SCSI system 34.Sh SYNOPSIS 35.Cd "scsibus at ..." 36.Pp 37.Cd "cd* at scsibus?" 38.Cd "ch* at scsibus?" 39.Cd "safte* at scsibus?" 40.Cd "sd* at scsibus?" 41.Cd "ses* at scsibus?" 42.Cd "st* at scsibus?" 43.Cd "uk* at scsibus?" 44.Pp 45.Cd "# multipath support" 46.Cd "emc* at scsibus?" 47.Cd "hds* at scsibus?" 48.Cd "rdac* at scsibus?" 49.Cd "sym* at scsibus?" 50.Cd "scsibus* at mpath?" 51.Sh DESCRIPTION 52The 53.Em SCSI 54system provides a uniform and modular system for the implementation 55of drivers to control various SCSI devices, and to utilize different 56SCSI host adapters through host adapter drivers. 57When the system probes the 58.Em SCSI 59buses, it attaches any devices it finds to the appropriate 60drivers. 61If no driver seems appropriate, then it attaches the device to the 62uk (unknown) driver so that user level SCSI ioctls may 63still be performed against the device. 64.Sh KERNEL CONFIGURATION 65The option SCSIDEBUG enables the debug ioctl. 66.Pp 67All devices and the SCSI buses support boot time allocation so that 68an upper number of devices and controllers does not need to be configured; 69.Cd "sd* at scsibus?" 70will suffice for any number of disk drivers. 71.Pp 72The devices are either 73.Em wired 74so they appear as a particular device unit or 75.Em counted 76so that they appear as the next available unused unit. 77.Pp 78To configure a driver in the kernel without wiring down the device use a 79config line similar to 80.Cd "ch* at scsibus?" 81to include the changer driver. 82.Pp 83To wire down a unit use a config line similar to 84.Cd "ch1 at scsibus0 target 4 lun 0" 85to assign changer 1 as the changer with SCSI ID 4, 86SCSI logical unit 0 on SCSI bus 0. 87Individual scsibuses can be wired down to specific controllers with 88a config line similar to 89.Cd "scsibus0 at ahc0" 90which assigns SCSI bus 0 to the first unit using the ahc driver. 91For controllers supporting more than one bus, 92the particular bus can be specified as in 93.Cd "scsibus3 at ahc1 bus 1" 94which assigns scsibus 1 to the second bus probed on the ahc1 device. 95.Pp 96When there is a mixture of wired down and counted devices then the 97counting begins with the first non-wired down unit for a particular 98type. 99That is, if a disk is wired down as 100.Cd "sd1 at scsibus?" , 101then the first non-wired disk shall come on line as 102.Em sd2 . 103.Sh IOCTLS 104There are a number of ioctls that work on any 105.Em SCSI 106device. 107They are defined in 108.Aq Pa sys/scsiio.h 109and can be applied against any SCSI device that permits them. 110For the tape, it must be applied against the control 111device. 112See the manual page for each device type for more information about 113how generic SCSI ioctls may be applied to a specific device. 114.Bl -tag -width DIOCSDINFO____ 115.It Dv SCIOCRESET* 116Reset a device. 117.It Dv SCIOCDEBUG 118Turn on debugging. 119All SCSI operations originating from this device's driver 120will be traced to the console, along with other information. 121Debugging is controlled by four bits, described in the header file. 122If no debugging is configured into the kernel, debugging will have 123no effect. 124.Em SCSI 125debugging is controlled by the configuration option 126.Em SCSIDEBUG . 127.It Dv SCIOCCOMMAND 128Take a SCSI command and data from a user process and apply them to the SCSI 129device. 130Return all status information and return data to the process. 131The ioctl will return a successful status even if the device rejected the 132command. 133As all status is returned to the user, it is up to the user 134process to examine this information to decide the success of the command. 135.It Dv SCIOCIDENTIFY 136Ask the driver what its bus, target and lun are. 137In addition, the device type, ATAPI or SCSI, is returned. 138.El 139.Sh ADAPTERS 140The system allows common device drivers to work through many different 141types of adapters. 142The adapters take requests from the upper layers and do all I/O between the 143.Em SCSI 144bus and the system. 145The maximum size of a transfer is governed by the adapter. 146Most adapters can transfer 64KB in a single operation, and many can transfer 147larger amounts. 148.Sh DIAGNOSTICS 149When the kernel is compiled with option SCSIDEBUG, the SCIOCDEBUG ioctl 150can be used to enable various amounts of tracing information on any 151specific device. 152Devices not being traced will not produce trace information. 153The four bits that make up the debug level each control certain types 154of debugging information. 155.Bl -tag -width "Bit 0" 156.It Dv Bit 0 157shows all SCSI bus operations including SCSI commands, 158error information and the first 48 bytes of any data transferred. 159.It Dv Bit 1 160shows routines called. 161.It Dv Bit 2 162shows information about what branches are taken and often some 163of the return values of functions. 164.It Dv Bit 3 165shows more detailed information including DMA scatter-gather logs. 166.El 167.Sh SEE ALSO 168.Xr cd 4 , 169.Xr ch 4 , 170.Xr emc 4 , 171.Xr hds 4 , 172.Xr intro 4 , 173.Xr mpath 4 , 174.Xr rdac 4 , 175.Xr safte 4 , 176.Xr sd 4 , 177.Xr ses 4 , 178.Xr st 4 , 179.Xr sym 4 , 180.Xr uk 4 , 181.Xr scsi 8 182.Sh HISTORY 183This 184.Nm 185system appeared in MACH 2.5 at TRW. 186