Linux Kernel
3.7.1
|
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/dma-buf.h>
#include <linux/anon_inodes.h>
#include <linux/export.h>
Go to the source code of this file.
dma_buf_attach - Add the device to dma_buf's attachments list; optionally, calls attach() of dma_buf_ops to allow device-specific attach functionality : [in] buffer to attach device to. : [in] device to be attached.
Returns struct dma_buf_attachment * for this attachment; may return negative error codes.
int dma_buf_begin_cpu_access | ( | struct dma_buf * | dmabuf, |
size_t | start, | ||
size_t | len, | ||
enum dma_data_direction | direction | ||
) |
dma_buf_begin_cpu_access - Must be called before accessing a dma_buf from the cpu in the kernel context. Calls begin_cpu_access to allow exporter-specific preparations. Coherency is only guaranteed in the specified range for the specified access direction. : [in] buffer to prepare cpu access for. : [in] start of range for cpu access. : [in] length of range for cpu access. : [in] length of range for cpu access.
Can return negative error values, returns 0 on success.
void dma_buf_detach | ( | struct dma_buf * | dmabuf, |
struct dma_buf_attachment * | attach | ||
) |
dma_buf_detach - Remove the given attachment from dmabuf's attachments list; optionally calls detach() of dma_buf_ops for device-specific detach : [in] buffer to detach from. : [in] attachment to be detached; is free'd after this call.
void dma_buf_end_cpu_access | ( | struct dma_buf * | dmabuf, |
size_t | start, | ||
size_t | len, | ||
enum dma_data_direction | direction | ||
) |
dma_buf_end_cpu_access - Must be called after accessing a dma_buf from the cpu in the kernel context. Calls end_cpu_access to allow exporter-specific actions. Coherency is only guaranteed in the specified range for the specified access direction. : [in] buffer to complete cpu access for. : [in] start of range for cpu access. : [in] length of range for cpu access. : [in] length of range for cpu access.
This call must always succeed.
|
read |
dma_buf_export - Creates a new dma_buf, and associates an anon file with this buffer, so it can be exported. Also connect the allocator specific data and ops to the buffer.
: [in] Attach private data of allocator to this buffer : [in] Attach allocator-defined dma buf ops to the new buffer. : [in] Size of the buffer : [in] mode flags for the file.
Returns, on success, a newly created dma_buf object, which wraps the supplied private data and operations for dma_buf_ops. On either missing ops, or error in allocating struct dma_buf, will return negative error.
dma_buf_kmap - Map a page of the buffer object into kernel address space. The same restrictions as for kmap and friends apply. : [in] buffer to map page from. : [in] page in PAGE_SIZE units to map.
This call must always succeed, any necessary preparations that might fail need to be done in begin_cpu_access.
dma_buf_kmap_atomic - Map a page of the buffer object into kernel address space. The same restrictions as for kmap_atomic and friends apply. : [in] buffer to map page from. : [in] page in PAGE_SIZE units to map.
This call must always succeed, any necessary preparations that might fail need to be done in begin_cpu_access.
|
read |
dma_buf_map_attachment - Returns the scatterlist table of the attachment; mapped into device address space. Is a wrapper for map_dma_buf() of the dma_buf_ops. : [in] attachment whose scatterlist is to be returned : [in] direction of DMA transfer
Returns sg_table containing the scatterlist to be returned; may return NULL or ERR_PTR.
dma_buf_mmap - Setup up a userspace mmap with the given vma : [in] buffer that should back the vma : [in] vma for the mmap : [in] offset in pages where this mmap should start within the dma-buf buffer.
This function adjusts the passed in vma so that it points at the file of the dma_buf operation. It alsog adjusts the starting pgoff and does bounds checking on the size of the vma. Then it calls the exporters mmap function to set up the mapping.
Can return negative error values, returns 0 on success.
void dma_buf_unmap_attachment | ( | struct dma_buf_attachment * | attach, |
struct sg_table * | sg_table, | ||
enum dma_data_direction | direction | ||
) |
dma_buf_unmap_attachment - unmaps and decreases usecount of the buffer;might deallocate the scatterlist associated. Is a wrapper for unmap_dma_buf() of dma_buf_ops. : [in] attachment to unmap buffer from : [in] scatterlist info of the buffer to unmap : [in] direction of DMA transfer
dma_buf_vmap - Create virtual mapping for the buffer object into kernel address space. Same restrictions as for vmap and friends apply. : [in] buffer to vmap
This call may fail due to lack of virtual mapping address space. These calls are optional in drivers. The intended use for them is for mapping objects linear in kernel space for high use objects. Please attempt to use kmap/kunmap before thinking about these interfaces.
EXPORT_SYMBOL_GPL | ( | dma_buf_export | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_fd | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_get | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_put | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_attach | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_detach | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_map_attachment | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_unmap_attachment | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_begin_cpu_access | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_end_cpu_access | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_kmap_atomic | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_kunmap_atomic | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_kmap | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_kunmap | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_mmap | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_vmap | ) |
EXPORT_SYMBOL_GPL | ( | dma_buf_vunmap | ) |