DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

sdi_xtranslate(D3sdi)


sdi_xtranslate -- translate scb virtual to physical address for HBA

Synopsis

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

int sdi_xtranslate(int hbaflag, struct sb *pt, int bflags, proc_t *procp, int sleepflag);

Description

sdi_xtranslate( ) allows SDI to perform base level virtual-to-physical address translation for the HBA.

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) structure.

bflags
b_flags member of the buf(D4) structure.

procp
Pointer to the procp_t process pointer.

sleepflag
Indicates whether the translation may block or not. Valid values are KM_SLEEP and KM_NOSLEEP.

Return values

On success, sdi_xtranslate( ) returns SDI_RET_OK. On failure, it returns SDI_RET_RETRY.

Usage

sdi_xtranslate( ) must be called each time an scb(D4sdi) is assembled for transmission before the sdi_xsend(D3sdi), or sdi_xicmd(D3sdi) functions are called. The sb_type, sc_cmdpt, sc_cmdsz, sc_datapt, sc_datasz, and sc_link members must be valid.

The bflags argument is the same as the b_flags member of the buf(D4) structure. The B_READ and B_PHYS x flags are used by sdi_xtranslate( ). The data area is guaranteed to be locked into memory, either by the target driver, which calls the appropriate DDI function in the case of B_PHYS requests, or by the kernel in the case of block reads or writes. sdi_xtranslate( ) should not be called if the data address is supplied by SDI.

It is the CDB aspect of the scb that requires translation; therefore, the sfb must never be run through sdi_xtranslate( ). Another important consideration is that, if the data area is not a contiguous segment of memory, the B_PHYS flag must be set, especially when allocating more than 2K (2048 bytes) of memory.

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 HBA drivers

Differences between versions

SDI versions prior to SDI version 4 use the sdi_translate( ) function, which cannot be used with extended SCSI addresses, rather than sdi_xtranslate( ). The syntax is:
   int sdi_translate(struct sb *pt,
           int bflags, proc_t *procp,
           int flag);

References

buf(D4), sb(D4sdi), scb(D4sdi), sdi_xicmd(D3sdi), sdi_xsend(D3sdi)

Examples

In this example, the values that must be initialized before the call to sdi_xtranslate( ) or sdi_translate( ) are set in the sb structure.

The coding for sdi_translate( ) is the same.

      struct sb  *sb_ptr;     /* SCSI Block */
      struct scb *scb;        /* SCSI control block */
      struct scs *cmd;        /* SCSI command */
      buf_t  *bp;             /* Buffer pointer */
      char *buffer;           /* Buffer for data */
      unsigned int size;      /* Size of the buffer */
      unsigned short mode;    /* Direction of the transfer */
     
      ...
   

/* Set the command address and the command size */ scb->sc_cmdpt = SCS_AD(cmd); scb->sc_cmdsz = SCS_SZ;

/* Set the data address and the data size */ scb->sc_datapt = buffer; scb->sc_datasz = size;

sdi_xtranslate(HBA_EXT_ADDRESS, sb_ptr, bp->b_flags, procp(), flag); ...


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