DDI_UMEM_IOSETUP(9F) Kernel Functions for Drivers DDI_UMEM_IOSETUP(9F)
ddi_umem_iosetup - Setup I/O requests to application memory
#include <sys/sunddi.h> struct buf *ddi_umem_iosetup
, int direction
, dev_t dev
, daddr_t blkno
int (*iodone) (struct buf *), int sleepflag
Solaris DDI specific (Solaris DDI)
The kernel memory cookie allocated by ddi_umem_lock(9F)
Offset from the start of the cookie. len
Length of the I/O request in bytes. direction
Must be set to B_READ
for reads from the device or B_WRITE
for writes to the device. dev
Device number blkno
Block number on device. iodone
Determines whether caller can sleep for memory. Possible
flags are DDI_UMEM_SLEEP
to allow sleeping until memory is
available, or DDI_UMEM_NOSLEEP
to return NULL
if memory is not available.
function is used by drivers to setup I/O
requests to application memory which has been locked down using ddi_umem_lock(9F)
function returns a pointer to a buf(9S)
structure corresponding to the memory cookie cookie
. Drivers can setup
multiple buffer structures simultaneously active using the same memory
cookie. The buf(9S)
structures can span all or part of the region
represented by the cookie and can overlap each other. The buf(9S)
structure can be passed to ddi_dma_buf_bind_handle(9F)
to initiate DMA
transfers to or from the locked down memory.
parameter specifies the offset from the start of the cookie. The len
parameter represents the length of region to be mapped by the buffer.
parameter must be set to either B_READ
indicate the action that will be performed by the device. (Note that
this direction is in the opposite sense of the VM system's direction of DDI_UMEMLOCK_READ
.) The direction must be
compatible with the flags used to create the memory cookie in ddi_umem_lock(9F)
. For example, if ddi_umem_lock()
is called with the flags
parameter set to DDI_UMEMLOCK_READ, the direction
parameter in ddi_umem_iosetup()
should be set to B_WRITE
parameter specifies the device to which the buffer is to perform
parameter represents the block number on the device. It
will be assigned to the b_blkno
field of the returned buffer structure.
parameter enables the driver to identify a specific biodone(9F)
routine to be called by the driver when the I/O is complete.
parameter determines if the caller can sleep for memory. DDI_UMEM_SLEEP
allocations may sleep but are guaranteed to succeed. DDI_UMEM_NOSLEEP
allocations do not sleep but may fail (return NULL
memory is currently not available.
After the I/O has completed and the buffer structure is no longer needed,
the driver calls freerbuf(9F)
to free the buffer structure.
function returns a pointer to the initialized
buffer header, or NULL
if no space is available.
function can be called from any context only if
flag is set to DDI_UMEM_NOSLEEP
. If DDI_UMEM_SLEEP
is set, ddi_umem_iosetup(9F)
can be called from user and kernel context only.
SEE ALSO ddi_umem_lock(9F)
February 4, 2003 DDI_UMEM_IOSETUP(9F)