ddi_dma_addr_bind_handle - binds an address to a DMA handle
#include <sys/ddi.h> #include <sys/sunddi.h> int ddi_dma_addr_bind_handle(ddi_dma_handle_t handle, struct as *as, caddr_t addr, size_t len, uint_t flags, int (*callback) (caddr_t) , caddr_t arg, ddi_dma_cookie_t *cookiep, uint_t *ccountp);
Solaris DDI specific (Solaris DDI).
handle
as
addr
len
flags
DDI_DMA_WRITE
DDI_DMA_READ
DDI_DMA_RDWR
DDI_DMA_REDZONE
DDI_DMA_PARTIAL
DDI_DMA_CONSISTENT
DDI_DMA_STREAMING
callback
DDI_DMA_SLEEP
DDI_DMA_DONTWAIT
arg
cookiep
ccountp
ddi_dma_addr_bind_handle() allocates DMA resources for a memory object such that a device can perform DMA to or from the object. DMA resources are allocated considering the device's DMA attributes as expressed by ddi_dma_attr(9S) (see ddi_dma_alloc_handle(9F)).
ddi_dma_addr_bind_handle() fills in the first DMA cookie pointed to by cookiep with the appropriate address, length, and bus type. *ccountp is set to the number of DMA cookies representing this DMA object. Subsequent DMA cookies must be retrieved by calling ddi_dma_nextcookie(9F) the number of times specified by *countp-1.
When a DMA transfer completes, the driver frees up system DMA resources by calling ddi_dma_unbind_handle(9F).
The flags argument contains information for mapping routines.
DDI_DMA_WRITE, DDI_DMA_READ, DDI_DMA_RDWR
DDI_DMA_STREAMING
DDI_DMA_CONSISTENT
DDI_DMA_REDZONE
DDI_DMA_PARTIAL
The callback function callback indicates how a caller wants to handle the possibility of resources not being available. If callback is set to DDI_DMA_DONTWAIT, the caller does not care if the allocation fails, and can handle an allocation failure appropriately. If callback is set to DDI_DMA_SLEEP, the caller wishes to have the allocation routines wait for resources to become available. If any other value is set and a DMA resource allocation fails, this value is assumed to be the address of a function to be called when resources become available. When the specified function is called, arg is passed to it as an argument. The specified callback function must return either DDI_DMA_CALLBACK_RUNOUT or DDI_DMA_CALLBACK_DONE. DDI_DMA_CALLBACK_RUNOUT indicates that the callback function attempted to allocate DMA resources but failed. In this case, the callback function is put back on a list to be called again later. DDI_DMA_CALLBACK_DONE indicates that either the allocation of DMA resources was successful or the driver no longer wishes to retry.
The callback function is called in interrupt context. Therefore, only system functions accessible from interrupt context are be available. The callback function must take whatever steps are necessary to protect its critical resources, data structures, queues, and so on.
ddi_dma_addr_bind_handle() returns:
DDI_DMA_MAPPED
DDI_DMA_PARTIAL_MAP
DDI_DMA_INUSE
DDI_DMA_NORESOURCES
DDI_DMA_NOMAPPING
DDI_DMA_TOOBIG
ddi_dma_addr_bind_handle() can be called from user, kernel, or interrupt context, except when callback is set to DDI_DMA_SLEEP, in which case it can only be called from user or kernel context.
ddi_dma_alloc_handle(9F), ddi_dma_free_handle(9F), ddi_dma_getwin(9F), ddi_dma_mem_alloc(9F), ddi_dma_mem_free(9F), ddi_dma_nextcookie(9F), ddi_dma_sync(9F), ddi_dma_unbind_handle(9F), ddi_umem_iosetup(9F), ddi_dma_attr(9S), ddi_dma_cookie(9S)
If the driver permits partial mapping with the DDI_DMA_PARTIAL flag, the number of cookies in each window may exceed the size of the device's scatter/gather list as specified in the dma_attr_sgllen field in the ddi_dma_attr(9S) structure. In this case, each set of cookies comprising a DMA window will satisfy the DMA attributes as described in the ddi_dma_attr(9S) structure in all aspects. The driver should set up its DMA engine and perform one transfer for each set of cookies sufficient for its scatter/gather list, up to the number of cookies for this window, before advancing to the next window using ddi_dma_getwin(9F).
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |