Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
dma-contiguous.c File Reference
#include <asm/page.h>
#include <asm/dma-contiguous.h>
#include <linux/memblock.h>
#include <linux/err.h>
#include <linux/mm.h>
#include <linux/mutex.h>
#include <linux/page-isolation.h>
#include <linux/sizes.h>
#include <linux/slab.h>
#include <linux/swap.h>
#include <linux/mm_types.h>
#include <linux/dma-contiguous.h>

Go to the source code of this file.

Data Structures

struct  cma
 
struct  cma_reserved
 

Macros

#define pr_fmt(fmt)   "cma: " fmt
 
#define CMA_SIZE_MBYTES   0
 

Functions

 early_param ("cma", early_cma)
 
void __init dma_contiguous_reserve (phys_addr_t limit)
 
 core_initcall (cma_init_reserved_areas)
 
int __init dma_declare_contiguous (struct device *dev, unsigned long size, phys_addr_t base, phys_addr_t limit)
 
struct pagedma_alloc_from_contiguous (struct device *dev, int count, unsigned int align)
 
bool dma_release_from_contiguous (struct device *dev, struct page *pages, int count)
 

Variables

struct cmadma_contiguous_default_area
 

Macro Definition Documentation

#define CMA_SIZE_MBYTES   0

Definition at line 47 of file dma-contiguous.c.

#define pr_fmt (   fmt)    "cma: " fmt

Definition at line 14 of file dma-contiguous.c.

Function Documentation

core_initcall ( cma_init_reserved_areas  )
struct page* dma_alloc_from_contiguous ( struct device dev,
int  count,
unsigned int  align 
)
read

dma_alloc_from_contiguous() - allocate pages from contiguous area : Pointer to device for which the allocation is performed. : Requested number of pages. : Requested alignment of pages (in PAGE_SIZE order).

This function allocates memory buffer for specified device. It uses device specific contiguous memory area if available or the default global one. Requires architecture specific get_dev_cma_area() helper function.

Definition at line 310 of file dma-contiguous.c.

void __init dma_contiguous_reserve ( phys_addr_t  limit)

dma_contiguous_reserve() - reserve area for contiguous memory handling : End address of the reserved memory (optional, 0 for any).

This function reserves memory from early allocator. It should be called by arch specific code once the early allocator (memblock or bootmem) has been activated and all other subsystems have already allocated/reserved memory.

Definition at line 107 of file dma-contiguous.c.

int __init dma_declare_contiguous ( struct device dev,
unsigned long  size,
phys_addr_t  base,
phys_addr_t  limit 
)

dma_declare_contiguous() - reserve area for contiguous memory handling for particular device : Pointer to device structure. : Size of the reserved memory. : Start address of the reserved memory (optional, 0 for any). : End address of the reserved memory (optional, 0 for any).

This function reserves memory for specified device. It should be called by board specific code when early allocator (memblock or bootmem) is still activate.

Definition at line 230 of file dma-contiguous.c.

bool dma_release_from_contiguous ( struct device dev,
struct page pages,
int  count 
)

dma_release_from_contiguous() - release allocated pages : Pointer to device for which the pages were allocated. : Allocated pages. : Number of allocated pages.

This function releases memory allocated by dma_alloc_from_contiguous(). It returns false when provided pages do not belong to contiguous area and true otherwise.

Definition at line 370 of file dma-contiguous.c.

early_param ( "cma"  ,
early_cma   
)

Variable Documentation

struct cma* dma_contiguous_default_area

Definition at line 42 of file dma-contiguous.c.