1def37e7cSMike Pritchard.\" $Id: scsi.4,v 1.13 1999/07/27 18:21:17 nik 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.\" 2789045423SKenneth D. Merry.Dd October 15, 1998 2889045423SKenneth D. Merry.Dt SCSI 4 2989045423SKenneth D. Merry.Os FreeBSD 3.0 30db35f309SDavid Greenman.Sh NAME 3189045423SKenneth D. Merry.Nm SCSI , 3289045423SKenneth D. Merry.Nm CAM 3389045423SKenneth D. Merry.Nd CAM SCSI subsystem 34db35f309SDavid Greenman.Sh SYNOPSIS 356a6c4c22SMike Pritchard.Cd "controller scbus0" 366a6c4c22SMike Pritchard.Cd "controller scbus1 at ahc0" 376a6c4c22SMike Pritchard.Cd "controller scbus3 at ahc1 bus 0" 386a6c4c22SMike Pritchard.Cd "controller scbus2 at ahc1 bus 1" 396a6c4c22SMike Pritchard.Cd "device cd0" 406a6c4c22SMike Pritchard.Cd "device ch0" 4189045423SKenneth D. Merry.Cd "device da0" 4289045423SKenneth D. Merry.Cd "device pass0" 4389045423SKenneth D. Merry.Cd "device pt0" 4489045423SKenneth D. Merry.Cd "device sa0" 456a6c4c22SMike Pritchard.Cd "device ch1 at scbus0 target 4 unit 0" 4689045423SKenneth D. Merry.Cd options CAMDEBUG 47c4994073SNik Clayton.Cd options CAM_DEBUG_BUS=-1 48c4994073SNik Clayton.Cd options CAM_DEBUG_TARGET=-1 49c4994073SNik Clayton.Cd options CAM_DEBUG_LUN=-1 50c4994073SNik Clayton.Cd options CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_CDB 51c4994073SNik Clayton.Cd options CAM_MAX_HIGHPOWER=4 5289045423SKenneth D. Merry.Cd options SCSI_NO_SENSE_STRINGS 5389045423SKenneth D. Merry.Cd options SCSI_NO_OP_STRINGS 5489045423SKenneth D. Merry.Cd options SCSI_DELAY=8000 55db35f309SDavid Greenman.Sh DESCRIPTION 5689045423SKenneth D. MerryThe CAM 5789045423SKenneth D. Merry.Tn SCSI 5889045423SKenneth D. Merrysubsystem provides a uniform and modular system for the implementation 5989045423SKenneth D. Merryof drivers to control various 6089045423SKenneth D. Merry.Tn SCSI 6189045423SKenneth D. Merrydevices, and to utilize different 6289045423SKenneth D. Merry.Tn SCSI 6389045423SKenneth D. Merryhost adapters through host adapter drivers. When the system probes the 6489045423SKenneth D. Merry.Tn SCSI 65db35f309SDavid Greenmanbusses, it attaches any devices it finds to the appropriate 6689045423SKenneth D. Merrydrivers. The 6789045423SKenneth D. Merry.Xr pass 4 6889045423SKenneth D. Merrydriver, if it is configured in the kernel, will attach to all 6989045423SKenneth D. Merry.Tn SCSI 7089045423SKenneth D. Merrydevices. 71db35f309SDavid Greenman.Sh KERNEL CONFIGURATION 7289045423SKenneth D. MerryThere are a number of generic kernel configuration options for the 7389045423SKenneth D. MerryCAM 7489045423SKenneth D. Merry.Tn SCSI 7589045423SKenneth D. Merrysubsystem: 7689045423SKenneth D. Merry.Bl -tag -width SCSI_NO_SENSE_STRINGS 7789045423SKenneth D. Merry.It Dv CAMDEBUG 7889045423SKenneth D. MerryThis option enables the CAM debugging printf code. This won't actually 7989045423SKenneth D. Merrycause any debugging information to be printed out when included by itself. 8089045423SKenneth D. MerryEnabling printouts requires additional configuration. See below for 8189045423SKenneth D. Merrydetails. 8289045423SKenneth D. Merry.It Dv "CAM_MAX_HIGHPOWER=4" 8389045423SKenneth D. MerryThis sets the maximum allowable number of concurrent "high power" commands. 8489045423SKenneth D. MerryA "high power" command is a command that takes more electrical power than 8589045423SKenneth D. Merrymost to complete. An example of this (and the only command currently 8689045423SKenneth D. Merrytagged as "high power") is the 8789045423SKenneth D. Merry.Tn SCSI 8889045423SKenneth D. MerrySTART UNIT command. Starting a SCSI disk often takes significantly more 8989045423SKenneth D. Merryelectrical power than normal operation of the disk. This option allows the 9089045423SKenneth D. Merryuser to specify how many concurrent high power commands may be outstanding 9189045423SKenneth D. Merrywithout overloading the power supply on his computer. 9289045423SKenneth D. Merry.It Dv SCSI_NO_SENSE_STRINGS 9389045423SKenneth D. MerryThis eliminates text descriptions of each 9489045423SKenneth D. Merry.Tn SCSI 9589045423SKenneth D. MerryAdditional Sense Code and Additional Sense Code Qualifier pair. Since this 9689045423SKenneth D. Merryis a fairly large text database, eliminating it reduces the size of the 9789045423SKenneth D. Merrykernel somewhat. This is primarily necessary for boot floppies and other 9889045423SKenneth D. Merrylow disk space or low memory space environments. In most cases, though, 9989045423SKenneth D. Merrythis should be enabled, since it speeds the interpretation of 10089045423SKenneth D. Merry.Tn SCSI 10189045423SKenneth D. Merryerror messages. Don't let the "kernel bloat" zealots get to you -- leave 10289045423SKenneth D. Merrythe sense descriptions in your kernel! 10389045423SKenneth D. Merry.It Dv SCSI_NO_OP_STRINGS 10489045423SKenneth D. MerryThis disables text descriptions of each 10589045423SKenneth D. Merry.Tn SCSI 10689045423SKenneth D. Merryopcode. This option, like the sense string option above, is primarily 10789045423SKenneth D. Merryuseful for environments like a boot floppy where kernel size is critical. 10889045423SKenneth D. MerryEnabling this option for normal use isn't recommended, since it slows 10989045423SKenneth D. Merrydebugging of 11089045423SKenneth D. Merry.Tn SCSI 11189045423SKenneth D. Merryproblems. 11289045423SKenneth D. Merry.It Dv SCSI_DELAY=8000 11389045423SKenneth D. MerryThis is the 11489045423SKenneth D. Merry.Tn SCSI 11589045423SKenneth D. Merry"bus settle delay." In CAM, it is specified in 11689045423SKenneth D. Merry.Em milliseconds , 11789045423SKenneth D. Merrynot seconds like the old 11889045423SKenneth D. Merry.Tn SCSI 11989045423SKenneth D. Merrylayer used to do. When the kernel boots, it sends a bus reset to each 12089045423SKenneth D. Merry.Tn SCSI 12189045423SKenneth D. Merrybus to tell each device to reset itself to a default set of transfer 12289045423SKenneth D. Merrynegotiations and other settings. Most 12389045423SKenneth D. Merry.Tn SCSI 12489045423SKenneth D. Merrydevices need some amount of time to recover from a bus reset. Newer disks 12589045423SKenneth D. Merrymay need as little as 100ms, while old, slow devices may need much longer. 12689045423SKenneth D. MerryIf the 12789045423SKenneth D. Merry.Dv SCSI_DELAY 12889045423SKenneth D. Merryisn't specified, it defaults to 2 seconds. The minimum allowable value for 12989045423SKenneth D. Merry.Dv SCSI_DELAY 13089045423SKenneth D. Merryis "100", or 100ms. One special case is that if the 13189045423SKenneth D. Merry.Dv SCSI_DELAY 13289045423SKenneth D. Merryis set to 0, that will be taken to mean the "lowest possible value." In 13389045423SKenneth D. Merrythat case, the 13489045423SKenneth D. Merry.Dv SCSI_DELAY 13589045423SKenneth D. Merrywill be reset to 100ms. 13689045423SKenneth D. Merry.El 1372460bdf0SPeter Dufault.Pp 1382460bdf0SPeter DufaultAll devices and the SCSI busses support boot time allocation so that 1392460bdf0SPeter Dufaultan upper number of devices and controllers does not need to be configured; 14089045423SKenneth D. Merry.Cd "device da0" 1412460bdf0SPeter Dufaultwill suffice for any number of disk drivers. 1422460bdf0SPeter Dufault.Pp 1432460bdf0SPeter DufaultThe devices are either 1442460bdf0SPeter Dufault.Em wired 1452460bdf0SPeter Dufaultso they appear as a particular device unit or 1462460bdf0SPeter Dufault.Em counted 1472460bdf0SPeter Dufaultso that they appear as the next available unused unit. 1482460bdf0SPeter Dufault.Pp 1492460bdf0SPeter DufaultTo configure a driver in the kernel without wiring down the device use a 1502460bdf0SPeter Dufaultconfig line similar to 15189045423SKenneth D. Merry.Cd "device ch0" 1522460bdf0SPeter Dufaultto include the changer driver. 1532460bdf0SPeter Dufault.Pp 15431acd246SJustin T. GibbsTo wire down a unit use a config line similar to 15589045423SKenneth D. Merry.Cd "device ch1 at scbus0 target 4 unit 0" 15631acd246SJustin T. Gibbsto assign changer 1 as the changer with SCSI ID 4, 15731acd246SJustin T. GibbsSCSI logical unit 0 on SCSI bus 0. 15831acd246SJustin T. GibbsIndividual scbuses can be wired down to specific controllers with 15931acd246SJustin T. Gibbsa config line similar to 16089045423SKenneth D. Merry.Cd "controller scbus0 at ahc0" 16131acd246SJustin T. Gibbswhich assigns scsi bus 0 to the first unit using the ahc driver. 16231acd246SJustin T. GibbsFor controllers supporting more than one bus, 1634a8d0283SMike Pritchardthe particular bus can be specified as in 16489045423SKenneth D. Merry.Cd "controller scbus3 at ahc1 bus 1" 1654a8d0283SMike Pritchardwhich assigns scbus 1 to the second bus probed on the ahc1 device. 1662460bdf0SPeter Dufault.Pp 1672460bdf0SPeter DufaultWhen you have a mixture of wired down and counted devices then the 1682460bdf0SPeter Dufaultcounting begins with the first non-wired down unit for a particular 1692460bdf0SPeter Dufaulttype. That is, if you have a disk wired down as 17089045423SKenneth D. Merry.Em "device da1" , 1712460bdf0SPeter Dufaultthen the first non-wired disk shall come on line as 17289045423SKenneth D. Merry.Em da2 . 173db35f309SDavid Greenman.Sh ADAPTERS 174db35f309SDavid GreenmanThe system allows common device drivers to work through many different 175db35f309SDavid Greenmantypes of adapters. The adapters take requests from the upper layers and do 176db35f309SDavid Greenmanall IO between the 177db35f309SDavid Greenman.Em SCSI 178db35f309SDavid Greenmanbus and the system. The maximum size of a transfer is governed by the 179db35f309SDavid Greenmanadapter. Most adapters can transfer 64KB in a single operation, however 180db35f309SDavid Greenmanmany can transfer larger amounts. 181db35f309SDavid Greenman.Sh TARGET MODE 182db35f309SDavid GreenmanSome adapters support 18389045423SKenneth D. Merry.Em target mode 184db35f309SDavid Greenmanin which the system is capable of operating as a device, responding to 18589045423SKenneth D. Merryoperations initiated by another system. Target mode is supported for 18689045423SKenneth D. Merrysome adapters, but is not yet complete for this version of the CAM 18789045423SKenneth D. Merry.Tn SCSI 18889045423SKenneth D. Merrysubsystem. 189db35f309SDavid Greenman.Sh FILES 190db35f309SDavid Greenmansee other scsi device entries. 191db35f309SDavid Greenman.Sh DIAGNOSTICS 19289045423SKenneth D. MerryWhen the kernel is compiled with options CAMDEBUG, an XPT_DEBUG CCB can be 19389045423SKenneth D. Merryused to enable various amounts of tracing information on any 194db35f309SDavid Greenmanspecific device. Devices not being traced will not produce trace information. 19589045423SKenneth D. MerryThere are currently four debugging flags that may be turned on: 19689045423SKenneth D. Merry.Bl -tag -width CAM_DEBUG_SUBTRACE 19789045423SKenneth D. Merry.It Dv CAM_DEBUG_INFO 19889045423SKenneth D. MerryThis debugging flag enables general informational printfs for the device 19989045423SKenneth D. Merryor devices in question. 20089045423SKenneth D. Merry.It Dv CAM_DEBUG_TRACE 20189045423SKenneth D. MerryThis debugging flag enables function-level command flow tracing. i.e. 20289045423SKenneth D. Merrykernel printfs will happen at the entrance and exit of various functions. 20389045423SKenneth D. Merry.It Dv CAM_DEBUG_SUBTRACE 20489045423SKenneth D. MerryThis debugging flag enables debugging output internal to various functions. 20589045423SKenneth D. Merry.It Dv CAM_DEBUG_CDB 20689045423SKenneth D. MerryThis debugging flag will cause the kernel to print out all 20789045423SKenneth D. Merry.Tn SCSI 20889045423SKenneth D. Merrycommands sent to a particular device or devices. 209db35f309SDavid Greenman.El 21089045423SKenneth D. Merry.Pp 21189045423SKenneth D. MerrySome of these flags, most notably 21289045423SKenneth D. Merry.Dv CAM_DEBUG_TRACE 21389045423SKenneth D. Merryand 21489045423SKenneth D. Merry.Dv CAM_DEBUG_SUBTRACE 21589045423SKenneth D. Merrywill produce kernel printfs in EXTREME numbers. Because of that, they 21689045423SKenneth D. Merryaren't especially useful. There aren't many things logged at the 21789045423SKenneth D. Merry.Dv CAM_DEBUG_INFO 21889045423SKenneth D. Merrylevel, so it isn't especially useful. The most useful debugging flag is 21989045423SKenneth D. Merrythe 22089045423SKenneth D. Merry.Dv CAM_DEBUG_CDB 22189045423SKenneth D. Merryflag. Users can enable debugging from their kernel config file, by using 22289045423SKenneth D. Merrythe following kernel config options: 22389045423SKenneth D. Merry.Bl -tag -width CAM_DEBUG_TARGET 22489045423SKenneth D. Merry.It Dv CAMDEBUG 22589045423SKenneth D. MerryThis enables CAM debugging. Without this option, users will not even be able 22689045423SKenneth D. Merryto turn on debugging from userland via 22789045423SKenneth D. Merry.Xr camcontrol 8 . 22889045423SKenneth D. Merry.It Dv CAM_DEBUG_FLAGS 22989045423SKenneth D. MerryThis allows the user to set the various debugging flags described above 23089045423SKenneth D. Merryin a kernel config file. Flags may be ORed together if the user wishes to 23189045423SKenneth D. Merrysee printfs for multiple debugging levels. 23289045423SKenneth D. Merry.It Dv CAM_DEBUG_BUS 23389045423SKenneth D. MerrySpecify a bus to debug. To debug all busses, set this to -1. 23489045423SKenneth D. Merry.It Dv CAM_DEBUG_TARGET 23589045423SKenneth D. MerrySpecify a target to debug. To debug all targets, set this to -1. 23689045423SKenneth D. Merry.It Dv CAM_DEBUG_LUN 23789045423SKenneth D. MerrySpecify a lun to debug. To debug all luns, set this to -1. 23889045423SKenneth D. Merry.El 23989045423SKenneth D. Merry.Pp 24089045423SKenneth D. MerryWhen specifying a bus, target or lun to debug, you 24189045423SKenneth D. Merry.Em MUST 24289045423SKenneth D. Merryspecify all three bus/target/lun options above. Using wildcards, you 24389045423SKenneth D. Merryshould be able to enable debugging on most anything. 24489045423SKenneth D. Merry.Pp 24589045423SKenneth D. MerryUsers may also enable debugging printfs on the fly, if the 24689045423SKenneth D. Merry.Dv CAMDEBUG 24789045423SKenneth D. Merryoption is their config file, by using the 24889045423SKenneth D. Merry.Xr camcontrol 8 24989045423SKenneth D. Merryutility. See 25089045423SKenneth D. Merry.Xr camcontrol 8 25189045423SKenneth D. Merryfor details. 252db35f309SDavid Greenman.Sh SEE ALSO 253e0e5145cSWolfram Schneider.Xr aha 4 , 254e0e5145cSWolfram Schneider.Xr ahb 4 , 25589045423SKenneth D. Merry.Xr ahc 4 , 256e0e5145cSWolfram Schneider.Xr bt 4 , 2570b992c1dSWolfram Schneider.Xr cd 4 , 2580b992c1dSWolfram Schneider.Xr ch 4 , 25989045423SKenneth D. Merry.Xr da 4 , 26089045423SKenneth D. Merry.Xr pass 4 , 26189045423SKenneth D. Merry.Xr pt 4 , 26289045423SKenneth D. Merry.Xr sa 4 , 26389045423SKenneth D. Merry.Xr xpt 4 , 26489045423SKenneth D. Merry.Xr camcontrol 8 265db35f309SDavid Greenman.Sh HISTORY 26689045423SKenneth D. MerryThe CAM 26789045423SKenneth D. Merry.Tn SCSI 26889045423SKenneth D. Merrysubsystem first appeared in 26989045423SKenneth D. Merry.Fx 3.0 . 27089045423SKenneth D. Merry.Sh AUTHORS 27189045423SKenneth D. MerryThe CAM 27289045423SKenneth D. Merry.Tn SCSI 273def37e7cSMike Pritchardsubsystem was written by 274def37e7cSMike Pritchard.An Justin Gibbs 275def37e7cSMike Pritchardand 276def37e7cSMike Pritchard.An Kenneth Merry . 27789045423SKenneth D. Merry 278