SSADISK_SCSI_CMD (SCSI Command) SSA Disk Device Driver ioctl Operation

Purpose

Provides a means to send SSA-SCSI Serial Storage Architecture-Small Computer Systems Interface (SSA-SCSI) commands to an SSA physical disk drive that has been opened with the SSADISK_SCSIMODE extension flag.

Description

The SSADISK_SCSI_CMD operation allows the caller to issue a SSA-SCSI command to a selected physical disk. The caller must be root or have an effective user ID of root to issue this ioctl.

The arg parameter for the SSADISK_ISALMgr_CMD operation is the address of an ssadisk_ioctl_parms structure. This structure is defined in the /usr/include/sys/ssadisk.h file.

The SSADISK_SCSI_CMD operation uses the following fields of the ssadisk_ioctl_parms structure:

Field Description
dsb Contains the directive status byte returned for the command. This contains value from /usr/include/ipn/ipndef.h. A non zero value indicates an error.
result Contains the IPN result word returned by IPN for the command. This contains values from /usr/include/ipn/ipntra.h. A non zero value indicates an error.
u0.scsi.data_descriptor Set by the caller to describe the buffer for any data transferred by the scsi command. If no data is transferred then the length of the buffer should be set to 0.
u0.scsi.direction Set by the caller to indicate the direction of the transfer. Valid values are:
SSADISK_SCSI_DIRECTION_NONE
No data transfer is involved for the command.
SSADISK_SCSI_DIRECTION_READ
Data is transferred from the subsystem into host memory.
SSADISK_SCSI_DIRECTION_WRITE
Data is transferred from host memory into the subsystem.
u0.scsi.identifier Identifies the SSA-SCSI logical unit number to which the command should be sent. The format of this field is as defined for SSA_SCSI (bit 7=1 identifies the Target routine, bits 6-0 identify the Logical Unit routine).
u0.scsi.cdb Set by the caller to define the SCSI Command Descriptor Block (CDB) for the command.
u0.scsi.cdb_length Set by the caller to indicate the length of the CDB.
u0.scsi.scsi_status Contains the SCSI status returned for the command.

The device driver has no knowledge of the contents of the CDB, simply passing it on to the hardware. The user should consult the relevant hardware documentation to determine what CDBs are valid for a particular SSA physical disk.

Return Values

If the command was successfully sent to the adapter card then this operation returns a value of 0. Otherwise, a value of -1 is returned and the errno global variable set to one of the following values:

Value Description
EIO Indicates either an unrecoverable I/O error or that the scsi command was not recognized as valid by the hardware.
EINVAL The u0.scsi.cdb_length field in the ssadisk_ioctl_parms structure was set to an invalid length or the u0.scsi.direction field in the ssadisk_ioctl_parms structure was set to an invalid value.
EPERM Indicates that caller did not have an effective user ID (EUID) of 0.
ENOMEM Indicates that the device driver was unable to allocate or pin enough memory to complete the operation.

If the return code is 0, the result field of the ssadisk_ioctl_parms structure is valid. This indicates whether the adapter was able to process the command successfully.

Files

Item Description
/dev/pdisk0, /dev/pdisk1,..., /dev/pdiskn Provide an interface to allow SSA device drivers to access physical SSA disks.
/dev/hdisk0, /dev/hdisk1,..., /dev/hdiskn Provide an interface to allow SSA device drivers to access logical SSA disks.