SCSI_IFGETCAP(9F) | Kernel Functions for Drivers | SCSI_IFGETCAP(9F) |
scsi_ifgetcap, scsi_ifsetcap - get/set SCSI transport capability
#include <sys/scsi/scsi.h> int scsi_ifgetcap(struct scsi_address *ap, char *cap, int whom);
int scsi_ifsetcap(struct scsi_address *ap, char *cap, int value,
int whom);
illumos DDI specific (illumos DDI).
ap
cap
value
whom
The scsi_ifsetcap() function is used by target drivers to set the capabilities of the host adapter driver. The cap pointer is a name-value pair identified by a null-terminated character string and the integer value of the cap. The current value of the capability can be retrieved with the scsi_ifgetcap() function. If the whom value is 0, all target drivers are affected. Otherwise, the scsi_address structure pointed to by ap is the only target that is affected.
The driver should confirm that scsi_ifsetcap() and scsi_ifsetcap() functions are called with a cap that points to a capability which is supported by the device.
The following capabilities have been defined:
dma-max
dma-max-arch
The "dma-max-arch" capability can not be set. It is implemented with this command and does not rely on a tran_getcap(9E) response from the HBA.
msg-out
disconnect
synchronous
wide-xfer
parity
initiator-id
untagged-qing
tagged-qing
auto-rqsense
sector-size
total-sectors
geometry
If geometry is not relevant or appropriate for the target disk, scsi_ifgetcap() can return -1 to indicate that the geometry is not defined. For example, if the HBA BIOS supports Logical Block Addressing for the target disk, scsi_ifgetcap() returns -1. Attempts to retrieve the "virtual geometry" from the target driver, such as the DKIOCG_VIRTGEOM ioctl, will fail. See dkio(4I) for more information about DKIOCG_VIRTGEOM.
reset-notification
linked-cmds
qfull-retries
qfull-retry-interval
lun-reset
interconnect-type
max-cdb-length
If the HBA driver does not support the max-cdb-length capability, the default value of the target driver is used for the CDB determination.
The scsi_ifsetcap() function returns:
1
0
−1
The scsi_ifgetcap() function returns the current value of a capability, or:
−1
Example 1 Using scsi_ifgetcap()
if (scsi_ifgetcap(&sd->sd_address, "auto-rqsense", 1) == 1) {
un->un_arq_enabled = 1; } else {
un->un_arq_enabled =
((scsi_ifsetcap(&sd->sd_address, "auto-rqsense", 1, 1) == 1) ?
1 : 0); } if (scsi_ifsetcap(&devp->sd_address, "tagged-qing", 1, 1) == 1) { un->un_dp->options |= SD_QUEUEING; un->un_throttle = MAX_THROTTLE; } else if (scsi_ifgetcap(&devp->sd_address, "untagged-qing", 0) == 1) { un->un_dp->options |= SD_QUEUEING; un->un_throttle = 3; } else { un->un_dp->options &= ~SD_QUEUEING; un->un_throttle = 1; }
These functions can be called from user, interrupt, or kernel context.
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Interface Stability | Committed |
tran_reset(9E), scsi_hba_lookup_capstr(9F), scsi_reset(9F), scsi_reset_notify(9F), ddi_dma_attr(9S), scsi_address(9S), scsi_arq_status(9S)
Writing Device Drivers
April 9, 2016 | OmniOS |