SCSI — Devices
NAME
scsi − Devices used to send arbitrary SCSI commands to SCSI devices
SYNOPSIS
#include <dev/scsi.h>
DESCRIPTION
SCSI devices are used to send arbitrary SCSI commands to SCSI devices. The interface uses IO-Controls to pass the SCSI command block and command data to the device and return the command status byte, command data, and any scsi mode sense data generated. The IO-Control IOC_SCSI_COMMAND takes as input a Dev_ScsiCommand and returns in the out buffer a Dev_ScsiStatus. typedef struct Dev_ScsiCommand {
intbufferLen;
intdataOffset;
intcommandLen; } Dev_ScsiCommand; The field bufferLen specifies the length of the command’s data buffer. The data buffer itself is located in the in buffer for commands that send data to the device and the out buffer for commands that return data. dataOffset specifies the offset into the IO-Control’s input buffer of the start of the data buffer. If bufferLen is greater than zero and the dataOffset equals the size of the input buffer then the command is assumed to return data. The commandLen field specifies the number of bytes following the Dev_ScsiCommand structure that make up the SCSI command block. typedef struct Dev_ScsiStatus {
intstatusByte;
intamountTransferred;
intsenseDataLen; } Dev_ScsiStatus; The output buffer of the IOC_SCSI_COMMAND command consists of a Dev_ScsiStatus followed by any data returned by the device followed by any sense data generated by the command. The field statusByte contains the SCSI status byte as returned by the SCSI device and the field amountTransferred reports the number of data bytes transferred by the command. senseDataLen reports the number of bytes of sense data returned byte the command. The out buffer looks like: Dev_ScsiStatus statusBlock; char data[statuBlock.amountTransferred]; char modeSenseData[statuBlock.senseDataLen];
WARNING
The SCSI command set supported by most devices include some very destructive commands such as FORMAT_UNIT and ERASE_TAPE. Extreme care should be taken when using this interface.
KEYWORDS
scsi command, scsi device, HBA
Sprite version 1.0 — July 10, 1989