Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
memblock.c File Reference
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/bitops.h>
#include <linux/poison.h>
#include <linux/pfn.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/memblock.h>

Go to the source code of this file.

Functions

phys_addr_t __init_memblock memblock_find_in_range_node (phys_addr_t start, phys_addr_t end, phys_addr_t size, phys_addr_t align, int nid)
 
phys_addr_t __init_memblock memblock_find_in_range (phys_addr_t start, phys_addr_t end, phys_addr_t size, phys_addr_t align)
 
phys_addr_t __init_memblock get_allocated_memblock_reserved_regions_info (phys_addr_t *addr)
 
int __init_memblock memblock_add_node (phys_addr_t base, phys_addr_t size, int nid)
 
int __init_memblock memblock_add (phys_addr_t base, phys_addr_t size)
 
int __init_memblock memblock_remove (phys_addr_t base, phys_addr_t size)
 
int __init_memblock memblock_free (phys_addr_t base, phys_addr_t size)
 
int __init_memblock memblock_reserve (phys_addr_t base, phys_addr_t size)
 
void __init_memblock __next_free_mem_range (u64 *idx, int nid, phys_addr_t *out_start, phys_addr_t *out_end, int *out_nid)
 
void __init_memblock __next_free_mem_range_rev (u64 *idx, int nid, phys_addr_t *out_start, phys_addr_t *out_end, int *out_nid)
 
phys_addr_t __init memblock_alloc_nid (phys_addr_t size, phys_addr_t align, int nid)
 
phys_addr_t __init __memblock_alloc_base (phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
 
phys_addr_t __init memblock_alloc_base (phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
 
phys_addr_t __init memblock_alloc (phys_addr_t size, phys_addr_t align)
 
phys_addr_t __init memblock_alloc_try_nid (phys_addr_t size, phys_addr_t align, int nid)
 
phys_addr_t __init memblock_phys_mem_size (void)
 
phys_addr_t __init_memblock memblock_start_of_DRAM (void)
 
phys_addr_t __init_memblock memblock_end_of_DRAM (void)
 
void __init memblock_enforce_memory_limit (phys_addr_t limit)
 
int __init memblock_is_reserved (phys_addr_t addr)
 
int __init_memblock memblock_is_memory (phys_addr_t addr)
 
int __init_memblock memblock_is_region_memory (phys_addr_t base, phys_addr_t size)
 
int __init_memblock memblock_is_region_reserved (phys_addr_t base, phys_addr_t size)
 
void __init_memblock memblock_trim_memory (phys_addr_t align)
 
void __init_memblock memblock_set_current_limit (phys_addr_t limit)
 
void __init_memblock __memblock_dump_all (void)
 
void __init memblock_allow_resize (void)
 
 early_param ("memblock", early_memblock)
 

Function Documentation

phys_addr_t __init __memblock_alloc_base ( phys_addr_t  size,
phys_addr_t  align,
phys_addr_t  max_addr 
)

Definition at line 788 of file memblock.c.

void __init_memblock __memblock_dump_all ( void  )

Definition at line 986 of file memblock.c.

void __init_memblock __next_free_mem_range ( u64 idx,
int  nid,
phys_addr_t out_start,
phys_addr_t out_end,
int out_nid 
)

__next_free_mem_range - next function for for_each_free_mem_range() : pointer to u64 loop variable : nid: node selector, MAX_NUMNODES for all nodes : ptr to phys_addr_t for start address of the range, can be NULL : ptr to phys_addr_t for end address of the range, can be NULL : ptr to int for nid of the range, can be NULL

Find the first free area from * which matches , fill the out parameters, and update * for the next iteration. The lower 32bit of * contains index into memory region and the upper 32bit indexes the areas before each reserved region. For example, if reserved regions look like the following,

0:[0-16), 1:[32-48), 2:[128-130)

The upper 32bit indexes the following regions.

0:[0-0), 1:[16-32), 2:[48-128), 3:[130-MAX)

As both region arrays are sorted, the function advances the two indices in lockstep and returns each intersection.

Definition at line 587 of file memblock.c.

void __init_memblock __next_free_mem_range_rev ( u64 idx,
int  nid,
phys_addr_t out_start,
phys_addr_t out_end,
int out_nid 
)

__next_free_mem_range_rev - next function for for_each_free_mem_range_reverse() : pointer to u64 loop variable : nid: node selector, MAX_NUMNODES for all nodes : ptr to phys_addr_t for start address of the range, can be NULL : ptr to phys_addr_t for end address of the range, can be NULL : ptr to int for nid of the range, can be NULL

Reverse of __next_free_mem_range().

Definition at line 650 of file memblock.c.

early_param ( "memblock"  ,
early_memblock   
)
phys_addr_t __init_memblock get_allocated_memblock_reserved_regions_info ( phys_addr_t addr)

Definition at line 164 of file memblock.c.

int __init_memblock memblock_add ( phys_addr_t  base,
phys_addr_t  size 
)

Definition at line 443 of file memblock.c.

int __init_memblock memblock_add_node ( phys_addr_t  base,
phys_addr_t  size,
int  nid 
)

Definition at line 437 of file memblock.c.

phys_addr_t __init memblock_alloc ( phys_addr_t  size,
phys_addr_t  align 
)

Definition at line 806 of file memblock.c.

phys_addr_t __init memblock_alloc_base ( phys_addr_t  size,
phys_addr_t  align,
phys_addr_t  max_addr 
)

Definition at line 793 of file memblock.c.

phys_addr_t __init memblock_alloc_nid ( phys_addr_t  size,
phys_addr_t  align,
int  nid 
)

Definition at line 783 of file memblock.c.

phys_addr_t __init memblock_alloc_try_nid ( phys_addr_t  size,
phys_addr_t  align,
int  nid 
)

Definition at line 811 of file memblock.c.

void __init memblock_allow_resize ( void  )

Definition at line 997 of file memblock.c.

phys_addr_t __init_memblock memblock_end_of_DRAM ( void  )

Definition at line 836 of file memblock.c.

void __init memblock_enforce_memory_limit ( phys_addr_t  limit)

Definition at line 843 of file memblock.c.

phys_addr_t __init_memblock memblock_find_in_range ( phys_addr_t  start,
phys_addr_t  end,
phys_addr_t  size,
phys_addr_t  align 
)

memblock_find_in_range - find free area in given range : start of candidate range : end of candidate range, can be MEMBLOCK_ALLOC_{ANYWHERE|ACCESSIBLE} : size of free area to find : alignment of free area to find

Find free area aligned to in the specified range.

RETURNS: Found address on success, %0 on failure.

Definition at line 139 of file memblock.c.

phys_addr_t __init_memblock memblock_find_in_range_node ( phys_addr_t  start,
phys_addr_t  end,
phys_addr_t  size,
phys_addr_t  align,
int  nid 
)

memblock_find_in_range_node - find free area in given range and node : start of candidate range : end of candidate range, can be MEMBLOCK_ALLOC_{ANYWHERE|ACCESSIBLE} : size of free area to find : alignment of free area to find : nid of the free area to find, MAX_NUMNODES for any node

Find free area aligned to in the specified range and node.

RETURNS: Found address on success, %0 on failure.

Definition at line 98 of file memblock.c.

int __init_memblock memblock_free ( phys_addr_t  base,
phys_addr_t  size 
)

Definition at line 542 of file memblock.c.

int __init_memblock memblock_is_memory ( phys_addr_t  addr)

Definition at line 890 of file memblock.c.

int __init_memblock memblock_is_region_memory ( phys_addr_t  base,
phys_addr_t  size 
)

memblock_is_region_memory - check if a region is a subset of memory : base of region to check : size of region to check

Check if the region [, +) is a subset of a memory block.

RETURNS: 0 if false, non-zero if true

Definition at line 905 of file memblock.c.

int __init_memblock memblock_is_region_reserved ( phys_addr_t  base,
phys_addr_t  size 
)

memblock_is_region_reserved - check if a region intersects reserved memory : base of region to check : size of region to check

Check if the region [, +) intersects a reserved memory block.

RETURNS: 0 if false, non-zero if true

Definition at line 927 of file memblock.c.

int __init memblock_is_reserved ( phys_addr_t  addr)

Definition at line 885 of file memblock.c.

phys_addr_t __init memblock_phys_mem_size ( void  )

Definition at line 825 of file memblock.c.

int __init_memblock memblock_remove ( phys_addr_t  base,
phys_addr_t  size 
)

Definition at line 537 of file memblock.c.

int __init_memblock memblock_reserve ( phys_addr_t  base,
phys_addr_t  size 
)

Definition at line 552 of file memblock.c.

void __init_memblock memblock_set_current_limit ( phys_addr_t  limit)

Definition at line 958 of file memblock.c.

phys_addr_t __init_memblock memblock_start_of_DRAM ( void  )

Definition at line 831 of file memblock.c.

void __init_memblock memblock_trim_memory ( phys_addr_t  align)

Definition at line 933 of file memblock.c.