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. 259ab58f97SWarner Losh.Dd December 11, 2023 266d6d0ae4SAlexander Motin.Dt CAM 4 273d45e180SRuslan Ermilov.Os 28db35f309SDavid Greenman.Sh NAME 2989045423SKenneth D. Merry.Nm CAM 304d21bbd1SWarner Losh.Nd Common Access Method Storage subsystem 31db35f309SDavid Greenman.Sh SYNOPSIS 32b9781e20SJeroen Ruigrok van der Werven.Cd "device scbus" 336d6d0ae4SAlexander Motin.Cd "device ada" 34b9781e20SJeroen Ruigrok van der Werven.Cd "device cd" 35b9781e20SJeroen Ruigrok van der Werven.Cd "device ch" 36b9781e20SJeroen Ruigrok van der Werven.Cd "device da" 37b9781e20SJeroen Ruigrok van der Werven.Cd "device pass" 38b9781e20SJeroen Ruigrok van der Werven.Cd "device pt" 39b9781e20SJeroen Ruigrok van der Werven.Cd "device sa" 403136363fSRuslan Ermilov.Cd "options CAMDEBUG" 413136363fSRuslan Ermilov.Cd "options CAM_DEBUG_BUS=-1" 423136363fSRuslan Ermilov.Cd "options CAM_DEBUG_TARGET=-1" 433136363fSRuslan Ermilov.Cd "options CAM_DEBUG_LUN=-1" 44f0f25b9cSAlexander Motin.Cd "options CAM_DEBUG_COMPILE=CAM_DEBUG_INFO|CAM_DEBUG_CDB|CAM_DEBUG_PROBE" 453136363fSRuslan Ermilov.Cd "options CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_CDB" 463136363fSRuslan Ermilov.Cd "options CAM_MAX_HIGHPOWER=4" 473136363fSRuslan Ermilov.Cd "options SCSI_NO_SENSE_STRINGS" 483136363fSRuslan Ermilov.Cd "options SCSI_NO_OP_STRINGS" 493136363fSRuslan Ermilov.Cd "options SCSI_DELAY=8000" 50db35f309SDavid Greenman.Sh DESCRIPTION 516d6d0ae4SAlexander MotinThe 526d6d0ae4SAlexander Motin.Nm 5389045423SKenneth D. Merrysubsystem provides a uniform and modular system for the implementation 5489045423SKenneth D. Merryof drivers to control various 555ee9f050SWarner Losh.Tn SCSI , 565ee9f050SWarner Losh.Tn ATA , 5778840118SMitchell Horne.Tn NVMe , 586d6d0ae4SAlexander Motinand 595ee9f050SWarner Losh.Tn MMC / SD 6089045423SKenneth D. Merrydevices, and to utilize different 615ee9f050SWarner Losh.Tn SCSI , 625ee9f050SWarner Losh.Tn ATA , 635ee9f050SWarner Losh.Tn NVMe , 646d6d0ae4SAlexander Motinand 655ee9f050SWarner Losh.Tn MMC / SD 666d249eeeSSheldon Hearnhost adapters through host adapter drivers. 67db4fcadfSConrad MeyerWhen the system probes buses, it attaches any devices it finds to the 686d6d0ae4SAlexander Motinappropriate drivers. 69b5e7e999SRuslan ErmilovThe 7089045423SKenneth D. Merry.Xr pass 4 716d6d0ae4SAlexander Motindriver, if it is configured in the kernel, will attach to all devices. 72db35f309SDavid Greenman.Sh KERNEL CONFIGURATION 7389045423SKenneth D. MerryThere are a number of generic kernel configuration options for the 746d6d0ae4SAlexander Motin.Nm 7589045423SKenneth D. Merrysubsystem: 7689045423SKenneth D. Merry.Bl -tag -width SCSI_NO_SENSE_STRINGS 775da3d601SWarner Losh.It Dv CAM_BOOT_DELAY 785da3d601SWarner LoshAdditional time to wait after the static parts of the kernel have run to allow 795da3d601SWarner Loshfor discovery of additional devices which may take time to connect, 805da3d601SWarner Loshsuch as USB attached storage. 815da3d601SWarner Losh.It Dv CAM_IOSCHED_DYNAMIC 825da3d601SWarner LoshEnable dynamic decisions in the I/O scheduler based on hints and the current 835da3d601SWarner Loshperformance of the storage devices. 845da3d601SWarner Losh.It Dv CAM_IO_STATS 855da3d601SWarner LoshEnable collection of statistics for periph devices. 865da3d601SWarner Losh.It Dv CAM_TEST_FAILURE 875da3d601SWarner LoshEnable ability to simulate I/O failures. 8889045423SKenneth D. Merry.It Dv CAMDEBUG 89f0f25b9cSAlexander MotinThis option compiles in all the 906d6d0ae4SAlexander Motin.Nm 916d6d0ae4SAlexander Motindebugging printf code. 920227791bSRuslan ErmilovThis will not actually 9389045423SKenneth D. Merrycause any debugging information to be printed out when included by itself. 94b5e7e999SRuslan ErmilovSee below for details. 9589045423SKenneth D. Merry.It Dv "CAM_MAX_HIGHPOWER=4" 9689045423SKenneth D. MerryThis sets the maximum allowable number of concurrent "high power" commands. 9789045423SKenneth D. MerryA "high power" command is a command that takes more electrical power than 98b5e7e999SRuslan Ermilovmost to complete. 996d6d0ae4SAlexander MotinAn example of this is the 10089045423SKenneth D. Merry.Tn SCSI 101b5e7e999SRuslan ErmilovSTART UNIT command. 1026d6d0ae4SAlexander MotinStarting a disk often takes significantly more electrical power than normal 1036d6d0ae4SAlexander Motinoperation. 104b5e7e999SRuslan ErmilovThis option allows the 10589045423SKenneth D. Merryuser to specify how many concurrent high power commands may be outstanding 10689045423SKenneth D. Merrywithout overloading the power supply on his computer. 10789045423SKenneth D. Merry.It Dv SCSI_NO_SENSE_STRINGS 10889045423SKenneth D. MerryThis eliminates text descriptions of each 10989045423SKenneth D. Merry.Tn SCSI 110b5e7e999SRuslan ErmilovAdditional Sense Code and Additional Sense Code Qualifier pair. 111b5e7e999SRuslan ErmilovSince this 11289045423SKenneth D. Merryis a fairly large text database, eliminating it reduces the size of the 113b5e7e999SRuslan Ermilovkernel somewhat. 114b5e7e999SRuslan ErmilovThis is primarily necessary for boot floppies and other 115b5e7e999SRuslan Ermilovlow disk space or low memory space environments. 116b5e7e999SRuslan ErmilovIn most cases, though, 11789045423SKenneth D. Merrythis should be enabled, since it speeds the interpretation of 11889045423SKenneth D. Merry.Tn SCSI 1195203edcdSRuslan Ermiloverror messages. 1200227791bSRuslan ErmilovDo not let the "kernel bloat" zealots get to you -- leave 12189045423SKenneth D. Merrythe sense descriptions in your kernel! 12289045423SKenneth D. Merry.It Dv SCSI_NO_OP_STRINGS 12389045423SKenneth D. MerryThis disables text descriptions of each 12489045423SKenneth D. Merry.Tn SCSI 125b5e7e999SRuslan Ermilovopcode. 126b5e7e999SRuslan ErmilovThis option, like the sense string option above, is primarily 12789045423SKenneth D. Merryuseful for environments like a boot floppy where kernel size is critical. 1280227791bSRuslan ErmilovEnabling this option for normal use is not recommended, since it slows 12989045423SKenneth D. Merrydebugging of 13089045423SKenneth D. Merry.Tn SCSI 13189045423SKenneth D. Merryproblems. 13289045423SKenneth D. Merry.It Dv SCSI_DELAY=8000 13389045423SKenneth D. MerryThis is the 13489045423SKenneth D. Merry.Tn SCSI 135b5e7e999SRuslan Ermilov"bus settle delay." 1366d6d0ae4SAlexander MotinIn 1376d6d0ae4SAlexander Motin.Nm , 1386d6d0ae4SAlexander Motinit is specified in 13989045423SKenneth D. Merry.Em milliseconds , 14089045423SKenneth D. Merrynot seconds like the old 14189045423SKenneth D. Merry.Tn SCSI 142b5e7e999SRuslan Ermilovlayer used to do. 143b5e7e999SRuslan ErmilovWhen the kernel boots, it sends a bus reset to each 14489045423SKenneth D. Merry.Tn SCSI 14589045423SKenneth D. Merrybus to tell each device to reset itself to a default set of transfer 146b5e7e999SRuslan Ermilovnegotiations and other settings. 147b5e7e999SRuslan ErmilovMost 14889045423SKenneth D. Merry.Tn SCSI 149b5e7e999SRuslan Ermilovdevices need some amount of time to recover from a bus reset. 150b5e7e999SRuslan ErmilovNewer disks 15189045423SKenneth D. Merrymay need as little as 100ms, while old, slow devices may need much longer. 15289045423SKenneth D. MerryIf the 15389045423SKenneth D. Merry.Dv SCSI_DELAY 1540227791bSRuslan Ermilovis not specified, it defaults to 2 seconds. 155b5e7e999SRuslan ErmilovThe minimum allowable value for 15689045423SKenneth D. Merry.Dv SCSI_DELAY 157b5e7e999SRuslan Ermilovis "100", or 100ms. 158b5e7e999SRuslan ErmilovOne special case is that if the 15989045423SKenneth D. Merry.Dv SCSI_DELAY 160b5e7e999SRuslan Ermilovis set to 0, that will be taken to mean the "lowest possible value." 161b5e7e999SRuslan ErmilovIn that case, the 16289045423SKenneth D. Merry.Dv SCSI_DELAY 16389045423SKenneth D. Merrywill be reset to 100ms. 16489045423SKenneth D. Merry.El 1652460bdf0SPeter Dufault.Pp 166db4fcadfSConrad MeyerAll devices and buses support dynamic allocation so that 1672460bdf0SPeter Dufaultan upper number of devices and controllers does not need to be configured; 168f5a8c129SJuli Mallett.Cd "device da" 1692460bdf0SPeter Dufaultwill suffice for any number of disk drivers. 1702460bdf0SPeter Dufault.Pp 1712460bdf0SPeter DufaultThe devices are either 1722460bdf0SPeter Dufault.Em wired 1732460bdf0SPeter Dufaultso they appear as a particular device unit or 1742460bdf0SPeter Dufault.Em counted 1752460bdf0SPeter Dufaultso that they appear as the next available unused unit. 1762460bdf0SPeter Dufault.Pp 1779ff00466SScott LongUnits are wired down by setting kernel environment hints. 1785203edcdSRuslan ErmilovThis is usually done either interactively from the 1795203edcdSRuslan Ermilov.Xr loader 8 , 1805203edcdSRuslan Ermilovor automatically via the 1819ff00466SScott Long.Pa /boot/device.hints 1825203edcdSRuslan Ermilovfile. 1835203edcdSRuslan ErmilovThe basic syntax is: 1849ff00466SScott Long.Bd -literal -offset indent 1859ff00466SScott Longhint.device.unit.property="value" 1869ff00466SScott Long.Ed 1872460bdf0SPeter Dufault.Pp 1885203edcdSRuslan ErmilovIndividual 1895203edcdSRuslan Ermilov.Nm 1905203edcdSRuslan Ermilovbus numbers can be wired down to specific controllers with 1919ff00466SScott Longa config line similar to the following: 1929ff00466SScott Long.Bd -literal -offset indent 193*3fbed932SWarner Loshhint.scbus.0.at="mpr1" 1949ff00466SScott Long.Ed 1959ff00466SScott Long.Pp 1965203edcdSRuslan ErmilovThis assigns 1975203edcdSRuslan Ermilov.Nm 1985203edcdSRuslan Ermilovbus number 0 to the 199*3fbed932SWarner Losh.Em mpr1 2009ff00466SScott Longdriver instance. 2019ff00466SScott LongFor controllers supporting more than one bus, a particular bus can be assigned 2029ff00466SScott Longas follows: 2039ff00466SScott Long.Bd -literal -offset indent 204*3fbed932SWarner Loshhint.scbus.0.at="ahci1" 2059ff00466SScott Longhint.scbus.0.bus="1" 2069ff00466SScott Long.Ed 2079ff00466SScott Long.Pp 2085203edcdSRuslan ErmilovThis assigns 2095203edcdSRuslan Ermilov.Nm 2105203edcdSRuslan Ermilovbus 0 to the bus 1 instance on 211*3fbed932SWarner Losh.Em ahci1 . 2129ff00466SScott LongPeripheral drivers can be wired to a specific bus, target, and lun as so: 2139ff00466SScott Long.Bd -literal -offset indent 2149ff00466SScott Longhint.da.0.at="scbus0" 2159ff00466SScott Longhint.da.0.target="0" 216c2909b0cSTom Hukinshint.da.0.lun="0" 2179ff00466SScott Long.Ed 2189ff00466SScott Long.Pp 2199ff00466SScott LongThis assigns 2209ff00466SScott Long.Em da0 2219ff00466SScott Longto target 0, unit (lun) 0 of scbus 0. 2226d6d0ae4SAlexander MotinOmitting the target or unit hints will instruct 2236d6d0ae4SAlexander Motin.Nm 2246d6d0ae4SAlexander Motinto treat them as wildcards 2259ff00466SScott Longand use the first respective counted instances. 2269ff00466SScott LongThese examples can be combined together to allow a peripheral device to be 2279ff00466SScott Longwired to any particular controller, bus, target, and/or unit instance. 2282460bdf0SPeter Dufault.Pp 2295ee9f050SWarner LoshThis also works with 2305ee9f050SWarner Losh.Xr nvme 4 231576b06d7STom Hukinsdrives. 2325ee9f050SWarner Losh.Bd -literal -offset indent 2335ee9f050SWarner Loshhint.nvme.4.at="pci7:0:0" 2345ee9f050SWarner Loshhint.scbus.10.at="nvme4" 2355ee9f050SWarner Loshhint.nda.10.at="scbus10" 2365ee9f050SWarner Loshhint.nda.10.target="1" 237c2909b0cSTom Hukinshint.nda.10.lun="12" 2385ee9f050SWarner Loshhint.nda.11.at="scbus10" 2395ee9f050SWarner Loshhint.nda.11.target="1" 240c2909b0cSTom Hukinshint.nda.11.lun="2" 2415ee9f050SWarner Losh.Ed 2425ee9f050SWarner Losh.Pp 243576b06d7STom HukinsThis assigns the NVMe card at PCI bus 7 slot 0 function 1 to scbus 10. 2445ee9f050SWarner LoshThe target for 2455ee9f050SWarner Losh.Xr nda 4 2465ee9f050SWarner Loshdevices is always 1. 2475ee9f050SWarner LoshThe unit is the namespace identifier from the drive. 2485ee9f050SWarner LoshThe namespace id 1 is exported as 24915d4459cSWarner Losh.Em nda10 2505ee9f050SWarner Loshand namespace id 2 is exported as 25115d4459cSWarner Losh.Em nda11 . 25215d4459cSWarner Losh.Pp 25315d4459cSWarner LoshFor devices that provide a serial number, units may be wired to that serial 25415d4459cSWarner Loshnumber without regard where the drive is attached: 25515d4459cSWarner Losh.Bd -literal -offset indent 25615d4459cSWarner Loshhint.nda.3.sn="CY0AN07101120B12P" 25715d4459cSWarner Loshhint.da.44.sn="143282400011" 25815d4459cSWarner Loshhint.ada.2.sn="A065D591" 25915d4459cSWarner Losh.Ed 26015d4459cSWarner Loshwires 26115d4459cSWarner Losh.Em nda3 , 26215d4459cSWarner Losh.Em da44 , 26315d4459cSWarner Loshand 26415d4459cSWarner Losh.Em ada2 26515d4459cSWarner Loshto drives with the specified serial numbers. 26615d4459cSWarner LoshOne need not specify an 26715d4459cSWarner Losh.Em at 26815d4459cSWarner Loshline when serial numbers are used. 269db35f309SDavid Greenman.Sh ADAPTERS 270db35f309SDavid GreenmanThe system allows common device drivers to work through many different 2716d249eeeSSheldon Hearntypes of adapters. 2726d249eeeSSheldon HearnThe adapters take requests from the upper layers and do 273db35f309SDavid Greenmanall IO between the 2745ee9f050SWarner Losh.Tn SCSI , 2755ee9f050SWarner Losh.Tn ATA , 2765ee9f050SWarner Losh.Tn NVMe , 2776d6d0ae4SAlexander Motinor 2785ee9f050SWarner Losh.Tn MMC / SD 2796d249eeeSSheldon Hearnbus and the system. 2806d249eeeSSheldon HearnThe maximum size of a transfer is governed by the 2816d249eeeSSheldon Hearnadapter. 282*3fbed932SWarner LoshMost adapters can transfer 1MB in a single operation, however 283db35f309SDavid Greenmanmany can transfer larger amounts. 284db35f309SDavid Greenman.Sh TARGET MODE 285db35f309SDavid GreenmanSome adapters support 28689045423SKenneth D. Merry.Em target mode 287db35f309SDavid Greenmanin which the system is capable of operating as a device, responding to 2886d249eeeSSheldon Hearnoperations initiated by another system. 2896d249eeeSSheldon HearnTarget mode is supported for 2906d6d0ae4SAlexander Motinsome adapters, but is not yet complete for this version of the 2916d6d0ae4SAlexander Motin.Nm 29289045423SKenneth D. Merry.Tn SCSI 29389045423SKenneth D. Merrysubsystem. 2945da3d601SWarner Losh.Sh ARCHITECTURE 2955da3d601SWarner LoshThe 2965da3d601SWarner Losh.Nm 2975da3d601SWarner Loshsubsystem glues together the upper layers of the system to the storage devices. 2985da3d601SWarner LoshPERIPH devices accept storage requests from GEOM and other upper layers of the 2995da3d601SWarner Loshsystem and translates them into protocol requests. 3005da3d601SWarner LoshXPT (transport) dispatches these protocol requests to a SIM driver. 3015da3d601SWarner LoshA SIM driver takes protocol requests and translates them into hardware commands 3025da3d601SWarner Loshthe host adapter understands to transfer the protocol requests, and data (if 3035da3d601SWarner Loshany) to the storage device. 3045da3d601SWarner LoshThe CCB transports these requests around as messages. 3055da3d601SWarner Losh.Ss CAM 3065da3d601SWarner LoshThe Common Access Method was a standard defined in the 1990s to talk to disk 3075da3d601SWarner Loshdrives. 3085da3d601SWarner Losh.Fx 3095da3d601SWarner Loshis one of the few operating systems to fully implement this model. 3105da3d601SWarner LoshThe interface between different parts of CAM is the CCB (or CAM Control Block). 3115da3d601SWarner LoshEach CCB has a standard header, which contains the type of request and dispatch 3125da3d601SWarner Loshinformation, and a command specific portion. 3135da3d601SWarner LoshA CAM Periph generates requests. 3145da3d601SWarner LoshThe XPT layer dispatches these requests to the appropriate SIM. 3155da3d601SWarner LoshSome CCBs are sent directly to the SIM for immediate processing, while others 3165da3d601SWarner Loshare queued and complete when the I/O has finished. 3175da3d601SWarner LoshA SIM takes CCBs and translates them into hardware specific commands to push the 3185da3d601SWarner LoshSCSI CDB or other protocol control block to the peripheral, along with setting 3195da3d601SWarner Loshup the DMA for the associated data. 3205da3d601SWarner Losh.Ss Periph Devices 3215da3d601SWarner LoshA periph driver knows how to translate standard requests into protocol messages 3225da3d601SWarner Loshthat a SIM can deliver to hardware. 3235da3d601SWarner LoshThese requests can come from any upper layer source, but primarily come in via 3245da3d601SWarner LoshGEOM as a bio request. 3255da3d601SWarner LoshThey can also come in directly from character device requests for tapes and pass 3265da3d601SWarner Loshthrough commands. 3275da3d601SWarner Losh.Pp 3285da3d601SWarner LoshDisk devices, or direct access (da) in CAM, are one type of peripheral. 3295da3d601SWarner LoshThese devices present themselves to the kernel a device ending in 3305da3d601SWarner Losh.Dq da . 3315da3d601SWarner LoshEach protocol has a unique device name: 3325da3d601SWarner Losh.Bl -tag -width 4 3335da3d601SWarner Losh.It Xr da 4 3345da3d601SWarner LoshSCSI or SAS device, or devices that accept SCSI CDBs for I/O. 3355da3d601SWarner Losh.It Xr ada 4 3365da3d601SWarner LoshATA or SATA device 3375da3d601SWarner Losh.It Xr nda 4 3385da3d601SWarner LoshNVME device 33973a8c900SWarner Losh.It Xr sdda 4 3405da3d601SWarner LoshAn SD or MMC block storage device. 3415da3d601SWarner Losh.El 3425da3d601SWarner Losh.Pp 3435da3d601SWarner LoshTape devices are called serial access 3445da3d601SWarner Losh.Po 3455da3d601SWarner Losh.Xr sa 4 3465da3d601SWarner Losh.Pc 3475da3d601SWarner Loshin CAM. 3485da3d601SWarner LoshThey interface to the system via a character device and provide 3495da3d601SWarner Losh.Xr ioctl 2 3505da3d601SWarner Loshcontrol for tape drives. 3515da3d601SWarner Losh.Pp 3525da3d601SWarner LoshThe 3535da3d601SWarner Losh.Xr pass 4 3545da3d601SWarner Loshdevice will pass through CCB requests from userland to the SIM directly. 3555da3d601SWarner LoshThe device is used to send commands other than read, write, trim or flush to a 3565da3d601SWarner Loshdevice. 3575da3d601SWarner LoshThe 3585da3d601SWarner Losh.Xr camcontrol 8 3595da3d601SWarner Loshcommand uses this device. 3605da3d601SWarner Losh.Ss XPT drivers 3615da3d601SWarner LoshThe transport driver connects the periph to the SIM. 3625da3d601SWarner LoshIt is not configured separately. 3635da3d601SWarner LoshIt is also responsible for device discovery for those SIM drivers that do not 3645da3d601SWarner Loshenumerate themselves. 3655da3d601SWarner Losh.Ss SIM driver 3665da3d601SWarner LoshSIM used to stand for SCSI Interface Module. 3675da3d601SWarner LoshNow it is just SIM because it understands protocols other than SCSI. 3685da3d601SWarner LoshThere are two types of SIM drivers: virtual and physical. 3695da3d601SWarner LoshPhysical SIMs are typically called host bus adapters (HBA), but not universally. 3709ab58f97SWarner LoshVirtual SIM drivers are for communicating with network or virtual machine hosts. 371db35f309SDavid Greenman.Sh FILES 3725203edcdSRuslan Ermilovsee other 3735203edcdSRuslan Ermilov.Nm 3745203edcdSRuslan Ermilovdevice entries. 375db35f309SDavid Greenman.Sh DIAGNOSTICS 376f0f25b9cSAlexander MotinAn XPT_DEBUG CCB can be used to enable various amounts of tracing information 377f0f25b9cSAlexander Motinon any specific bus/device from the list of options compiled into the kernel. 378f0f25b9cSAlexander MotinThere are currently seven debugging flags that may be compiled in and used: 37989045423SKenneth D. Merry.Bl -tag -width CAM_DEBUG_SUBTRACE 38089045423SKenneth D. Merry.It Dv CAM_DEBUG_INFO 381f0f25b9cSAlexander MotinThis flag enables general informational printfs for the device 38289045423SKenneth D. Merryor devices in question. 38389045423SKenneth D. Merry.It Dv CAM_DEBUG_TRACE 384906671dbSEnji CooperThis flag enables function-level command flow tracing i.e., 38589045423SKenneth D. Merrykernel printfs will happen at the entrance and exit of various functions. 38689045423SKenneth D. Merry.It Dv CAM_DEBUG_SUBTRACE 387f0f25b9cSAlexander MotinThis flag enables debugging output internal to various functions. 38889045423SKenneth D. Merry.It Dv CAM_DEBUG_CDB 389f0f25b9cSAlexander MotinThis flag will cause the kernel to print out all 390f0f25b9cSAlexander Motin.Tn ATA 391f0f25b9cSAlexander Motinand 39289045423SKenneth D. Merry.Tn SCSI 39389045423SKenneth D. Merrycommands sent to a particular device or devices. 394f0f25b9cSAlexander Motin.It Dv CAM_DEBUG_XPT 395f0f25b9cSAlexander MotinThis flag will enable command scheduler tracing. 396f0f25b9cSAlexander Motin.It Dv CAM_DEBUG_PERIPH 397f0f25b9cSAlexander MotinThis flag will enable peripheral drivers messages. 398f0f25b9cSAlexander Motin.It Dv CAM_DEBUG_PROBE 399f0f25b9cSAlexander MotinThis flag will enable devices probe process tracing. 400db35f309SDavid Greenman.El 40189045423SKenneth D. Merry.Pp 40289045423SKenneth D. MerrySome of these flags, most notably 40389045423SKenneth D. Merry.Dv CAM_DEBUG_TRACE 40489045423SKenneth D. Merryand 405f0f25b9cSAlexander Motin.Dv CAM_DEBUG_SUBTRACE , 406f0f25b9cSAlexander Motinwill produce kernel printfs in EXTREME numbers. 407f0f25b9cSAlexander Motin.Pp 4085203edcdSRuslan ErmilovUsers can enable debugging from their kernel config file, by using 40989045423SKenneth D. Merrythe following kernel config options: 410f0f25b9cSAlexander Motin.Bl -tag -width CAM_DEBUG_COMPILE 41189045423SKenneth D. Merry.It Dv CAMDEBUG 412f0f25b9cSAlexander MotinThis builds into the kernel all possible 4136d6d0ae4SAlexander Motin.Nm 4146d6d0ae4SAlexander Motindebugging. 415f0f25b9cSAlexander Motin.It Dv CAM_DEBUG_COMPILE 4165da3d601SWarner LoshThis specifies support for which debugging flags described above 417f0f25b9cSAlexander Motinshould be built into the kernel. 418b5e7e999SRuslan ErmilovFlags may be ORed together if the user wishes to 41989045423SKenneth D. Merrysee printfs for multiple debugging levels. 420f0f25b9cSAlexander Motin.It Dv CAM_DEBUG_FLAGS 4215da3d601SWarner LoshThis sets the various debugging flags from a kernel config file. 42289045423SKenneth D. Merry.It Dv CAM_DEBUG_BUS 423b5e7e999SRuslan ErmilovSpecify a bus to debug. 424db4fcadfSConrad MeyerTo debug all buses, set this to -1. 42589045423SKenneth D. Merry.It Dv CAM_DEBUG_TARGET 426b5e7e999SRuslan ErmilovSpecify a target to debug. 427b5e7e999SRuslan ErmilovTo debug all targets, set this to -1. 42889045423SKenneth D. Merry.It Dv CAM_DEBUG_LUN 429b5e7e999SRuslan ErmilovSpecify a lun to debug. 430b5e7e999SRuslan ErmilovTo debug all luns, set this to -1. 43189045423SKenneth D. Merry.El 43289045423SKenneth D. Merry.Pp 433f0f25b9cSAlexander MotinUsers may also enable debugging on the fly by using the 43489045423SKenneth D. Merry.Xr camcontrol 8 435f0f25b9cSAlexander Motinutility, if wanted options built into the kernel. 4365203edcdSRuslan ErmilovSee 43789045423SKenneth D. Merry.Xr camcontrol 8 43889045423SKenneth D. Merryfor details. 439db35f309SDavid Greenman.Sh SEE ALSO 4405da3d601SWarner Losh.Bl -tag -width 20 4415da3d601SWarner Losh.It Sy Commands: 4425da3d601SWarner Losh.Xr camcontrol 8 , 4435da3d601SWarner Losh.Xr camdd 8 4445da3d601SWarner Losh.It Sy Libraries: 4455da3d601SWarner Losh.Xr cam 3 4465da3d601SWarner Losh.It Sy Periph Drivers: 4476d6d0ae4SAlexander Motin.Xr ada 4 , 44889045423SKenneth D. Merry.Xr da 4 , 4494d21bbd1SWarner Losh.Xr nda 4 , 45073a8c900SWarner Losh.\" .Xr sdda 4 , 45189045423SKenneth D. Merry.Xr pass 4 , 4525da3d601SWarner Losh.Xr sa 4 4535da3d601SWarner Losh.It Sy SIM Devices: 4545da3d601SWarner Losh.Xr aac 4 , 4555da3d601SWarner Losh.Xr aacraid 4 , 4565da3d601SWarner Losh.Xr ahc 4 , 4575da3d601SWarner Losh.Xr ahci 4 , 4585da3d601SWarner Losh.Xr ata 4 , 4595da3d601SWarner Losh.Xr aw_mmc 4 , 4605da3d601SWarner Losh.Xr ciss 4 , 4615da3d601SWarner Losh.Xr hv_storvsc 4 , 4625da3d601SWarner Losh.Xr isci 4 , 4635da3d601SWarner Losh.Xr iscsi 4 , 4645da3d601SWarner Losh.Xr isp 4 , 4655da3d601SWarner Losh.\" .Xr mmcnull 4 , 4665da3d601SWarner Losh.Xr mpr 4 , 4675da3d601SWarner Losh.Xr mps 4 , 4685da3d601SWarner Losh.Xr mpt 4 , 4695da3d601SWarner Losh.Xr mrsas 4 , 4705da3d601SWarner Losh.Xr mvs 4 , 4715da3d601SWarner Losh.Xr nvme 4 , 4725da3d601SWarner Losh.Xr pms 4 , 4735da3d601SWarner Losh.Xr pvscsi 4 , 4745da3d601SWarner Losh.Xr sdhci 4 , 4755da3d601SWarner Losh.Xr smartpqi 4 , 4765da3d601SWarner Losh.Xr sym 4 , 4775da3d601SWarner Losh.Xr tws 4 , 4785da3d601SWarner Losh.Xr umass 4 , 4795da3d601SWarner Losh.Xr virtio_scsi 4 4805da3d601SWarner Losh.It Sy Deprecated or Poorly Supported SIM Devices: 4815da3d601SWarner Losh.Xr ahd 4 , 4825da3d601SWarner Losh.Xr amr 4 , 4835da3d601SWarner Losh.Xr arcmsr 4 , 4845da3d601SWarner Losh.Xr esp 4 , 4855da3d601SWarner Losh.\" .Xr fslsata 4 , 4865da3d601SWarner Losh.Xr hpt27xx 4 , 4875da3d601SWarner Losh.Xr hptiop 4 , 4885da3d601SWarner Losh.Xr hptmv 4 , 4895da3d601SWarner Losh.Xr hptnr 4 , 4905da3d601SWarner Losh.\" .Xr htprr 4 , 4915da3d601SWarner Losh.Xr iir 4 4925da3d601SWarner Losh.Xr mfi 4 , 4935da3d601SWarner Losh.\" .Xr osc 4 , 4945da3d601SWarner Losh.\" .Xr ps3cdrom 4 , 4955da3d601SWarner Losh.Xr sbp 4 , 4965da3d601SWarner Losh.Xr twa 4 4975da3d601SWarner Losh.El 498db35f309SDavid Greenman.Sh HISTORY 4996d6d0ae4SAlexander MotinThe 5006d6d0ae4SAlexander Motin.Nm 50189045423SKenneth D. Merry.Tn SCSI 50289045423SKenneth D. Merrysubsystem first appeared in 50389045423SKenneth D. Merry.Fx 3.0 . 5046d6d0ae4SAlexander MotinThe 5056d6d0ae4SAlexander Motin.Nm 5066d6d0ae4SAlexander MotinATA support was added in 5076d6d0ae4SAlexander Motin.Fx 8.0 . 50889045423SKenneth D. Merry.Sh AUTHORS 509f4d874a1SRuslan Ermilov.An -nosplit 5106d6d0ae4SAlexander MotinThe 5116d6d0ae4SAlexander Motin.Nm 51289045423SKenneth D. Merry.Tn SCSI 513def37e7cSMike Pritchardsubsystem was written by 514def37e7cSMike Pritchard.An Justin Gibbs 515def37e7cSMike Pritchardand 516def37e7cSMike Pritchard.An Kenneth Merry . 5176d6d0ae4SAlexander MotinThe 5186d6d0ae4SAlexander Motin.Nm 5196d6d0ae4SAlexander Motin.Tn ATA 5206d6d0ae4SAlexander Motinsupport was added by 5216c899950SBaptiste Daroussin.An Alexander Motin Aq Mt mav@FreeBSD.org . 5225ee9f050SWarner LoshThe 5235ee9f050SWarner Losh.Nm 5245ee9f050SWarner Losh.Tn NVMe 5255ee9f050SWarner Loshsupport was added by 5265ee9f050SWarner Losh.An Warner Losh Aq Mt imp@FreeBSD.org . 527