|
NAMECAM —
Common Access Method Storage subsystem
SYNOPSISdevice scbus
device ada
device cd
device ch
device da
device pass
device pt
device sa
options CAMDEBUG
options CAM_DEBUG_BUS=-1
options CAM_DEBUG_TARGET=-1
options CAM_DEBUG_LUN=-1
options
CAM_DEBUG_COMPILE=CAM_DEBUG_INFO|CAM_DEBUG_CDB|CAM_DEBUG_PROBE
options CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_CDB
options CAM_MAX_HIGHPOWER=4
options SCSI_NO_SENSE_STRINGS
options SCSI_NO_OP_STRINGS
options SCSI_DELAY=8000
DESCRIPTIONTheCAM subsystem provides a uniform and modular system
for the implementation of drivers to control various SCSI, ATA, NVMe, and MMC
/ SD devices, and to utilize different SCSI, ATA, NVMe, and MMC / SD host
adapters through host adapter drivers. When the system probes buses, it
attaches any devices it finds to the appropriate drivers. The
pass(4)
driver, if it is configured in the kernel, will attach to all devices.
KERNEL CONFIGURATIONThere are a number of generic kernel configuration options for theCAM subsystem:
All devices and buses support dynamic allocation so that an upper
number of devices and controllers does not need to be configured;
The devices are either wired so they appear as a particular device unit or counted so that they appear as the next available unused unit. Units are wired down by setting kernel environment hints. This is usually done either interactively from the loader(8), or automatically via the /boot/device.hints file. The basic syntax is: hint.device.unit.property="value" Individual hint.scbus.0.at="ahd1" This assigns hint.scbus.0.at="ahc1" hint.scbus.0.bus="1" This assigns hint.da.0.at="scbus0" hint.da.0.target="0" hint.da.0.unit="0" This assigns da0 to target 0, unit (lun) 0 of
scbus 0. Omitting the target or unit hints will instruct
This also works with nvme(4) drives as well. hint.nvme.4.at="pci7:0:0" hint.scbus.10.at="nvme4" hint.nda.10.at="scbus10" hint.nda.10.target="1" hint.nda.10.unit="12" hint.nda.11.at="scbus10" hint.nda.11.target="1" hint.nda.11.unit="2" This assigns the NVMe card living at PCI bus 7 to scbus 10 (in PCIe, slot and function are rarely used and usually 0). The target for nda(4) devices is always 1. The unit is the namespace identifier from the drive. The namespace id 1 is exported as nda10 and namespace id 2 is exported as nda11. When you have a mixture of wired down and counted devices then the counting begins with the first non-wired down unit for a particular type. That is, if you have a disk wired down as device da1, then the first non-wired disk shall come on line as da2. ADAPTERSThe system allows common device drivers to work through many different types of adapters. The adapters take requests from the upper layers and do all IO between the SCSI, ATA, NVMe, or MMC / SD bus and the system. The maximum size of a transfer is governed by the adapter. Most adapters can transfer 64KB in a single operation, however many can transfer larger amounts.TARGET MODESome adapters support target mode in which the system is capable of operating as a device, responding to operations initiated by another system. Target mode is supported for some adapters, but is not yet complete for this version of theCAM SCSI subsystem.
ARCHITECTURETheCAM subsystem glues together the upper layers of the
system to the storage devices. PERIPH devices accept storage requests from
GEOM and other upper layers of the system and translates them into protocol
requests. XPT (transport) dispatches these protocol requests to a SIM driver.
A SIM driver takes protocol requests and translates them into hardware
commands the host adapter understands to transfer the protocol requests, and
data (if any) to the storage device. The CCB transports these requests around
as messages.
CAMThe Common Access Method was a standard defined in the 1990s to talk to disk drives. FreeBSD is one of the few operating systems to fully implement this model. The interface between different parts of CAM is the CCB (or CAM Control Block). Each CCB has a standard header, which contains the type of request and dispatch information, and a command specific portion. A CAM Periph generates requests. The XPT layer dispatches these requests to the appropriate SIM. Some CCBs are sent directly to the SIM for immediate processing, while others are queued and complete when the I/O has finished. A SIM takes CCBs and translates them into hardware specific commands to push the SCSI CDB or other protocol control block to the peripheral, along with setting up the DMA for the associated data.Periph DevicesA periph driver knows how to translate standard requests into protocol messages that a SIM can deliver to hardware. These requests can come from any upper layer source, but primarily come in via GEOM as a bio request. They can also come in directly from character device requests for tapes and pass through commands.Disk devices, or direct access (da) in CAM, are one type of peripheral. These devices present themselves to the kernel a device ending in “da”. Each protocol has a unique device name:
Tape devices are called serial access (sa(4)) in CAM. They interface to the system via a character device and provide ioctl(2) control for tape drives. The pass(4) device will pass through CCB requests from userland to the SIM directly. The device is used to send commands other than read, write, trim or flush to a device. The camcontrol(8) command uses this device. XPT driversThe transport driver connects the periph to the SIM. It is not configured separately. It is also responsible for device discovery for those SIM drivers that do not enumerate themselves.SIM driverSIM used to stand for SCSI Interface Module. Now it is just SIM because it understands protocols other than SCSI. There are two types of SIM drivers: virtual and physical. Physical SIMs are typically called host bus adapters (HBA), but not universally. Virtual SIM drivers are for communicating with virtual machine hosts.FILESsee otherCAM device entries.
DIAGNOSTICSAn XPT_DEBUG CCB can be used to enable various amounts of tracing information on any specific bus/device from the list of options compiled into the kernel. There are currently seven debugging flags that may be compiled in and used:
Some of these flags, most notably
Users can enable debugging from their kernel config file, by using the following kernel config options:
Users may also enable debugging on the fly by using the camcontrol(8) utility, if wanted options built into the kernel. See camcontrol(8) for details. SEE ALSO
HISTORYTheCAM SCSI subsystem first appeared in
FreeBSD 3.0. The CAM ATA
support was added in FreeBSD 8.0.
AUTHORSTheCAM SCSI subsystem was written by
Justin Gibbs and Kenneth
Merry. The CAM ATA support was added by
Alexander Motin
<mav@FreeBSD.org>. The
CAM NVMe support was added by Warner
Losh
<imp@FreeBSD.org>.
Visit the GSP FreeBSD Man Page Interface. |