HP-UX Reference (11i v2 04/09) - 7 Device (Special) Files, 9 General Information, Index (vol 10)
s
sioc_io(7) sioc_io(7)
NAME
sioc_io - SCSI pass-through interface
DESCRIPTION
SCSI devices are controlled by a device-specific driver, when one exists. Device-specific drivers, such as
those for SCSI direct access (disk) and sequential access (tape) devices, coordinate device and driver
states to accomplish correct logical device behavior. The
sioc_io pass-through interface enables the
use of SCSI devices and commands not normally supported by these device-specific drivers.
Superuser privileges or device write permissions are required to use the
SIOC_IO ioctl. All reserved
fields in the
sioc_io data structure must be zero-filled.
The
SIOC_IO ioctl allows an arbitrary SCSI command to be sent to a device. All details of the SCSI com-
mand protocol are handled automatically.
The data structure for the
SIOC_IO ioctl is included from <
sys/scsi.h>:
/* SCSI device control ioctls */
#define SIOC_IO _IOWR(’S’, 22, struct sctl_io)
/* Structure for SIOC_IO ioctl */
struct sctl_io
{
unsigned flags;
unsigned char cdb_length;
unsigned char cdb[16];
void *data;
unsigned data_length;
unsigned max_msecs;
unsigned data_xfer;
unsigned cdb_status;
unsigned char sense[256];
unsigned sense_status;
unsigned char sense_xfer;
unsigned char reserved[64];
};
The following flags can be used to specify the
flags field value:
SCTL_READ Data-in phase expected if the data_length field is non-zero. The absence of this
flag implies that a data-out phase is expected if the data_length field is non-
zero.
The
cdb field specifies the SCSI command bytes. The number of command bytes is specified by the
cdb_length field. These command bytes are sent to the target device during the SCSI command phase.
The address of the data area for the data phase of the SCSI command is specified by the
data field. The
data_length field specifies the maximum number of data bytes to be transferred. A zero-valued
data_length indicates that no data phase should occur. Most SCSI commands with a data phase
expect the data length information to be included somewhere in the command bytes. The caller is respon-
sible for correctly specifying both the data_length field and any cdb data length values. The length
may not be larger than SCSI_MAXPHYS and some implementations further restrict this length.
The
max_msecs field specifies the maximum time, in milliseconds, that the device should need to com-
plete the command. If this period of time expires without command completion, the system might
attempt recovery procedures to regain the device’s attention. These recovery procedures might include
abort tag, abort, and device and bus reset operations. A zero value in the max_msec field indicates that
the timeout period is infinite and the system should wait indefinitely for command completion.
When the
SIOC_IO ioctl call returns, all command processing has been completed. Most SIOC_IO ioctl
calls will return zero (success). The resulting detailed ioctl data should be used to evaluate ‘‘success’’ or
‘‘failure’’ from the caller’s perspective. The cdb_status field indicates the results of the cdb command.
If the cdb_status field indicates a S_CHECK_CONDITION status, the sense_status field indicates
the results of the SCSI REQUEST SENSE command used to collect the associated sense data. These
status fields will contain one of the following values:
SCTL_INVALID_REQUEST The SCSI command request is invalid and thus not attempted.
Section 7−−146 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: September 2004