#include <sys/scsi/scsi.h>
Solaris DDI specific (Solaris DDI).
A scsi_pkt structure defines the packet which is allocated by scsi_init_pkt(9F) . The target driver fills in some information, and passes it to scsi_transport(9F) for execution on the target. The HBA fills in some other information as the command is processed. When the command completes (or can be taken no further) the completion function specified in the packet is called with a pointer to the packet as its argument. From fields within the packet, the target driver can determine the success or failure of the command.
opaque_t pkt_ha_private; /* private data for host adapter */ struct scsi_address pkt_address; /* destination packet is for */ opaque_t pkt_private; /* private data for target driver */ void (*pkt_comp)(struct scsi_pkt *); /* completion routine */ long pkt_flags; /* flags */ long pkt_time; /* time allotted to complete */ /* command */ u_char *pkt_scbp; /* pointer to status block */ u_char *pkt_cdbp; /* pointer to command block */ long pkt_resid; /* number of bytes not transferred */ u_long pkt_state; /* state of command */ u_long pkt_statistics; /* statistics */ u_char pkt_reason; /* reason completion called */
The callback routine itself is called from interrupt context and must not sleep nor call any function which may sleep.
The host adapter driver will update the pkt_resid, pkt_reason, pkt_state, and pkt_statistics fields.
- FLAG_NOINTR
- Run command with no command completion callback; command is complete upon return from scsi_transport(9F) .
- FLAG_NODISCON
- Run command without disconnects.
- FLAG_NOPARITY
- Run command without parity checking.
- FLAG_HTAG
- Run command as the head of queue tagged command.
- FLAG_OTAG
- Run command as an ordered queue tagged command.
- FLAG_STAG
- Run command as a simple queue tagged command.
- FLAG_SENSING
- This command is a request sense command.
- FLAG_HEAD
- This command should be put at the head of the queue.
The definitions that are appropriate for the structure member pkt_reason are:
- CMD_CMPLT
- No transport errors-normal completion.
- CMD_INCOMPLETE
- Transport stopped with abnormal state.
- CMD_DMA_DERR
- DMA direction error.
- CMD_TRAN_ERR
- Unspecified transport error.
- CMD_RESET
- SCSI bus reset destroyed command.
- CMD_ABORTED
- Command transport aborted on request.
- CMD_TIMEOUT
- Command timed out.
- CMD_DATA_OVR
- Data Overrun.
- CMD_CMD_OVR
- Command Overrun.
- CMD_STS_OVR
- Status Overrun.
- CMD_BADMSG
- Message not Command Complete.
- CMD_NOMSGOUT
- Target refused to go to Message Out phase.
- CMD_XID_FAIL
- Extended Identify message rejected.
- CMD_IDE_FAIL
- Initiator Detected Error message rejected.
- CMD_ABORT_FAIL
- Abort message rejected.
- CMD_REJECT_FAIL
- Reject message rejected.
- CMD_NOP_FAIL
- No Operation message rejected.
- CMD_PER_FAIL
- Message Parity Error message rejected.
- CMD_BDR_FAIL
- Bus Device Reset message rejected.
- CMD_ID_FAIL
- Identify message rejected.
- CMD_UNX_BUS_FREE
- Unexpected Bus Free Phase.
- CMD_TAG_REJECT
- Target rejected the tag message.
The definitions that are appropriate for the structure member pkt_state are:
- STATE_GOT_BUS
- Bus arbitration succeeded.
- STATE_GOT_TARGET
- Target successfully selected.
- STATE_SENT_CMD
- Command successfully sent.
- STATE_XFERRED_DATA
- Data transfer took place.
- STATE_GOT_STATUS
- Status received.
- STATE_ARQ_DONE
- The command resulted in a check condition and the host adapter driver executed an automatic request sense cmd.
- STAT_DISCON
- Device disconnect.
- STAT_SYNC
- Command did a synchronous data transfer.
- STAT_PERR
- SCSI parity error.
- STAT_BUS_RESET
- Bus reset.
- STAT_DEV_RESET
- Device reset.
- STAT_ABORTED
- Command was aborted.
- STAT_TIMEOUT
- Command timed out.