SCSI Pass-Through Programmer's Guide

These ioctl() calls are “blocking” and follow a single-threaded path. ioctl() does not return
until the I/O is completed. Completion includes normal I/O completion as well as requests
which are aborted due to timeouts or errors.
MPE/iX does security and bounds checking of the data and sense buffers. Again, there is no
cross checking of the CDB vs. the other command fields; it is up the caller to be able to
construct a valid CDB as well as make it consistent with the other parameters.
Please note most all ioctl functions that are supported on HP-UX are not supported in
MPE/iX. Only SIOC_IO should be attempted; SIOC_EXCLUSIVE, SIOC_RESET_BUS are
not implemented. Additional SCSI.H ioctl features like SIOC_IDENTIFY,
SIOC_SYNC_CACHE etc. and functions like SIOC_SET_BUS_LIMITS etc., to control
LUN, bus settings, are also not supported.
Interpreting results
A return value of 0 (zero) from ioctl() indicates a successful completion of the ioctl call. This
does not however, indicate the actual result of the SCSI I/O command. The SCSI command
that was passed to ioctl includes status values that indicate the status of the SCSI request.
These status values need to be checked to ensure successful completion of the I/O request.
command.cdb_status and command.sense_status provide status information of the completed
I/O request. If command.cdb_status does not equal the constant S_Good , it is indicative of an
I/O error. If cdb_status is set to S_Check_Condition, then command.sense_status provides
more information about the error. The following “C” code fragment shows a simple example
of checking these items:
if ( command.cdb_status != S_GOOD )
{
printf("SCSI command returned status 0x%02x\n", command.sense_status);
if ( command.cdb_status == S_CHECK_CONDITION )
{
if ( command.sense_status == S_GOOD )
printf("Request sense returned status 0x%02x\n", command.sense_status);
else
{
memcpy(&sense_data,&(command.sense),command.sense_xfer);
printf("Sense error code: 0x%02x\n", sense_data.error_code);
printf("Sense key: 0x%02x\n", sense_data.key);
printf("Sense code: 0x%02x\n", sense_data.code);
printf("Sense qualifier: 0x%02x\n", sense_data.qualifier);
}
}
}
else printf("Good status, %d bytes returned (in hex): \n",
command.data_xfer);
The following are the SCSI error codes that can be returned:
S_GOOD 0x00
S_CHECK_CONDITION 0x02
S_CONDITION_MET 0x04
S_BUSY 0x08
S_INTERMEDIATE 0x10
- 9 -