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 */ opaque_t pkt_private; /* private data for target driver */ void (*pkt_comp)(struct scsi_pkt *); /* callback */ uint_t pkt_flags; /* flags */ int pkt_time; /* time allotted to complete command */ uchar_t *pkt_scbp; /* pointer to status block */ uchar_t *pkt_cdbp; /* pointer to command block */ ssize_t pkt_resid; /* number of bytes not transferred */ uint_t pkt_state; /* state of command */ uint_t pkt_statistics; /* statistics */ uchar_t pkt_reason; /* reason completion called */
An opaque pointer which the Host Bus Adapter uses to reference a private data structure used to transfer scsi_pkt requests.
Initialized by scsi_init_pkt(9F) and serves to record the intended route and recipient of a request.
Reserved for the use of the target driver and is not changed by the HBA driver.
Specifies the command completion callback routine. When the host adapter driver has gone as far as it can in transporting a command to a SCSI target, and the command has either run to completion, or can go no further for some other reason, the host adapter driver will call the function pointed to by this field and pass a pointer to the packet as argument. The callback routine itself is called from interrupt context and must not sleep nor call any function which may sleep.
Provides additional information about how the target driver wants the command to be executed. See pkt_flag Definitions.
Will be set by the target driver to represent the maximum length of time in seconds that this command is allowed take to complete. pkt_time may be 0 if no timeout is required.
Points to either a struct scsi_status(9S) or, if auto–rqsense is enabled, and pkt_state includes STATE_ARQ_DONE, a struct scsi_arq_status. If scsi_status 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.
Points to a kernel addressable buffer whose length was specified by a call to the proper resource allocation routine, scsi_init_pkt(9F).
Contains a residual count, either the number of data bytes that have not been transferred ( scsi_transport(9F)) or the number of data bytes for which DMA resources could not be allocated scsi_init_pkt(9F). In the latter case, partial DMA resources may only be allocated if scsi_init_pkt(9F) is called with the PKT_DMA_PARTIAL flag.
Has bit positions representing the six most important states that a SCSI command can go through (see pkt_state Definitions).
Maintains some transport-related statistics. (see pkt_statistics Definitions).
Contains a completion code that indicates why the pkt_comp function was called.
The host adapter driver will update the pkt_resid, pkt_reason, pkt_state, and pkt_statistics fields.
The definitions that are appropriate for the structure member pkt_flags are:
Run command with no command completion callback; command is complete upon return from scsi_transport(9F).
Run command without disconnects.
Run command without parity checking.
Run command as the head of queue tagged command.
Run command as an ordered queue tagged command.
Run command as a simple queue tagged command.
This command is a request sense command.
This command should be put at the head of the queue.
The definitions that are appropriate for the structure member pkt_reason are:
No transport errors–normal completion.
Transport stopped with abnormal state.
DMA direction error.
Unspecified transport error.
SCSI bus reset destroyed command.
Command transport aborted on request.
Command timed out.
Message not Command Complete.
Target refused to go to Message Out phase.
Extended Identify message rejected.
Initiator Detected Error message rejected.
Abort message rejected.
Reject message rejected.
No Operation message rejected.
Message Parity Error message rejected.
Bus Device Reset message rejected.
Identify message rejected.
Unexpected Bus Free Phase.
Target rejected the tag message.
The definitions that are appropriate for the structure member pkt_state are:
Bus arbitration succeeded
Target successfully selected.
Command successfully sent.
Data transfer took place.
The command resulted in a check condition and the host adapter driver executed an automatic request sense cmd.
The definitions that are appropriate for the structure member pkt_statistics are:
Command did a synchronous data transfer.
SCSI parity error.
Command was aborted.
Command timed out.