SCSI HBA Driver Specific Issues
The section covers issues specific to SCSI HBA drivers.
Installing HBA Drivers
A SCSI HBA driver is installed like a leaf driver (see Chapter 17, Compiling, Loading, Packaging, and Testing Drivers), except that the add_drv(1M) command must specify the driver class as SCSI, such as:
# add_drv -m" * 0666 root root" -i'"pci1077,1020"' -c scsi isp |
HBA Configuration Properties
When attaching an instance of an HBA device, scsi_hba_attach_setup(9F) creates a number of SCSI configuration parameter properties for that HBA instance. A particular property is created only if there is no existing property of the same name already attached to the HBA instance, permitting a default property value to be overridden in an HBA configuration file.
An HBA driver must use ddi_prop_get_int(9F) to retrieve each property. The HBA driver then modifies (or accepts the default value of) the properties to configure its specific operation.
scsi-reset-delay Property
The scsi-reset-delay property is an integer specifying the SCSI bus or device reset delay recovery time in milliseconds.
scsi-options Property
The scsi-options property is an integer specifying a number of options through individually defined bits. The bits in scsi_options are:
SCSI_OPTIONS_DR (0x008) - If not set, the HBA should not grant disconnect privileges to a target device.
SCSI_OPTIONS_LINK (0x010) - If not set, the HBA should not enable linked commands.
SCSI_OPTIONS_SYNC (0x020) - If not set, the HBA should not negotiate synchronous data transfer, and should reject any attempt to negotiate synchronous data transfer initiated by a target.
SCSI_OPTIONS_PARITY (0x040) - If not set, the HBA should run the SCSI bus without parity.
SCSI_OPTIONS_TAG (0x080) - If not set, the HBA should not operate in Command Tagged Queuing mode.
SCSI_OPTIONS_FAST (0x100) - If not set, the HBA should not operate the bus in FAST SCSI mode.
SCSI_OPTIONS_WIDE (0x200) - If not set, the HBA should not operate the bus in WIDE SCSI mode.
Per-target scsi-options
An HBA driver might support a per-target scsi-options feature in the following format:
target<n>-scsi-options=<hex value> |
In this example, < n> is the target ID. If the per-target scsi-options property is defined for a particular target, the HBA driver uses the value of the per-target scsi-options property for that target rather than the per-HBA driver instance scsi-options property. This can provide more precise control if, for example, synchronous data transfer needs to be disabled for just one particular target device. The per-target scsi-options property can be defined in the driver.conf(4) file.
Here is an example of a per-target scsi-options property definition to disable synchronous data transfer for target device 3:
target3-scsi-options=0x2d8 |
IA Target Driver Configuration Properties
Some IA SCSI target drivers (such as the cmdk disk target driver) use the following configuration properties:
disk
queue
flow_control
When using the cmdk sample driver to write an HBA driver for an IA platform, one or more of these properties (as appropriate to the HBA driver and hardware) need to be defined in the driver.conf(4) file.
Note - These property definitions should appear only in an HBA driver's driver.conf(4) file. The HBA driver itself should not inspect or attempt to interpret these properties in any way. These properties are advisory only and serve as an adjunct to the cmdk driver. They should not be relied upon in any way. The property definitions might or might not be used in future releases.
The disk property can be used to define the type of disk supported by cmdk. For a SCSI HBA, the only possible value for the disk property is:
disk="scdk" - Disk type is a SCSI disk
The queue property defines how the disk driver sorts the queue of incoming requests during strategy(9E). There are two possible values:
queue="qsort" - One-way elevator queuing model, provided by disksort(9F)
queue="qfifo" - FIFO (first in, first out) queuing model
The flow_control property defines how commands are transported to the HBA driver. There are three possible values:
flow_control="dsngl" - Single command per HBA driver
flow_control="dmult" - Multiple commands per HBA driver--when the HBA queue is full, the driver returns TRAN_BUSY
flow_control="duplx" - The HBA can support separate read and write queues, with multiple commands per queue. FIFO ordering is used for the write queue; the queuing model used for the read queue is described by the queue property. When an HBA queue is full, the driver returns TRAN_BUSY
Here is an example of a driver.conf(4) file for use with an IA HBA PCI device designed for use with the cmdk sample driver:
# # config file for ISP 1020 SCSI HBA driver # flow_control="dsngl" queue="qsort" disk="scdk" scsi-initiator-id=7; |
Support for Queuing
For a definition of tagged queuing, refer to the SCSI-2 specification. To support tagged queuing, first check the scsi_options flag SCSI_OPTIONS_TAG to see if tagged queuing is enabled globally. Next, check to see if the target is a SCSI-2 device and whether it has tagged queuing enabled. If this is all true, attempt to enable tagged queuing by using scsi_ifsetcap(9F).
If tagged queuing fails, you can attempt to set untagged queuing. In this mode, you submit as many commands as you think necessary or optimal to the host adapter driver. Then the host adapter queues the commands to the target one at a time (as opposed to tagged queuing, where the host adapter submits as many commands as it can until the target indicates that the queue is full).