1a77a7ee0SJulian Elischer.\" $Id: scsi.4,v 1.5 1996/09/23 22:23:33 wosch Exp $ 2a77a7ee0SJulian Elischer.\" Copyright (c) 1996 3a77a7ee0SJulian Elischer.\" Julian Elischer <julian@freebsd.org>. All rights reserved. 4a77a7ee0SJulian Elischer.\" 5a77a7ee0SJulian Elischer.\" Redistribution and use in source and binary forms, with or without 6a77a7ee0SJulian Elischer.\" modification, are permitted provided that the following conditions 7a77a7ee0SJulian Elischer.\" are met: 8a77a7ee0SJulian Elischer.\" 1. Redistributions of source code must retain the above copyright 9a77a7ee0SJulian Elischer.\" notice, this list of conditions and the following disclaimer. 10a77a7ee0SJulian Elischer.\" 11a77a7ee0SJulian Elischer.\" 2. Redistributions in binary form must reproduce the above copyright 12a77a7ee0SJulian Elischer.\" notice, this list of conditions and the following disclaimer in the 13a77a7ee0SJulian Elischer.\" documentation and/or other materials provided with the distribution. 14a77a7ee0SJulian Elischer.\" 15a77a7ee0SJulian Elischer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16a77a7ee0SJulian Elischer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17a77a7ee0SJulian Elischer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18a77a7ee0SJulian Elischer.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19a77a7ee0SJulian Elischer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20a77a7ee0SJulian Elischer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21a77a7ee0SJulian Elischer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22a77a7ee0SJulian Elischer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23a77a7ee0SJulian Elischer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24a77a7ee0SJulian Elischer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25a77a7ee0SJulian Elischer.\" SUCH DAMAGE. 26a77a7ee0SJulian Elischer.\" 27db35f309SDavid Greenman.Dd August 27, 1993 28db35f309SDavid Greenman.Dt SD 4 29db35f309SDavid Greenman.Os FreeBSD 30db35f309SDavid Greenman.Sh NAME 31db35f309SDavid Greenman.Nm scsi 32db35f309SDavid Greenman.Nd scsi system 33db35f309SDavid Greenman.Sh SYNOPSIS 342460bdf0SPeter Dufault.Nm controller scbus0 3531acd246SJustin T. Gibbs.Nm controller scbus1 at ahc0 3631acd246SJustin T. Gibbs.Nm controller scbus3 at ahc1 bus 0 3731acd246SJustin T. Gibbs.Nm controller scbus2 at ahc1 bus 1 382460bdf0SPeter Dufault.Nm device cd0 392460bdf0SPeter Dufault.Nm device ch0 402460bdf0SPeter Dufault.Nm disk sd0 412460bdf0SPeter Dufault.Nm tape st0 422460bdf0SPeter Dufault.Nm device ch1 at scbus0 target 4 unit 0 43db35f309SDavid Greenman.Sh DESCRIPTION 44db35f309SDavid GreenmanThe 45db35f309SDavid Greenman.Em scsi 462460bdf0SPeter Dufaultsystem provides a uniform and modular system for the implementation 474a8d0283SMike Pritchardof drivers to control various scsi devices, and to utilize different 482460bdf0SPeter Dufaultscsi host adapters through host adapter drivers. When the system probes the 49db35f309SDavid Greenman.Em SCSI 50db35f309SDavid Greenmanbusses, it attaches any devices it finds to the appropriate 512460bdf0SPeter Dufaultdrivers. If no driver seems appropriate, then it attaches the device to the 522460bdf0SPeter Dufaultuk (unknown) driver so that user level scsi ioctls may 53db35f309SDavid Greenmanstill be performed against the device. 54db35f309SDavid Greenman.Sh KERNEL CONFIGURATION 55db35f309SDavid GreenmanThe option SCSIDEBUG enables the debug ioctl. 562460bdf0SPeter Dufault.Pp 572460bdf0SPeter DufaultAll devices and the SCSI busses support boot time allocation so that 582460bdf0SPeter Dufaultan upper number of devices and controllers does not need to be configured; 592460bdf0SPeter Dufault.Em "device sd0" 602460bdf0SPeter Dufaultwill suffice for any number of disk drivers. 612460bdf0SPeter Dufault.Pp 622460bdf0SPeter DufaultThe devices are either 632460bdf0SPeter Dufault.Em wired 642460bdf0SPeter Dufaultso they appear as a particular device unit or 652460bdf0SPeter Dufault.Em counted 662460bdf0SPeter Dufaultso that they appear as the next available unused unit. 672460bdf0SPeter Dufault.Pp 682460bdf0SPeter DufaultTo configure a driver in the kernel without wiring down the device use a 692460bdf0SPeter Dufaultconfig line similar to 702460bdf0SPeter Dufault.Em "device ch0" 712460bdf0SPeter Dufaultto include the changer driver. 722460bdf0SPeter Dufault.Pp 7331acd246SJustin T. GibbsTo wire down a unit use a config line similar to 742460bdf0SPeter Dufault.Em "device ch1 at scbus0 target 4 unit 0" 7531acd246SJustin T. Gibbsto assign changer 1 as the changer with SCSI ID 4, 7631acd246SJustin T. GibbsSCSI logical unit 0 on SCSI bus 0. 7731acd246SJustin T. GibbsIndividual scbuses can be wired down to specific controllers with 7831acd246SJustin T. Gibbsa config line similar to 7931acd246SJustin T. Gibbs.Em "controller scbus0 at ahc0" 8031acd246SJustin T. Gibbswhich assigns scsi bus 0 to the first unit using the ahc driver. 8131acd246SJustin T. GibbsFor controllers supporting more than one bus, 824a8d0283SMike Pritchardthe particular bus can be specified as in 8331acd246SJustin T. Gibbs.Em "controller scbus3 at ahc1 bus 1" 844a8d0283SMike Pritchardwhich assigns scbus 1 to the second bus probed on the ahc1 device. 852460bdf0SPeter Dufault.Pp 862460bdf0SPeter DufaultWhen you have a mixture of wired down and counted devices then the 872460bdf0SPeter Dufaultcounting begins with the first non-wired down unit for a particular 882460bdf0SPeter Dufaulttype. That is, if you have a disk wired down as 892460bdf0SPeter Dufault.Em "disk sd1" , 902460bdf0SPeter Dufaultthen the first non-wired disk shall come on line as 912460bdf0SPeter Dufault.Em sd2 . 92db35f309SDavid Greenman.Sh IOCTLS 932460bdf0SPeter DufaultThere are a number of ioctls that work on any 94db35f309SDavid Greenman.Em SCSI 95db35f309SDavid Greenmandevice. They are defined in 96db35f309SDavid Greenman.Em sys/scsiio.h 972460bdf0SPeter Dufaultand can be applied against any scsi device that permits them. 982460bdf0SPeter DufaultFor the tape, it must be applied against the control 99db35f309SDavid Greenmandevice. See the manual page for each device type for more information about 100db35f309SDavid Greenmanhow generic scsi ioctls may be applied to a specific device. 101db35f309SDavid Greenman.Bl -tag -width DIOCSDINFO____ 102db35f309SDavid Greenman.It Dv SCIOCRESET* 103db35f309SDavid Greenmanreset a device. 104db35f309SDavid Greenman.It Dv SCIOCDEBUG 105db35f309SDavid GreenmanTurn on debugging.. All scsi operations originating from this device's driver 106db35f309SDavid Greenmanwill be traced to the console, along with other information. Debugging is 107db35f309SDavid Greenmancontrolled by four bits, described in the header file. If no debugging is 108db35f309SDavid Greenmanconfigured into the kernel, debugging will have no effect. 109db35f309SDavid Greenman.Em SCSI 110db35f309SDavid Greenmandebugging is controlled by the configuration option 111db35f309SDavid Greenman.Em SCSIDEBUG. 112db35f309SDavid Greenman.It Dv SCIOCCOMMAND 113db35f309SDavid GreenmanTake a scsi command and data from a user process and apply them to the scsi 114db35f309SDavid Greenmandevice. Return all status information and return data to the process. The 115db35f309SDavid Greenmanioctl will return a successful status even if the device rejected the 116db35f309SDavid Greenmancommand. As all status is returned to the user, it is up to the user 117db35f309SDavid Greenmanprocess to examine this information to decide the success of the command. 118db35f309SDavid Greenman.It Dv SCIOCREPROBE 119db35f309SDavid GreenmanAsk the system to probe the scsi busses for any new devices. If it finds 120db35f309SDavid Greenmanany, they will be attached to the appropriate drivers. The search can be 121db35f309SDavid Greenmannarrowed to a specific bus, target or lun. The new device may or may not 122db35f309SDavid Greenmanbe related to the device on which the ioctl was performed. 123db35f309SDavid Greenman.It Dv SCIOCIDENTIFY 124db35f309SDavid GreenmanAsk the driver what it's bus, target and lun are. 125db35f309SDavid Greenman.It Dv SCIOCDECONFIG 1264a8d0283SMike PritchardAsk the device to disappear. This may not happen if the device is in use. 127db35f309SDavid Greenman.El 128db35f309SDavid Greenman.Sh NOTES 129db35f309SDavid Greenmanthe generic scsi part of the system is still being mapped out. 130db35f309SDavid GreenmanWatch this space for changes. 131db35f309SDavid Greenman.Pp 132db35f309SDavid Greenman A device by the name of su (scsi_user) 133db35f309SDavid Greenman(e.g su0-0-0) will map bus, target and lun to minor numbers. I have not 134db35f309SDavid Greenmanyet decided yet whether this device will be able to open a device that is 135db35f309SDavid Greenmanalready controlled by an explicit driver. 136db35f309SDavid Greenman.Sh ADAPTERS 137db35f309SDavid GreenmanThe system allows common device drivers to work through many different 138db35f309SDavid Greenmantypes of adapters. The adapters take requests from the upper layers and do 139db35f309SDavid Greenmanall IO between the 140db35f309SDavid Greenman.Em SCSI 141db35f309SDavid Greenmanbus and the system. The maximum size of a transfer is governed by the 142db35f309SDavid Greenmanadapter. Most adapters can transfer 64KB in a single operation, however 143db35f309SDavid Greenmanmany can transfer larger amounts. 144db35f309SDavid Greenman.Sh TARGET MODE 145db35f309SDavid GreenmanSome adapters support 146db35f309SDavid Greenman.Em Target mode 147db35f309SDavid Greenmanin which the system is capable of operating as a device, responding to 1484a8d0283SMike Pritchardoperations initiated by another system. Target mode will be supported for 149db35f309SDavid Greenmansome adapters, but is not yet complete for this version of the scsi system. 150db35f309SDavid Greenman.Sh FILES 151db35f309SDavid Greenmansee other scsi device entries. 152db35f309SDavid Greenman.Sh DIAGNOSTICS 153db35f309SDavid GreenmanWhen the kernel is compiled with option SCSIDEBUG, the SCIOCDEBUG ioctl 154db35f309SDavid Greenmancan be used to enable various amounts of tracing information on any 155db35f309SDavid Greenmanspecific device. Devices not being traced will not produce trace information. 156db35f309SDavid GreenmanThe four bits that make up the debug level, each control certain types 157db35f309SDavid Greenmanof debugging information. 158db35f309SDavid Greenman.Bl -tag -width THIS_WIDE_PLEASE 159db35f309SDavid Greenman.It Dv Bit 0 160db35f309SDavid GreenmanBit 0 shows all scsi bus operations including scsi commands, 161db35f309SDavid Greenmanerror information and the first 48 bytes of any data transferred. 162db35f309SDavid Greenman.It Dv Bit 1 163db35f309SDavid GreenmanBit 1 shows routines called. 164db35f309SDavid Greenman.It Dv Bit 2 165db35f309SDavid GreenmanBit 2 shows information about what branches are taken and often some 166db35f309SDavid Greenmanof the return values of functions. 167db35f309SDavid Greenman.It Dv Bit 3 168db35f309SDavid GreenmanBit 3 shows more detailed information including DMA scatter-gather logs. 169db35f309SDavid Greenman.El 170db35f309SDavid Greenman.Sh SEE ALSO 171e0e5145cSWolfram Schneider.Xr ch 4 , 172e0e5145cSWolfram Schneider.Xr cd 4 , 173e0e5145cSWolfram Schneider.Xr sd 4 , 174e0e5145cSWolfram Schneider.Xr st 4 , 175e0e5145cSWolfram Schneider.Xr uk 4 , 176e0e5145cSWolfram Schneider.Xr su 4 , 177e0e5145cSWolfram Schneider.Xr aha 4 , 178e0e5145cSWolfram Schneider.Xr ahb 4 , 179e0e5145cSWolfram Schneider.Xr bt 4 , 180db35f309SDavid Greenman.Xr uha 4 181db35f309SDavid Greenman.Sh HISTORY 182db35f309SDavid GreenmanThis 183db35f309SDavid Greenman.Nm 184db35f309SDavid Greenmansystem appeared in MACH 2.5 at TRW. 185db35f309SDavid Greenman 186