DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

sdi_xsend(D3sdi)


sdi_xsend -- send SCSI control block to HBA in FIFO order

Synopsis

   #include <sys/types.h>
   #include <sys/sdi.h>
   #include <sys/ddi.h>
   

int sdi_xsend(int hbaflag, struct sb *pt, int sleepflag);

Description

sdi_xsend( ) sends a pointer to an sb(D4sdi) SCSI control block to the HBA, in FIFO order and send the command to the controller for routing to a specific device. Use the sdi_xsend( ) function for devices that support extended SCSI addressing.

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.

sleepflag
Indicates whether the allocation may block or not. Valid values are KM_SLEEP and 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. The value SDI_RET_ENTRY indicates that SDI cannot accept the job at this time and that it should be retried later. SDI_RET_ER indicates that the sb_type member of the sb structure is invalid. When a device is opened for pass-through access, SDI_RET_ENTRY is returned.

Usage

The command block must be allocated from the host adapter pool of command blocks and the addresses translated using the sdi_xtranslate(D3sdi) function. The sb_type member of the sb structure must be SCB_TYPE. Commands sent throgh this function are executed in the order they are received.

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_send( ) function, which cannot be used with extended SCSI addresses, rather than sdi_xsend( ). The syntax is:
   long sdi_send(struct sb *pt, int flag);
The address for sdi_send( ) requests must be translated with the sdi_translate(D3sdi) function.

References

sb(D4sdi), sdi_icmd(D3sdi), sdi_translate(D3sdi), sdi_xicmd(D3sdi), sdi_xtranslate(D3sdi)

Examples

This example illustrates how the sdi_send( ) function is called; similar coding would be used for the sdi_xsend( ) function.

disksend( ) is an example disk target driver routine, called interinally within the target driver to send a command to a device. It is passed a pointer to an sb(D4sdi) command block.

   disksend(sb_ptr)
   struct sb *sb_ptr;
   {
           int sendret;        /* sdi_send return value */
           extern int sendid;  /* timeout ID for retry  */
   

/* Call sdi_send with the SB pointer for the job */ if ((sendret = sdi_send(sb_ptr, flag)) != SDI_RET_OK) { /* If sdi_send returned retry, set up a timeout to * submit the job later */ if (sendret == SDI_RET_RETRY) { /* Call timeout and save the ID */ sendid = timeout(disksendt, sb_ptr, LATER); return; }
else { /* The Host Adapter driver could not process the job. * Print an error message. */ cmn_err(CE_WARN, "DISK: Bad SB type to SDI. "); continue; } } ...


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005