int ddi_dma_mem_alloc(ddi_dma_handle_t handle,
ddi_device_acc_attr_t *accattrp, ulong_t flags,
int (*waitfp)(caddr_t), caddr_t arg, caddr_t *kaddrp,
uint_t *real_length, ddi_acc_handle_t *handlep);
flags should be set to DDI_DMA_STREAMING if the device is doing sequential, unidirectional, block-sized, and block-aligned transfers to or from memory. The alignment and padding constraints specified by the minxfer and burstsizes fields in the DMA attribute structure, ddi_dma_attr.9s (see ddi_dma_alloc_handle.9f will be used to allocate the most effective hardware support for large transfers. For example, if an I/O transfer can be sped up by using an I/O cache, which has a minimum transfer of one cache line, ddi_dma_mem_alloc() will align the memory at a cache line boundary and it will round up *real_length to a multiple of the cache line size.
flags should be set to DDI_DMA_CONSISTENT if the device accesses memory randomly, or if synchronization steps using ddi_dma_sync.9f need to be as efficient as possible. I/O parameter blocks used for communication between a device and a driver should be allocated using DDI_DMA_CONSISTENT.
The device access attributes are specified in the location pointed by the accattrp argument (see ddi_device_acc_attr.9s
The data access handle is returned in handlep. handlep is opaque - drivers may not attempt to interpret its value. To access the data content, the driver must invoke ddi_getb.9f or ddi_getb.9f (depending on the data transfer direction) with the data access handle.
DMA resources must be established before performing a DMA transfer by passing kaddrp and *real_length as returned from ddi_dma_mem_alloc() and the flag DDI_DMA_STREAMING or DDI_DMA_CONSISTENT to ddi_dma_addr_bind_handle.9f In addition, to ensure the consistency of a memory object shared between the CPU and the device after a DMA transfer, explicit synchronization steps using ddi_dma_sync.9f or ddi_dma_unbind_handle.9f are required.
Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).
Last modified 21/April/97