SCSI_PKT(9S) | Data Structures for Drivers | SCSI_PKT(9S) |
scsi_pkt
— SCSI
packet structure
#include
<sys/scsi/scsi.h>
illumos DDI specific (illumos DDI).
A scsi_pkt
structure defines the packet
that 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 host bus adapter (HBA) fills in 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; struct scsi_address pkt_address; opaque_t pkt_private; void (*pkt_comp)(struct scsi_pkt *); uint_t pkt_flags; int pkt_time; uchar_t *pkt_scbp; uchar_t *pkt_cdbp; ssize_t pkt_resid; uint_t pkt_state; uint_t pkt_statistics; uchar_t pkt_reason; uint_t pkt_cdblen; uint_t pkt_scblen; uint_t pkt_tgtlen; uint_t pkt_numcookies; ddi_dma_cookie_t *pkt_cookies; uint_t pkt_dma_flags;
These members are described here:
scsi_pkt
requests.STATE_ARQ_DONE
, a struct
scsi_arq_status(9S). If
scsi_status(9S) is returned,
the SCSI status byte resulting from the requested command is available. If
scsi_arq_status(9S) is
returned, the sense information is also available.PKT_DMA_PARTIAL
flag.DDI_DMA_READ
and
DDI_DMA_WRITE
. See
tran_setup_pkt(9E).The host adapter driver will update the pkt_resid, pkt_reason, pkt_state, and pkt_statistics fields.
The appropriate definitions for the structure member pkt_flags are:
FLAG_NOINTR
FLAG_NODISCON
FLAG_NOPARITY
FLAG_HTAG
FLAG_OTAG
FLAG_STAG
FLAG_SENSING
FLAG_HEAD
FLAG_RENEGOTIATE_WIDE_SYNC
Request Sense
’ and
‘Inquiry
’ commands. Refer to the
SCSI 2 standard, sections 6.6.21 and 6.6.23.
This flag should not be set for every packet as this will severely impact performance.
The appropriate definitions for the structure member pkt_reason are:
CMD_CMPLT
CMD_INCOMPLETE
CMD_DMA_DERR
CMD_TRAN_ERR
CMD_RESET
CMD_ABORTED
CMD_TIMEOUT
CMD_DATA_OVR
CMD_CMD_OVR
CMD_STS_OVR
CMD_BADMSG
CMD_NOMSGOUT
CMD_XID_FAIL
CMD_IDE_FAIL
CMD_ABORT_FAIL
CMD_REJECT_FAIL
CMD_NOP_FAIL
CMD_PER_FAIL
CMD_BDR_FAIL
CMD_ID_FAIL
CMD_UNX_BUS_FREE
CMD_TAG_REJECT
CMD_DEV_GONE
The appropriate definitions for the structure member pkt_state are:
STATE_GOT_BUS
STATE_GOT_TARGET
STATE_SENT_CMD
STATE_XFERRED_DATA
STATE_GOT_STATUS
STATE_ARQ_DONE
STATE_XARQ_DONE
PKT_XARQ
flag got a check condition. The host
adapter driver was able to successfully request and return this. The
scsi_pkt.pkt_scbp->sts_rqpkt_resid
returns the sense data residual based on the
statuslen parameter of the
scsi_init_pkt(9F) call. The
sense data begins at
scsi_pkt.pkt_scbp->sts_sensedata.The definitions that are appropriate for the structure member pkt_statistics are:
STAT_DISCON
STAT_SYNC
STAT_PERR
STAT_BUS_RESET
STAT_DEV_RESET
STAT_ABORTED
STAT_TIMEOUT
tran_init_pkt(9E), tran_setup_pkt(9E), scsi_hba_pkt_comp(9F), scsi_init_pkt(9F), scsi_transport(9F), scsi_arq_status(9S), scsi_status(9S)
Writing Device Drivers.
HBA drivers should signal scsi_pkt
completion by calling
scsi_hba_pkt_comp(9F).
This is mandatory for HBA drivers that implement
tran_setup_pkt(9E). Failure
to comply results in undefined behavior.
Drivers must not make assumptions about the size of the
scsi_pkt
structure. In particular, this structure
must not be directly inlined into other driver structures nor allocated
except by one of the specialized allocation functions such as
scsi_init_pkt(9F).
June 21, 2022 | OmniOS |