|
|
#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);
b_flags member of the
buf(D4)
structure.
procp_t process pointer.
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.
If flag is set to KM_SLEEP, user context.
int sdi_translate(struct sb *pt,
int bflags, proc_t *procp,
int flag);
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);
...