|
|
udi_scsi_bind_req(3udi)
Request a SCSI binding (PD-to-HD)
#include <udi.h>void udi_scsi_bind_req ( udi_scsi_bind_cb_t *cb, udi_ubit16_t bind_flags, udi_ubit16_t queue_depth, udi_ubit16_t max_sense_len, udi_ubit16_t aen_buf_size ); /* Bind Flags */#define UDI_SCSI_BIND_EXCLUSIVE (1U<<0) #define UDI_SCSI_TEMP_BIND_EXCLUSIVE (1U<<1)ARGUMENTS cb is a pointer to a SCSI bind control block.
bind_flags contains flags restricting or qualifying this binding. The following flags are defined. At most one of UDI_SCSI_BIND_EXCLUSIVE and UDI_SCSI_TEMP_BIND_EXCLUSIVE must be set.
UDI_SCSI_BIND_EXCLUSIVE - Indicates that the PD wants to get an exclusive bind to the SCSI device (target/LUN) associated with this bind channel. The HD will respond with a status of UDI_SCSI_CANNOT_BIND_EXCLUSIVE if another PD is currently bound to the target/LUN.
UDI_SCSI_TEMP_BIND_EXCLUSIVE - Indicates that the PD wants "temporary exclusive access" to the device. If no PD is currently exclusively bound to the device the HD will grant this bind as follows: the HD will quiesce any other PDs bound to the device (transparently to those PDs), and will then ack back to this PD with UDI_OK status. Any requests which come in from other PDs while this PD has exclusive access will be queued until this PD unbinds.
Drivers which bind with this flag must not remain bound any longer than the number of milliseconds specified by the %scsi_pd_max_temp_bind_excl attribute; failure to do so is considered illegal driver behavior which can result in the PD instance being killed.
queue_depth is the number of SCSI commands that the HD is allowed to have pending to the device simultaneously. This is used to avoid excessive queue-full statuses. The PD may change this value later using the UDI_SCSI_CTL_SET_QUEUE_DEPTH control request. Note that the HD must manage queue depth on a per-LUN basis, guaranteeing that the queue depth to the device (i.e., the minimum of the queue depths specified by PDs attached to a given LUN) is not exceeded. See Section 2.4.5, "Task/Queue Management" for additional details.
max_sense_len is the maximum sense data size required for the corresponding peripheral device. This sense data must be requested by the HD on behalf of the PD for all check conditions reported by the device. If max_sense_len is zero, the HD does not report the data to the PD.
Warning - While the HD is not required to request pending sense data from the device if max_sense_len is zero, it should do so, since not doing so could result in sense data building up on the device, particularly for multi-hosted devices.
aen_buf_size is the valid data size, in bytes, of AEN data buffers to be allocated by the HD and sent to the PD with each UDI_SCSI_EVENT_AEN event. If aen_buf_size is zero, no AEN buffers will be allocated.
aen_buf_size is ignored if the UDI_SCSI_EVENT_AEN event is either not supported by the HD or not enabled by the PD.
TARGET CHANNEL The target channel for this operation is the bind channel connecting a SCSI PD to its parent HD.
DESCRIPTION A SCSI PD uses this operation to bind to its parent HD.
The PD must prepare for the udi_scsi_bind_req operation by allocating a SCSI bind control block (calling udi_cb_alloc with a cb_idx that was previously associated with UDI_SCSI_BIND_CB_NUM). Next, the PD fills in the control block and sends it to the HD in a udi_scsi_bind_req operation.
The udi_scsi_bind_req operation must either be the first channel operation sent on the bind channel or the first operation since a SCSI unbind was done on the channel. The PD must not send any further operations on the bind channel until it receives the corresponding udi_scsi_bind_ack from the HD.