Copyright (c) 2007, Sun Microsystems, Inc., All Rights Reserved
Copyright (c) 2014 Garrett D'Amore <garrett@damore.org>
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
#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);
Pointer to the scsi_address structure.
Pointer to the string capability identifier.
Defines the new state of the capability.
Determines if all targets or only the specified target 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
Maximum dma transfer size that is supported by the host adapter.
Maximum dma transfer size that is supported by system. Takes the host adapter and system architecture into account. This is useful for target drivers which do not support partial DMAs on systems which do not have an IOMMU. In this case, the DMA can also be limited by the host adapters "scatter/gather" list constraints. 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.
Message out capability that is supported by the host adapter: 0 disables, 1 enables.
Disconnect capability that is supported by the host adapter: 0 disables, 1 enables.
Synchronous data transfer capability that is supported by the host adapter: 0 disables, 1 enables.
Wide transfer capability that is supported by the host adapter: 0 disables, 1 enables.
Parity checking capability that is supported by host adapter: 0 disables, 1 enables.
Host bus address that is returned.
Host adapter capability that supports internal queueing of commands without tagged queueing: 0 disables, 1 enables.
Host adapter capability that supports queuing: 0 disables, 1 enables.
Host adapter capability that supports auto request sense on check conditions: 0 disables, 1 enables.
Capability that is set by the target driver to inform the HBA of the granularity, in bytes, of the DMA breakup. The HBA DMA attributes structure is set to reflect the byte total of this setting. See ddi_dma_attr(9S). The sector-size should be set to the size of the physical disk sector. The capability defaults to 512 bytes.
Capability that is set by the target driver to inform the HBA of the total number of sectors on the device returned by the SCSI get capacity command. This capability must be set before the target driver ``gets'' the geometry capability.
Capability that returns the HBA geometry of a target disk. The target driver sets the total-sectors capability before ``getting'' the geometry capability. The geometry is returned as a 32-bit value. The upper 16 bits represent the number of heads per cylinder. The lower 16 bits represent the number of sectors per track. The geometry capability cannot be ``set''. 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(7I) for more information about DKIOCG_VIRTGEOM.
Host adapter capability that supports bus reset notification: 0 disables, 1 enables. See scsi_reset_notify(9F).
Host adapter capability that supports linked commands: 0 disables, 1 enables.
Capability that enables or disables QUEUE FULL handling. If 0, the HBA will not retry a command when a QUEUE FULL status is returned. If the value is greater than 0, the HBA driver retries the command a specified number of times at an interval determined by the qfull-retry-interval. The range for qfull-retries is 0-255.
Capability that sets the retry interval in milliseconds (ms) for commands completed with a QUEUE FULL status. The range for qfull-retry-intervals is 0-1000 ms.
Capability that is created with a value of zero by HBA drivers that support the RESET_LUN flag in the tran_reset(9E) function. If it exists, the lun-reset value can be set to 1 by target drivers to allow the use of LOGICAL UNIT RESET on a specific target instance. If lun-reset does not exist or has a value of zero, scsi_reset(9F) is prevented from passing the RESET_LUN flag to tran_reset() function of the HBA driver. If lun-reset exists and has a value of 1, the tran_reset() function of the HBA driver can be called with the RESET_LUN flag.
Capability held in the tran_interconnect_type element of struct scsi_hba_tran that indicates the HBA transport interconnect type . The integer value of the interconnect type of the transport is defined in the services.h header file.
Host adapter capability of the maximum supported CDB (Command Descriptor Block) length. The target driver asks for the capability at attach time. If the HBA driver supports the capability, the maximum length of the CDB is returned in bytes. The target driver can then use that value to determine which CDB is used for the HBA. 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.
If the capability was successfully set to the new value.
If the capability is not variable.
If the capability was not defined, or setting the capability to a new value failed.
The scsi_ifgetcap() function returns the current value of a capability, or: -1
If the capability was not defined.
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; }
ATTRIBUTE TYPE ATTRIBUTE VALUE |
Interface Stability Committed |
Writing Device Drivers