1a77a7ee0SJulian Elischer.\" Copyright (c) 1996 2eddc45e7SJeroen Ruigrok van der Werven.\" Julian Elischer <julian@FreeBSD.org>. All rights reserved. 3a77a7ee0SJulian Elischer.\" 4a77a7ee0SJulian Elischer.\" Redistribution and use in source and binary forms, with or without 5a77a7ee0SJulian Elischer.\" modification, are permitted provided that the following conditions 6a77a7ee0SJulian Elischer.\" are met: 7a77a7ee0SJulian Elischer.\" 1. Redistributions of source code must retain the above copyright 8a77a7ee0SJulian Elischer.\" notice, this list of conditions and the following disclaimer. 9a77a7ee0SJulian Elischer.\" 10a77a7ee0SJulian Elischer.\" 2. Redistributions in binary form must reproduce the above copyright 11a77a7ee0SJulian Elischer.\" notice, this list of conditions and the following disclaimer in the 12a77a7ee0SJulian Elischer.\" documentation and/or other materials provided with the distribution. 13a77a7ee0SJulian Elischer.\" 14a77a7ee0SJulian Elischer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15a77a7ee0SJulian Elischer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16a77a7ee0SJulian Elischer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17a77a7ee0SJulian Elischer.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18a77a7ee0SJulian Elischer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19a77a7ee0SJulian Elischer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20a77a7ee0SJulian Elischer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21a77a7ee0SJulian Elischer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22a77a7ee0SJulian Elischer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23a77a7ee0SJulian Elischer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24a77a7ee0SJulian Elischer.\" SUCH DAMAGE. 25a77a7ee0SJulian Elischer.\" 264e8867b9SAlexey Zelkin.\" $FreeBSD$ 2789045423SKenneth D. Merry.Dd October 15, 1998 2889045423SKenneth D. Merry.Dt SCSI 4 29ed403116SRuslan Ermilov.Os FreeBSD 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 35b9781e20SJeroen Ruigrok van der Werven.Cd "device scbus" 3612e49033SJeroen Ruigrok van der Werven.Cd "device scbus1 at ahc0" 3712e49033SJeroen Ruigrok van der Werven.Cd "device scbus3 at ahc1 bus 0" 3812e49033SJeroen Ruigrok van der Werven.Cd "device scbus2 at ahc1 bus 1" 39b9781e20SJeroen Ruigrok van der Werven.Cd "device cd" 40b9781e20SJeroen Ruigrok van der Werven.Cd "device ch" 41b9781e20SJeroen Ruigrok van der Werven.Cd "device da" 42b9781e20SJeroen Ruigrok van der Werven.Cd "device pass" 43b9781e20SJeroen Ruigrok van der Werven.Cd "device pt" 44b9781e20SJeroen Ruigrok van der Werven.Cd "device sa" 456a6c4c22SMike Pritchard.Cd "device ch1 at scbus0 target 4 unit 0" 463136363fSRuslan Ermilov.Cd "options CAMDEBUG" 473136363fSRuslan Ermilov.Cd "options CAM_DEBUG_BUS=-1" 483136363fSRuslan Ermilov.Cd "options CAM_DEBUG_TARGET=-1" 493136363fSRuslan Ermilov.Cd "options CAM_DEBUG_LUN=-1" 503136363fSRuslan Ermilov.Cd "options CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_CDB" 513136363fSRuslan Ermilov.Cd "options CAM_MAX_HIGHPOWER=4" 523136363fSRuslan Ermilov.Cd "options SCSI_NO_SENSE_STRINGS" 533136363fSRuslan Ermilov.Cd "options SCSI_NO_OP_STRINGS" 543136363fSRuslan Ermilov.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 636d249eeeSSheldon Hearnhost adapters through host adapter drivers. 646d249eeeSSheldon HearnWhen the system probes the 6589045423SKenneth D. Merry.Tn SCSI 66db35f309SDavid Greenmanbusses, it attaches any devices it finds to the appropriate 6789045423SKenneth D. Merrydrivers. The 6889045423SKenneth D. Merry.Xr pass 4 6989045423SKenneth D. Merrydriver, if it is configured in the kernel, will attach to all 7089045423SKenneth D. Merry.Tn SCSI 7189045423SKenneth D. Merrydevices. 72db35f309SDavid Greenman.Sh KERNEL CONFIGURATION 7389045423SKenneth D. MerryThere are a number of generic kernel configuration options for the 7489045423SKenneth D. MerryCAM 7589045423SKenneth D. Merry.Tn SCSI 7689045423SKenneth D. Merrysubsystem: 7789045423SKenneth D. Merry.Bl -tag -width SCSI_NO_SENSE_STRINGS 7889045423SKenneth D. Merry.It Dv CAMDEBUG 7989045423SKenneth D. MerryThis option enables the CAM debugging printf code. This won't actually 8089045423SKenneth D. Merrycause any debugging information to be printed out when included by itself. 8189045423SKenneth D. MerryEnabling printouts requires additional configuration. See below for 8289045423SKenneth D. Merrydetails. 8389045423SKenneth D. Merry.It Dv "CAM_MAX_HIGHPOWER=4" 8489045423SKenneth D. MerryThis sets the maximum allowable number of concurrent "high power" commands. 8589045423SKenneth D. MerryA "high power" command is a command that takes more electrical power than 8689045423SKenneth D. Merrymost to complete. An example of this (and the only command currently 8789045423SKenneth D. Merrytagged as "high power") is the 8889045423SKenneth D. Merry.Tn SCSI 8989045423SKenneth D. MerrySTART UNIT command. Starting a SCSI disk often takes significantly more 9089045423SKenneth D. Merryelectrical power than normal operation of the disk. This option allows the 9189045423SKenneth D. Merryuser to specify how many concurrent high power commands may be outstanding 9289045423SKenneth D. Merrywithout overloading the power supply on his computer. 9389045423SKenneth D. Merry.It Dv SCSI_NO_SENSE_STRINGS 9489045423SKenneth D. MerryThis eliminates text descriptions of each 9589045423SKenneth D. Merry.Tn SCSI 9689045423SKenneth D. MerryAdditional Sense Code and Additional Sense Code Qualifier pair. Since this 9789045423SKenneth D. Merryis a fairly large text database, eliminating it reduces the size of the 9889045423SKenneth D. Merrykernel somewhat. This is primarily necessary for boot floppies and other 9989045423SKenneth D. Merrylow disk space or low memory space environments. In most cases, though, 10089045423SKenneth D. Merrythis should be enabled, since it speeds the interpretation of 10189045423SKenneth D. Merry.Tn SCSI 10289045423SKenneth D. Merryerror messages. Don't let the "kernel bloat" zealots get to you -- leave 10389045423SKenneth D. Merrythe sense descriptions in your kernel! 10489045423SKenneth D. Merry.It Dv SCSI_NO_OP_STRINGS 10589045423SKenneth D. MerryThis disables text descriptions of each 10689045423SKenneth D. Merry.Tn SCSI 10789045423SKenneth D. Merryopcode. This option, like the sense string option above, is primarily 10889045423SKenneth D. Merryuseful for environments like a boot floppy where kernel size is critical. 10989045423SKenneth D. MerryEnabling this option for normal use isn't recommended, since it slows 11089045423SKenneth D. Merrydebugging of 11189045423SKenneth D. Merry.Tn SCSI 11289045423SKenneth D. Merryproblems. 11389045423SKenneth D. Merry.It Dv SCSI_DELAY=8000 11489045423SKenneth D. MerryThis is the 11589045423SKenneth D. Merry.Tn SCSI 11689045423SKenneth D. Merry"bus settle delay." In CAM, it is specified in 11789045423SKenneth D. Merry.Em milliseconds , 11889045423SKenneth D. Merrynot seconds like the old 11989045423SKenneth D. Merry.Tn SCSI 12089045423SKenneth D. Merrylayer used to do. When the kernel boots, it sends a bus reset to each 12189045423SKenneth D. Merry.Tn SCSI 12289045423SKenneth D. Merrybus to tell each device to reset itself to a default set of transfer 12389045423SKenneth D. Merrynegotiations and other settings. Most 12489045423SKenneth D. Merry.Tn SCSI 12589045423SKenneth D. Merrydevices need some amount of time to recover from a bus reset. Newer disks 12689045423SKenneth D. Merrymay need as little as 100ms, while old, slow devices may need much longer. 12789045423SKenneth D. MerryIf the 12889045423SKenneth D. Merry.Dv SCSI_DELAY 12989045423SKenneth D. Merryisn't specified, it defaults to 2 seconds. The minimum allowable value for 13089045423SKenneth D. Merry.Dv SCSI_DELAY 13189045423SKenneth D. Merryis "100", or 100ms. One special case is that if the 13289045423SKenneth D. Merry.Dv SCSI_DELAY 13389045423SKenneth D. Merryis set to 0, that will be taken to mean the "lowest possible value." In 13489045423SKenneth D. Merrythat case, the 13589045423SKenneth D. Merry.Dv SCSI_DELAY 13689045423SKenneth D. Merrywill be reset to 100ms. 13789045423SKenneth D. Merry.El 1382460bdf0SPeter Dufault.Pp 1392460bdf0SPeter DufaultAll devices and the SCSI busses support boot time allocation so that 1402460bdf0SPeter Dufaultan upper number of devices and controllers does not need to be configured; 14189045423SKenneth D. Merry.Cd "device da0" 1422460bdf0SPeter Dufaultwill suffice for any number of disk drivers. 1432460bdf0SPeter Dufault.Pp 1442460bdf0SPeter DufaultThe devices are either 1452460bdf0SPeter Dufault.Em wired 1462460bdf0SPeter Dufaultso they appear as a particular device unit or 1472460bdf0SPeter Dufault.Em counted 1482460bdf0SPeter Dufaultso that they appear as the next available unused unit. 1492460bdf0SPeter Dufault.Pp 1502460bdf0SPeter DufaultTo configure a driver in the kernel without wiring down the device use a 1512460bdf0SPeter Dufaultconfig line similar to 15289045423SKenneth D. Merry.Cd "device ch0" 1532460bdf0SPeter Dufaultto include the changer driver. 1542460bdf0SPeter Dufault.Pp 15531acd246SJustin T. GibbsTo wire down a unit use a config line similar to 15689045423SKenneth D. Merry.Cd "device ch1 at scbus0 target 4 unit 0" 15731acd246SJustin T. Gibbsto assign changer 1 as the changer with SCSI ID 4, 15831acd246SJustin T. GibbsSCSI logical unit 0 on SCSI bus 0. 15931acd246SJustin T. GibbsIndividual scbuses can be wired down to specific controllers with 16031acd246SJustin T. Gibbsa config line similar to 16112e49033SJeroen Ruigrok van der Werven.Cd "device scbus0 at ahc0" 16231acd246SJustin T. Gibbswhich assigns scsi bus 0 to the first unit using the ahc driver. 16331acd246SJustin T. GibbsFor controllers supporting more than one bus, 1644a8d0283SMike Pritchardthe particular bus can be specified as in 16512e49033SJeroen Ruigrok van der Werven.Cd "device scbus3 at ahc1 bus 1" 1664a8d0283SMike Pritchardwhich assigns scbus 1 to the second bus probed on the ahc1 device. 1672460bdf0SPeter Dufault.Pp 1682460bdf0SPeter DufaultWhen you have a mixture of wired down and counted devices then the 1692460bdf0SPeter Dufaultcounting begins with the first non-wired down unit for a particular 1702460bdf0SPeter Dufaulttype. That is, if you have a disk wired down as 17189045423SKenneth D. Merry.Em "device da1" , 1722460bdf0SPeter Dufaultthen the first non-wired disk shall come on line as 17389045423SKenneth D. Merry.Em da2 . 174db35f309SDavid Greenman.Sh ADAPTERS 175db35f309SDavid GreenmanThe system allows common device drivers to work through many different 1766d249eeeSSheldon Hearntypes of adapters. 1776d249eeeSSheldon HearnThe adapters take requests from the upper layers and do 178db35f309SDavid Greenmanall IO between the 179db35f309SDavid Greenman.Em SCSI 1806d249eeeSSheldon Hearnbus and the system. 1816d249eeeSSheldon HearnThe maximum size of a transfer is governed by the 1826d249eeeSSheldon Hearnadapter. 1836d249eeeSSheldon HearnMost adapters can transfer 64KB in a single operation, however 184db35f309SDavid Greenmanmany can transfer larger amounts. 185db35f309SDavid Greenman.Sh TARGET MODE 186db35f309SDavid GreenmanSome adapters support 18789045423SKenneth D. Merry.Em target mode 188db35f309SDavid Greenmanin which the system is capable of operating as a device, responding to 1896d249eeeSSheldon Hearnoperations initiated by another system. 1906d249eeeSSheldon HearnTarget mode is supported for 19189045423SKenneth D. Merrysome adapters, but is not yet complete for this version of the CAM 19289045423SKenneth D. Merry.Tn SCSI 19389045423SKenneth D. Merrysubsystem. 194db35f309SDavid Greenman.Sh FILES 195db35f309SDavid Greenmansee other scsi device entries. 196db35f309SDavid Greenman.Sh DIAGNOSTICS 19789045423SKenneth D. MerryWhen the kernel is compiled with options CAMDEBUG, an XPT_DEBUG CCB can be 19889045423SKenneth D. Merryused to enable various amounts of tracing information on any 1996d249eeeSSheldon Hearnspecific device. 2006d249eeeSSheldon HearnDevices not being traced will not produce trace information. 20189045423SKenneth D. MerryThere are currently four debugging flags that may be turned on: 20289045423SKenneth D. Merry.Bl -tag -width CAM_DEBUG_SUBTRACE 20389045423SKenneth D. Merry.It Dv CAM_DEBUG_INFO 20489045423SKenneth D. MerryThis debugging flag enables general informational printfs for the device 20589045423SKenneth D. Merryor devices in question. 20689045423SKenneth D. Merry.It Dv CAM_DEBUG_TRACE 20789045423SKenneth D. MerryThis debugging flag enables function-level command flow tracing. i.e. 20889045423SKenneth D. Merrykernel printfs will happen at the entrance and exit of various functions. 20989045423SKenneth D. Merry.It Dv CAM_DEBUG_SUBTRACE 21089045423SKenneth D. MerryThis debugging flag enables debugging output internal to various functions. 21189045423SKenneth D. Merry.It Dv CAM_DEBUG_CDB 21289045423SKenneth D. MerryThis debugging flag will cause the kernel to print out all 21389045423SKenneth D. Merry.Tn SCSI 21489045423SKenneth D. Merrycommands sent to a particular device or devices. 215db35f309SDavid Greenman.El 21689045423SKenneth D. Merry.Pp 21789045423SKenneth D. MerrySome of these flags, most notably 21889045423SKenneth D. Merry.Dv CAM_DEBUG_TRACE 21989045423SKenneth D. Merryand 22089045423SKenneth D. Merry.Dv CAM_DEBUG_SUBTRACE 22189045423SKenneth D. Merrywill produce kernel printfs in EXTREME numbers. Because of that, they 22289045423SKenneth D. Merryaren't especially useful. There aren't many things logged at the 22389045423SKenneth D. Merry.Dv CAM_DEBUG_INFO 22489045423SKenneth D. Merrylevel, so it isn't especially useful. The most useful debugging flag is 22589045423SKenneth D. Merrythe 22689045423SKenneth D. Merry.Dv CAM_DEBUG_CDB 22789045423SKenneth D. Merryflag. Users can enable debugging from their kernel config file, by using 22889045423SKenneth D. Merrythe following kernel config options: 22989045423SKenneth D. Merry.Bl -tag -width CAM_DEBUG_TARGET 23089045423SKenneth D. Merry.It Dv CAMDEBUG 23189045423SKenneth D. MerryThis enables CAM debugging. Without this option, users will not even be able 23289045423SKenneth D. Merryto turn on debugging from userland via 23389045423SKenneth D. Merry.Xr camcontrol 8 . 23489045423SKenneth D. Merry.It Dv CAM_DEBUG_FLAGS 23589045423SKenneth D. MerryThis allows the user to set the various debugging flags described above 23689045423SKenneth D. Merryin a kernel config file. Flags may be ORed together if the user wishes to 23789045423SKenneth D. Merrysee printfs for multiple debugging levels. 23889045423SKenneth D. Merry.It Dv CAM_DEBUG_BUS 23989045423SKenneth D. MerrySpecify a bus to debug. To debug all busses, set this to -1. 24089045423SKenneth D. Merry.It Dv CAM_DEBUG_TARGET 24189045423SKenneth D. MerrySpecify a target to debug. To debug all targets, set this to -1. 24289045423SKenneth D. Merry.It Dv CAM_DEBUG_LUN 24389045423SKenneth D. MerrySpecify a lun to debug. To debug all luns, set this to -1. 24489045423SKenneth D. Merry.El 24589045423SKenneth D. Merry.Pp 24689045423SKenneth D. MerryWhen specifying a bus, target or lun to debug, you 24789045423SKenneth D. Merry.Em MUST 24889045423SKenneth D. Merryspecify all three bus/target/lun options above. Using wildcards, you 24989045423SKenneth D. Merryshould be able to enable debugging on most anything. 25089045423SKenneth D. Merry.Pp 25189045423SKenneth D. MerryUsers may also enable debugging printfs on the fly, if the 25289045423SKenneth D. Merry.Dv CAMDEBUG 25389045423SKenneth D. Merryoption is their config file, by using the 25489045423SKenneth D. Merry.Xr camcontrol 8 25589045423SKenneth D. Merryutility. See 25689045423SKenneth D. Merry.Xr camcontrol 8 25789045423SKenneth D. Merryfor details. 258db35f309SDavid Greenman.Sh SEE ALSO 259e0e5145cSWolfram Schneider.Xr aha 4 , 260e0e5145cSWolfram Schneider.Xr ahb 4 , 26189045423SKenneth D. Merry.Xr ahc 4 , 262e0e5145cSWolfram Schneider.Xr bt 4 , 2630b992c1dSWolfram Schneider.Xr cd 4 , 2640b992c1dSWolfram Schneider.Xr ch 4 , 26589045423SKenneth D. Merry.Xr da 4 , 26689045423SKenneth D. Merry.Xr pass 4 , 26789045423SKenneth D. Merry.Xr pt 4 , 26889045423SKenneth D. Merry.Xr sa 4 , 26989045423SKenneth D. Merry.Xr xpt 4 , 27089045423SKenneth D. Merry.Xr camcontrol 8 271db35f309SDavid Greenman.Sh HISTORY 27289045423SKenneth D. MerryThe CAM 27389045423SKenneth D. Merry.Tn SCSI 27489045423SKenneth D. Merrysubsystem first appeared in 27589045423SKenneth D. Merry.Fx 3.0 . 27689045423SKenneth D. Merry.Sh AUTHORS 277f4d874a1SRuslan Ermilov.An -nosplit 27889045423SKenneth D. MerryThe CAM 27989045423SKenneth D. Merry.Tn SCSI 280def37e7cSMike Pritchardsubsystem was written by 281def37e7cSMike Pritchard.An Justin Gibbs 282def37e7cSMike Pritchardand 283def37e7cSMike Pritchard.An Kenneth Merry . 284