Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
dma-coherent.c File Reference
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/dma-mapping.h>

Go to the source code of this file.

Data Structures

struct  dma_coherent_mem
 

Functions

int dma_declare_coherent_memory (struct device *dev, dma_addr_t bus_addr, dma_addr_t device_addr, size_t size, int flags)
 
 EXPORT_SYMBOL (dma_declare_coherent_memory)
 
void dma_release_declared_memory (struct device *dev)
 
 EXPORT_SYMBOL (dma_release_declared_memory)
 
voiddma_mark_declared_memory_occupied (struct device *dev, dma_addr_t device_addr, size_t size)
 
 EXPORT_SYMBOL (dma_mark_declared_memory_occupied)
 
int dma_alloc_from_coherent (struct device *dev, ssize_t size, dma_addr_t *dma_handle, void **ret)
 
 EXPORT_SYMBOL (dma_alloc_from_coherent)
 
int dma_release_from_coherent (struct device *dev, int order, void *vaddr)
 
 EXPORT_SYMBOL (dma_release_from_coherent)
 
int dma_mmap_from_coherent (struct device *dev, struct vm_area_struct *vma, void *vaddr, size_t size, int *ret)
 
 EXPORT_SYMBOL (dma_mmap_from_coherent)
 

Function Documentation

int dma_alloc_from_coherent ( struct device dev,
ssize_t  size,
dma_addr_t dma_handle,
void **  ret 
)

dma_alloc_from_coherent() - try to allocate memory from the per-device coherent area

: device from which we allocate memory : size of requested memory area : This will be filled with the correct dma handle : This pointer will be filled with the virtual address to allocated area.

This function should be only called from per-arch dma_alloc_coherent() to support allocation from per-device coherent memory pools.

Returns 0 if dma_alloc_coherent should continue with allocating from generic memory areas, or !0 if dma_alloc_coherent should return .

Definition at line 113 of file dma-coherent.c.

int dma_declare_coherent_memory ( struct device dev,
dma_addr_t  bus_addr,
dma_addr_t  device_addr,
size_t  size,
int  flags 
)

Definition at line 19 of file dma-coherent.c.

void* dma_mark_declared_memory_occupied ( struct device dev,
dma_addr_t  device_addr,
size_t  size 
)

Definition at line 79 of file dma-coherent.c.

int dma_mmap_from_coherent ( struct device dev,
struct vm_area_struct vma,
void vaddr,
size_t  size,
int ret 
)

dma_mmap_from_coherent() - try to mmap the memory allocated from per-device coherent memory pool to userspace : device from which the memory was allocated : vm_area for the userspace memory : cpu address returned by dma_alloc_from_coherent : size of the memory buffer allocated by dma_alloc_from_coherent : result from remap_pfn_range()

This checks whether the memory was allocated from the per-device coherent memory pool and if so, maps that memory to the provided vma.

Returns 1 if we correctly mapped the memory, or 0 if the caller should proceed with mapping memory from generic pools.

Definition at line 197 of file dma-coherent.c.

void dma_release_declared_memory ( struct device dev)

Definition at line 66 of file dma-coherent.c.

int dma_release_from_coherent ( struct device dev,
int  order,
void vaddr 
)

dma_release_from_coherent() - try to free the memory allocated from per-device coherent memory pool : device from which the memory was allocated : the order of pages allocated : virtual address of allocated pages

This checks whether the memory was allocated from the per-device coherent memory pool and if so, releases that memory.

Returns 1 if we correctly released the memory, or 0 if dma_release_coherent() should proceed with releasing memory from generic pools.

Definition at line 167 of file dma-coherent.c.

EXPORT_SYMBOL ( dma_declare_coherent_memory  )
EXPORT_SYMBOL ( dma_release_declared_memory  )
EXPORT_SYMBOL ( dma_mark_declared_memory_occupied  )
EXPORT_SYMBOL ( dma_alloc_from_coherent  )
EXPORT_SYMBOL ( dma_release_from_coherent  )
EXPORT_SYMBOL ( dma_mmap_from_coherent  )