Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sdi_translate(D3I) — UnixWare 2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought






       sdi_translate(D3I)                                sdi_translate(D3I)


       NAME
             sdi_translate - translate scb virtual to physical address for
             a PDI Host Bus Adapter (HBA) driver

       SYNOPSIS
             #include <sys/sdi.h>
             int sdi_translate(struct sb *pt, int bflags, proc_t *procp, int flag);

          Arguments
             pt    Pointer to the sb structure.

             bflags
                   The b_flags member of the buf_t (buffer header)
                   structure.

             procp Pointer to the procp_t process pointer.

             flag  Indicates whether the translation may sleep or not, and
                   is set to either KM_SLEEP or KM_NOSLEEP.

       DESCRIPTION
             sdi_translate allows PDI to perform machine-specific base
             level virtual to physical address translation for the host
             adapter.

          Return Values
             On success, sdi_translate returns SDI_RET_OK.  On failure, it
             returns SDI_RET_RETRY.

       USAGE
             sdi_translate must be called each time an scb is assembled for
             transmission before the sdi_send or sdi_icmd functions are
             called.  The sb_type, sc_cmdpt, sc_cmdsz, sc_datapt,
             sc_datasz, and sc_link field parameters must be valid.  The
             bflags argument is the same as the b_flags member of the
             buf(D4) buf_t structure.  The B_READ and B_PHYS flags are used
             by sdi_translate.  The data area is guaranteed to be locked
             into memory, either by the target driver, which calls the
             appropriate DDI/DKI routine in the case of B_PHYS requests, or
             by the kernel in the case of block reads or writes.
             sdi_translate should not be called if the data address is
             supplied by PDI.

             It is the CDB aspect of the scb that requires translation;
             therefore, the sfb must never be run through sdi_translate.
             Another important consideration is that if the data area is


                           Copyright 1994 Novell, Inc.               Page 1













      sdi_translate(D3I)                                sdi_translate(D3I)


            not a contiguous segment of memory, the B_PHYS flag must be
            set, especially when allocating more than 2K (2048 bytes) of
            memory.  (This flag is defined in ddi.h.)

         Level
            Base or Interrupt.

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


               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_translate(sb_ptr, bp->b_flags, procp(), flag);

               ...

      REFERENCES
            buf(D4), sb(D4I), scb(D4I), sdi_icmd(D3I), sdi_send(D3I)

      NOTICES
         Applicability
            sdi: 1, 2








                          Copyright 1994 Novell, Inc.               Page 2








Typewritten Software • bear@typewritten.org • Edmonds, WA 98026