udi_scsi_io_cb_t(3udi)
Control block for SCSI I/O operations
#include <udi.h>typedef struct { udi_cb_t gcb; udi_buf_t *data_buf; udi_ubit32_t timeout; udi_ubit16_t flags; udi_ubit8_t attribute; udi_ubit8_t cdb_len; udi_ubit8_t *cdb_ptr; } udi_scsi_io_cb_t; /* I/O Request Flags */#define UDI_SCSI_DATA_IN (1U<<0) #define UDI_SCSI_DATA_OUT (1U<<1) #define UDI_SCSI_NO_DISCONNECT (1U<<2)/* SCSI Task Attributes */#define UDI_SCSI_SIMPLE_TASK 1 #define UDI_SCSI_ORDERED_TASK 2 #define UDI_SCSI_HEAD_OF_Q_TASK 3 #define UDI_SCSI_ACA_TASK 4 #define UDI_SCSI_UNTAGGED_TASK 5/* Control Block Group Number */#define UDI_SCSI_IO_CB_NUM 2MEMBERS gcb is a standard member at the front of SCSI control blocks, as defined in udi_scsi_bind_cb_t.
data_buf is a pointer to a buffer used to carry the data portion of a transfer. See udi_scsi_io_req and udi_scsi_io_ack for details on buffer usage.
timeout is an I/O timeout in milliseconds. A timeout value of zero specifies an infinite period, meaning that the HD will not time the request. If the timeout value is non-zero, the HD must ensure that the request is timed for the specified number of milliseconds. As described in Section 2.4.2, to reduce variability, the request must be timed starting from when it is started on the SCSI interconnect, or as close to that point as possible.
If the request doesn't complete within the specified timeout period the HD must abort the request and complete it with status UDI_STAT_TIMEOUT.
flags is a set of flags associated with this I/O request. The flag bit values are defined below. At most one of UDI_SCSI_DATA_IN or UDI_SCSI_DATA_OUT must be specified, and exactly one of these two flags must be specified if data_buf->buf_size is non-zero. UDI_SCSI_NO_DISCONNECT may be optionally combined (ORed) with either of the IN/OUT flags.
UDI_SCSI_DATA_IN - Data-in from device to host.
UDI_SCSI_DATA_OUT - Data-out from host to device.UDI_SCSI_NO_DISCONNECT - Disconnects on a parallel SCSI bus are disallowed during this I/O. On serial links this flag is ignored.
attribute is a SCSI-3 task attribute which specifies ordering and other constraints of requests (tasks) sent to the device. Exactly one of the following values may be associated with the I/O request by assigning it into the attribute field:
All of the above attributes except UDI_SCSI_ACA_TASK are supported in the SCSI-2 architecture. If UDI_SCSI_ACA_TASK is passed to a SCSI-2 HD, it is the HD's responsibility to emulate SCSI-3 ACA behavior by freezing the queues in the HD that correspond to a given LUN and only allowing ACA_TASK'd requests through until a CLEAR_ACA control request is received from the PD.
cdb_len is the number of valid CDB bytes for this request. (This does not include any extra bytes used for multi-LUN addressing.)
cdb_ptr is a pointer to cdb_len bytes of SCSI CDB. If this is a multi-LUN binding the CDB bytes are followed by an 8-bit bus number, 3 pad bytes, a 32-bit Target ID, and a 64-bit LUN. The 32-bit Target ID shall be encoded as a little-endian quantity. The 64-bit LUN value shall be treated as an array of 8 bytes, formatted as per the SCSI Architecture Model - 2 (SAM-2) specification. Refer to Section 2.3 for further information on Target ID and LUN values.
This pointer is set by the environment when the control block is allocated and, like the scratch pointer, points to additional memory associated with this control block. The size of this memory area, and hence the maximum size of CDBs used by this driver, is set via the inline_size member of the relevant udi_cb_init_t, and must be incremented by 16 if this is a multi-LUN binding (i.e., maximum CDB size + 16) to provide room for the 32-bit Target ID and 64-bit LUN. The pointer itself must not be modified by the driver.
DESCRIPTION The SCSI I/O control block is used between the PD and HD to process a SCSI I/O request.
In order to use this type of control block it must be associated with a control block index by including UDI_SCSI_IO_CB_NUM in a udi_cb_init_t in the driver's udi_init_info.
The size of the inline memory area pointed to by cdb_ptr must be specified using the inline_size member of that udi_cb_init_t structure (see Chapter 10, "Initialization", of the UDI Core Specification). The memory is treated as an array of unstructured bytes. (I.e. cdb_ptr is a UDI_DL_INLINE_UNTYPED field.) Since the HD never allocates this type of control block, it must set inline_size to zero.
REFERENCES udi_scsi_io_req, udi_scsi_io_ack, udi_scsi_io_nak, udi_cb_alloc