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 293d45e180SRuslan Ermilov.Os 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" 36b9781e20SJeroen Ruigrok van der Werven.Cd "device cd" 37b9781e20SJeroen Ruigrok van der Werven.Cd "device ch" 38b9781e20SJeroen Ruigrok van der Werven.Cd "device da" 39b9781e20SJeroen Ruigrok van der Werven.Cd "device pass" 40b9781e20SJeroen Ruigrok van der Werven.Cd "device pt" 41b9781e20SJeroen Ruigrok van der Werven.Cd "device sa" 42547d4262SKazutaka YOKOTA.Cd "device ch" 433136363fSRuslan Ermilov.Cd "options CAMDEBUG" 443136363fSRuslan Ermilov.Cd "options CAM_DEBUG_BUS=-1" 453136363fSRuslan Ermilov.Cd "options CAM_DEBUG_TARGET=-1" 463136363fSRuslan Ermilov.Cd "options CAM_DEBUG_LUN=-1" 473136363fSRuslan Ermilov.Cd "options CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_CDB" 483136363fSRuslan Ermilov.Cd "options CAM_MAX_HIGHPOWER=4" 493136363fSRuslan Ermilov.Cd "options SCSI_NO_SENSE_STRINGS" 503136363fSRuslan Ermilov.Cd "options SCSI_NO_OP_STRINGS" 513136363fSRuslan Ermilov.Cd "options SCSI_DELAY=8000" 52db35f309SDavid Greenman.Sh DESCRIPTION 5389045423SKenneth D. MerryThe CAM 5489045423SKenneth D. Merry.Tn SCSI 5589045423SKenneth D. Merrysubsystem provides a uniform and modular system for the implementation 5689045423SKenneth D. Merryof drivers to control various 5789045423SKenneth D. Merry.Tn SCSI 5889045423SKenneth D. Merrydevices, and to utilize different 5989045423SKenneth D. Merry.Tn SCSI 606d249eeeSSheldon Hearnhost adapters through host adapter drivers. 616d249eeeSSheldon HearnWhen the system probes the 6289045423SKenneth D. Merry.Tn SCSI 63db35f309SDavid Greenmanbusses, it attaches any devices it finds to the appropriate 64b5e7e999SRuslan Ermilovdrivers. 65b5e7e999SRuslan ErmilovThe 6689045423SKenneth D. Merry.Xr pass 4 6789045423SKenneth D. Merrydriver, if it is configured in the kernel, will attach to all 6889045423SKenneth D. Merry.Tn SCSI 6989045423SKenneth D. Merrydevices. 70db35f309SDavid Greenman.Sh KERNEL CONFIGURATION 7189045423SKenneth D. MerryThere are a number of generic kernel configuration options for the 7289045423SKenneth D. MerryCAM 7389045423SKenneth D. Merry.Tn SCSI 7489045423SKenneth D. Merrysubsystem: 7589045423SKenneth D. Merry.Bl -tag -width SCSI_NO_SENSE_STRINGS 7689045423SKenneth D. Merry.It Dv CAMDEBUG 77b5e7e999SRuslan ErmilovThis option enables the CAM debugging printf code. 78b5e7e999SRuslan ErmilovThis won't actually 7989045423SKenneth D. Merrycause any debugging information to be printed out when included by itself. 80b5e7e999SRuslan ErmilovEnabling printouts requires additional configuration. 81b5e7e999SRuslan ErmilovSee below for details. 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 85b5e7e999SRuslan Ermilovmost to complete. 86b5e7e999SRuslan ErmilovAn example of this (and the only command currently 8789045423SKenneth D. Merrytagged as "high power") is the 8889045423SKenneth D. Merry.Tn SCSI 89b5e7e999SRuslan ErmilovSTART UNIT command. 90b5e7e999SRuslan ErmilovStarting a SCSI disk often takes significantly more 91b5e7e999SRuslan Ermilovelectrical power than normal operation of the disk. 92b5e7e999SRuslan ErmilovThis option allows the 9389045423SKenneth D. Merryuser to specify how many concurrent high power commands may be outstanding 9489045423SKenneth D. Merrywithout overloading the power supply on his computer. 9589045423SKenneth D. Merry.It Dv SCSI_NO_SENSE_STRINGS 9689045423SKenneth D. MerryThis eliminates text descriptions of each 9789045423SKenneth D. Merry.Tn SCSI 98b5e7e999SRuslan ErmilovAdditional Sense Code and Additional Sense Code Qualifier pair. 99b5e7e999SRuslan ErmilovSince this 10089045423SKenneth D. Merryis a fairly large text database, eliminating it reduces the size of the 101b5e7e999SRuslan Ermilovkernel somewhat. 102b5e7e999SRuslan ErmilovThis is primarily necessary for boot floppies and other 103b5e7e999SRuslan Ermilovlow disk space or low memory space environments. 104b5e7e999SRuslan ErmilovIn most cases, though, 10589045423SKenneth D. Merrythis should be enabled, since it speeds the interpretation of 10689045423SKenneth D. Merry.Tn SCSI 10789045423SKenneth D. Merryerror messages. Don't let the "kernel bloat" zealots get to you -- leave 10889045423SKenneth D. Merrythe sense descriptions in your kernel! 10989045423SKenneth D. Merry.It Dv SCSI_NO_OP_STRINGS 11089045423SKenneth D. MerryThis disables text descriptions of each 11189045423SKenneth D. Merry.Tn SCSI 112b5e7e999SRuslan Ermilovopcode. 113b5e7e999SRuslan ErmilovThis option, like the sense string option above, is primarily 11489045423SKenneth D. Merryuseful for environments like a boot floppy where kernel size is critical. 11589045423SKenneth D. MerryEnabling this option for normal use isn't recommended, since it slows 11689045423SKenneth D. Merrydebugging of 11789045423SKenneth D. Merry.Tn SCSI 11889045423SKenneth D. Merryproblems. 11989045423SKenneth D. Merry.It Dv SCSI_DELAY=8000 12089045423SKenneth D. MerryThis is the 12189045423SKenneth D. Merry.Tn SCSI 122b5e7e999SRuslan Ermilov"bus settle delay." 123b5e7e999SRuslan ErmilovIn CAM, it is specified in 12489045423SKenneth D. Merry.Em milliseconds , 12589045423SKenneth D. Merrynot seconds like the old 12689045423SKenneth D. Merry.Tn SCSI 127b5e7e999SRuslan Ermilovlayer used to do. 128b5e7e999SRuslan ErmilovWhen the kernel boots, it sends a bus reset to each 12989045423SKenneth D. Merry.Tn SCSI 13089045423SKenneth D. Merrybus to tell each device to reset itself to a default set of transfer 131b5e7e999SRuslan Ermilovnegotiations and other settings. 132b5e7e999SRuslan ErmilovMost 13389045423SKenneth D. Merry.Tn SCSI 134b5e7e999SRuslan Ermilovdevices need some amount of time to recover from a bus reset. 135b5e7e999SRuslan ErmilovNewer disks 13689045423SKenneth D. Merrymay need as little as 100ms, while old, slow devices may need much longer. 13789045423SKenneth D. MerryIf the 13889045423SKenneth D. Merry.Dv SCSI_DELAY 139b5e7e999SRuslan Ermilovisn't specified, it defaults to 2 seconds. 140b5e7e999SRuslan ErmilovThe minimum allowable value for 14189045423SKenneth D. Merry.Dv SCSI_DELAY 142b5e7e999SRuslan Ermilovis "100", or 100ms. 143b5e7e999SRuslan ErmilovOne special case is that if the 14489045423SKenneth D. Merry.Dv SCSI_DELAY 145b5e7e999SRuslan Ermilovis set to 0, that will be taken to mean the "lowest possible value." 146b5e7e999SRuslan ErmilovIn that case, the 14789045423SKenneth D. Merry.Dv SCSI_DELAY 14889045423SKenneth D. Merrywill be reset to 100ms. 14989045423SKenneth D. Merry.El 1502460bdf0SPeter Dufault.Pp 1512460bdf0SPeter DufaultAll devices and the SCSI busses support boot time allocation so that 1522460bdf0SPeter Dufaultan upper number of devices and controllers does not need to be configured; 15389045423SKenneth D. Merry.Cd "device da0" 1542460bdf0SPeter Dufaultwill suffice for any number of disk drivers. 1552460bdf0SPeter Dufault.Pp 1562460bdf0SPeter DufaultThe devices are either 1572460bdf0SPeter Dufault.Em wired 1582460bdf0SPeter Dufaultso they appear as a particular device unit or 1592460bdf0SPeter Dufault.Em counted 1602460bdf0SPeter Dufaultso that they appear as the next available unused unit. 1612460bdf0SPeter Dufault.Pp 1629ff00466SScott LongUnits are wired down by setting kernel environment hints. 1639ff00466SScott LongThis is usually done either interactively from the loader, or automatically via the 1649ff00466SScott Long.Pa /boot/device.hints 1659ff00466SScott Longfile. The basic syntax is: 1669ff00466SScott Long.Bd -literal -offset indent 1679ff00466SScott Longhint.device.unit.property="value" 1689ff00466SScott Long.Ed 1692460bdf0SPeter Dufault.Pp 1709ff00466SScott LongIndividual scsi bus numbers can be wired down to specific controllers with 1719ff00466SScott Longa config line similar to the following: 1729ff00466SScott Long.Bd -literal -offset indent 1739ff00466SScott Longhint.scbus.0.at="ahd1" 1749ff00466SScott Long.Ed 1759ff00466SScott Long.Pp 1769ff00466SScott LongThis assigns scsi bus number 0 to the 1779ff00466SScott Long.Em ahd1 1789ff00466SScott Longdriver instance. 1799ff00466SScott LongFor controllers supporting more than one bus, a particular bus can be assigned 1809ff00466SScott Longas follows: 1819ff00466SScott Long.Bd -literal -offset indent 1829ff00466SScott Longhint.scbus.0.at="ahc1" 1839ff00466SScott Longhint.scbus.0.bus="1" 1849ff00466SScott Long.Ed 1859ff00466SScott Long.Pp 1869ff00466SScott LongThis assigns scsi bus 0 to the bus 1 instance on 1879ff00466SScott Long.Em ahc0 . 1889ff00466SScott LongPeripheral drivers can be wired to a specific bus, target, and lun as so: 1899ff00466SScott Long.Bd -literal -offset indent 1909ff00466SScott Longhint.da.0.at="scbus0" 1919ff00466SScott Longhint.da.0.target="0" 1929ff00466SScott Longhint.da.0.unit="0" 1939ff00466SScott Long.Ed 1949ff00466SScott Long.Pp 1959ff00466SScott LongThis assigns 1969ff00466SScott Long.Em da0 1979ff00466SScott Longto target 0, unit (lun) 0 of scbus 0. 1989ff00466SScott LongOmitting the target or unit hints will instruct CAM to treat them as wildcards 1999ff00466SScott Longand use the first respective counted instances. 2009ff00466SScott LongThese examples can be combined together to allow a peripheral device to be 2019ff00466SScott Longwired to any particular controller, bus, target, and/or unit instance. 2022460bdf0SPeter Dufault.Pp 2032460bdf0SPeter DufaultWhen you have a mixture of wired down and counted devices then the 2042460bdf0SPeter Dufaultcounting begins with the first non-wired down unit for a particular 205b5e7e999SRuslan Ermilovtype. 206b5e7e999SRuslan ErmilovThat is, if you have a disk wired down as 20789045423SKenneth D. Merry.Em "device da1" , 2082460bdf0SPeter Dufaultthen the first non-wired disk shall come on line as 20989045423SKenneth D. Merry.Em da2 . 210db35f309SDavid Greenman.Sh ADAPTERS 211db35f309SDavid GreenmanThe system allows common device drivers to work through many different 2126d249eeeSSheldon Hearntypes of adapters. 2136d249eeeSSheldon HearnThe adapters take requests from the upper layers and do 214db35f309SDavid Greenmanall IO between the 215db35f309SDavid Greenman.Em SCSI 2166d249eeeSSheldon Hearnbus and the system. 2176d249eeeSSheldon HearnThe maximum size of a transfer is governed by the 2186d249eeeSSheldon Hearnadapter. 2196d249eeeSSheldon HearnMost adapters can transfer 64KB in a single operation, however 220db35f309SDavid Greenmanmany can transfer larger amounts. 221db35f309SDavid Greenman.Sh TARGET MODE 222db35f309SDavid GreenmanSome adapters support 22389045423SKenneth D. Merry.Em target mode 224db35f309SDavid Greenmanin which the system is capable of operating as a device, responding to 2256d249eeeSSheldon Hearnoperations initiated by another system. 2266d249eeeSSheldon HearnTarget mode is supported for 22789045423SKenneth D. Merrysome adapters, but is not yet complete for this version of the CAM 22889045423SKenneth D. Merry.Tn SCSI 22989045423SKenneth D. Merrysubsystem. 230db35f309SDavid Greenman.Sh FILES 231db35f309SDavid Greenmansee other scsi device entries. 232db35f309SDavid Greenman.Sh DIAGNOSTICS 23389045423SKenneth D. MerryWhen the kernel is compiled with options CAMDEBUG, an XPT_DEBUG CCB can be 23489045423SKenneth D. Merryused to enable various amounts of tracing information on any 2356d249eeeSSheldon Hearnspecific device. 2366d249eeeSSheldon HearnDevices not being traced will not produce trace information. 23789045423SKenneth D. MerryThere are currently four debugging flags that may be turned on: 23889045423SKenneth D. Merry.Bl -tag -width CAM_DEBUG_SUBTRACE 23989045423SKenneth D. Merry.It Dv CAM_DEBUG_INFO 24089045423SKenneth D. MerryThis debugging flag enables general informational printfs for the device 24189045423SKenneth D. Merryor devices in question. 24289045423SKenneth D. Merry.It Dv CAM_DEBUG_TRACE 24357e4378bSRuslan ErmilovThis debugging flag enables function-level command flow tracing. i.e.\& 24489045423SKenneth D. Merrykernel printfs will happen at the entrance and exit of various functions. 24589045423SKenneth D. Merry.It Dv CAM_DEBUG_SUBTRACE 24689045423SKenneth D. MerryThis debugging flag enables debugging output internal to various functions. 24789045423SKenneth D. Merry.It Dv CAM_DEBUG_CDB 24889045423SKenneth D. MerryThis debugging flag will cause the kernel to print out all 24989045423SKenneth D. Merry.Tn SCSI 25089045423SKenneth D. Merrycommands sent to a particular device or devices. 251db35f309SDavid Greenman.El 25289045423SKenneth D. Merry.Pp 25389045423SKenneth D. MerrySome of these flags, most notably 25489045423SKenneth D. Merry.Dv CAM_DEBUG_TRACE 25589045423SKenneth D. Merryand 25689045423SKenneth D. Merry.Dv CAM_DEBUG_SUBTRACE 257b5e7e999SRuslan Ermilovwill produce kernel printfs in EXTREME numbers, 258b5e7e999SRuslan Ermilovand because of that, they aren't especially useful. 259b5e7e999SRuslan ErmilovThere aren't many things logged at the 26089045423SKenneth D. Merry.Dv CAM_DEBUG_INFO 261b5e7e999SRuslan Ermilovlevel, so it isn't especially useful. 262b5e7e999SRuslan ErmilovThe most useful debugging flag is the 26389045423SKenneth D. Merry.Dv CAM_DEBUG_CDB 26489045423SKenneth D. Merryflag. Users can enable debugging from their kernel config file, by using 26589045423SKenneth D. Merrythe following kernel config options: 26689045423SKenneth D. Merry.Bl -tag -width CAM_DEBUG_TARGET 26789045423SKenneth D. Merry.It Dv CAMDEBUG 268b5e7e999SRuslan ErmilovThis enables CAM debugging. 269b5e7e999SRuslan ErmilovWithout this option, users will not even be able 27089045423SKenneth D. Merryto turn on debugging from userland via 27189045423SKenneth D. Merry.Xr camcontrol 8 . 27289045423SKenneth D. Merry.It Dv CAM_DEBUG_FLAGS 27389045423SKenneth D. MerryThis allows the user to set the various debugging flags described above 274b5e7e999SRuslan Ermilovin a kernel config file. 275b5e7e999SRuslan ErmilovFlags may be ORed together if the user wishes to 27689045423SKenneth D. Merrysee printfs for multiple debugging levels. 27789045423SKenneth D. Merry.It Dv CAM_DEBUG_BUS 278b5e7e999SRuslan ErmilovSpecify a bus to debug. 279b5e7e999SRuslan ErmilovTo debug all busses, set this to -1. 28089045423SKenneth D. Merry.It Dv CAM_DEBUG_TARGET 281b5e7e999SRuslan ErmilovSpecify a target to debug. 282b5e7e999SRuslan ErmilovTo debug all targets, set this to -1. 28389045423SKenneth D. Merry.It Dv CAM_DEBUG_LUN 284b5e7e999SRuslan ErmilovSpecify a lun to debug. 285b5e7e999SRuslan ErmilovTo debug all luns, set this to -1. 28689045423SKenneth D. Merry.El 28789045423SKenneth D. Merry.Pp 28889045423SKenneth D. MerryWhen specifying a bus, target or lun to debug, you 28989045423SKenneth D. Merry.Em MUST 290b5e7e999SRuslan Ermilovspecify all three bus/target/lun options above. 291b5e7e999SRuslan ErmilovUsing wildcards, you 29289045423SKenneth D. Merryshould be able to enable debugging on most anything. 29389045423SKenneth D. Merry.Pp 29489045423SKenneth D. MerryUsers may also enable debugging printfs on the fly, if the 29589045423SKenneth D. Merry.Dv CAMDEBUG 29689045423SKenneth D. Merryoption is their config file, by using the 29789045423SKenneth D. Merry.Xr camcontrol 8 29889045423SKenneth D. Merryutility. See 29989045423SKenneth D. Merry.Xr camcontrol 8 30089045423SKenneth D. Merryfor details. 301db35f309SDavid Greenman.Sh SEE ALSO 302e0e5145cSWolfram Schneider.Xr aha 4 , 303e0e5145cSWolfram Schneider.Xr ahb 4 , 30489045423SKenneth D. Merry.Xr ahc 4 , 305e0e5145cSWolfram Schneider.Xr bt 4 , 3060b992c1dSWolfram Schneider.Xr cd 4 , 3070b992c1dSWolfram Schneider.Xr ch 4 , 30889045423SKenneth D. Merry.Xr da 4 , 30989045423SKenneth D. Merry.Xr pass 4 , 31089045423SKenneth D. Merry.Xr pt 4 , 31189045423SKenneth D. Merry.Xr sa 4 , 31289045423SKenneth D. Merry.Xr xpt 4 , 31389045423SKenneth D. Merry.Xr camcontrol 8 314db35f309SDavid Greenman.Sh HISTORY 31589045423SKenneth D. MerryThe CAM 31689045423SKenneth D. Merry.Tn SCSI 31789045423SKenneth D. Merrysubsystem first appeared in 31889045423SKenneth D. Merry.Fx 3.0 . 31989045423SKenneth D. Merry.Sh AUTHORS 320f4d874a1SRuslan Ermilov.An -nosplit 32189045423SKenneth D. MerryThe CAM 32289045423SKenneth D. Merry.Tn SCSI 323def37e7cSMike Pritchardsubsystem was written by 324def37e7cSMike Pritchard.An Justin Gibbs 325def37e7cSMike Pritchardand 326def37e7cSMike Pritchard.An Kenneth Merry . 327