sdi_xicmd(D3sdi)
sdi_xicmd --
perform requested operation immediately
Synopsis
#include <sys/types.h>
#include <sys/sdi.h>
#include <sys/ddi.h>
int sdi_xicmd(int hbaflag, struct sb *pt,
int sleepflag);
Description
sdi_xicmd( )
sends an immediate
sb(D4sdi)
structure to a device.
Immediate means that this function bypasses
queued scb requests
and immediately accesses the
device to perform the requested operation.
Arguments
hbaflag-
Initialize to HBA_EXT_ADDRESS
for drivers that understand extended SCSI addressing,
or to 0 for drivers that only understand
conventional SCSI addressing.
pt-
Pointer to the
sb(D4sdi)
command block structure;
the
sb_type
member of the sb structure
must be set to either SFB_TYPE or SCB_TYPE.
sleepflag-
Indicates whether the allocation may block or not.
Valid values are KM_SLEEP or KM_NOSLEEP.
Return values
A return code of SDI_RET_OK indicates
that the request is in progress
and the target driver interrupt routine will be called
after command completion.
A return code of SDI_RET_ERR indicates
that the type field is invalid.
After a logical unit queue is resumed,
all outstanding immediate control
and function blocks are processed,
followed by the next normal command.
Usage
sdi_xicmd( )
is typically used during error handling.
In contrast to an operation using an
sfb(D4sdi),
operations using an scb send the job
to the requested logical unit.
Coming in at immediate-priority,
operations using an sfb are executed
in the order submitted and take priority
over scb operations.
Only one instance of each immediate command
type (SFB_TYPE or ISCB_TYPE) may be
outstanding to a particular logical unit.
The command block must be allocated from
the host adapter pool of command blocks,
and the addresses translated using the
sdi_xtranslate(D3sdi)
function.
Context and synchronization
If flag is set to KM_NOSLEEP,
non-blockable, initialization, or interrupt
context.
If flag is set to KM_SLEEP,
user
context.
Hardware applicability
All
Version applicability
sdi:
4
target drivers
Differences between versions
SDI versions prior to SDI version 4
use the
sdi_icmd( )
function, which cannot be used with
extended SCSI addresses,
rather than
sdi_icmd( ).
The syntax is:
int sdi_icmd(struct sb *pt, int flag);
sdi_icmd( )
requests are translated with the
sdi_translate(D3sdi)
function rather than
sdi_xtranslate( ).
References
sb(D4sdi),
scb(D4sdi),
sdi_xtranslate(D3sdi),
sfb(D4sdi)
``Extended SCSI addressing scheme'' in HDK Technical Reference
Examples
The following example shows how an sb
is re-sent using
sdi_xicmd( )
when the
sc_comp_code(D5sdi)
is set to SDI_RETRY to indicate
that a retry is requested.
diskint( )
is an example of a disk target driver interrupt routine.
void
diskint(sb_ptr)
struct sb *sb_ptr;
{
...
/* Check the completion code of the SCB to see if the
* command needs to be retried.
*/
if (sb_ptr->SCB.sc_comp_code & SDI_RETRY )
{
/* Retry the command request using sdi_xicmd */
if (sdi_xicmd(HBA_EXT_ADDRESS, sb_ptr, flag) != SDI_RET_OK)
{
/* If the return value of sdi_xicmd is not OK,
* print an error message.
*/
cmn_err(CE_WARN, "DISK: Bad SB type to SDI.");
}
return;
}
...
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005