Linux Kernel
3.7.1
|
Go to the source code of this file.
Data Structures | |
struct | cvmx_bootmem_block_header |
struct | cvmx_bootmem_named_block_desc |
struct | cvmx_bootmem_desc |
Macros | |
#define | CVMX_BOOTMEM_NAME_LEN 128 |
#define | CVMX_BOOTMEM_NUM_NAMED_BLOCKS 64 |
#define | CVMX_BOOTMEM_ALIGNMENT_SIZE (16ull) |
#define | CVMX_BOOTMEM_FLAG_END_ALLOC (1 << 0) |
#define | CVMX_BOOTMEM_FLAG_NO_LOCKING (1 << 1) |
#define | CVMX_BOOTMEM_DESC_MAJ_VER 3 |
#define | CVMX_BOOTMEM_DESC_MIN_VER 0 |
Functions | |
int | cvmx_bootmem_init (void *mem_desc_ptr) |
void * | cvmx_bootmem_alloc (uint64_t size, uint64_t alignment) |
void * | cvmx_bootmem_alloc_address (uint64_t size, uint64_t address, uint64_t alignment) |
void * | cvmx_bootmem_alloc_range (uint64_t size, uint64_t alignment, uint64_t min_addr, uint64_t max_addr) |
: name of block - must be less than CVMX_BOOTMEM_NAME_LEN bytes | |
Allocate a block of memory from a specific range of the free list that was passed to the application by the bootloader, and assign it a name in the global named block table. (part of the cvmx_bootmem_descriptor_t structure) Named blocks can later be freed. If request cannot be satisfied within the address range specified, NULL is returned : Size in bytes of block to allocate : minimum address of range : maximum address of range : Alignment of memory to be allocated. (must be a power of 2) Returns a pointer to block of memory, NULL on error | |
void * | cvmx_bootmem_alloc_named (uint64_t size, uint64_t alignment, char *name) |
void * | cvmx_bootmem_alloc_named_range (uint64_t size, uint64_t min_addr, uint64_t max_addr, uint64_t align, char *name) |
int | cvmx_bootmem_free_named (char *name) |
: name of block - must be less than CVMX_BOOTMEM_NAME_LEN | |
Allocate a block of memory from the free list that was passed to the application by the bootloader, and assign it a name in the global named block table. (part of the cvmx_bootmem_descriptor_t structure) Named blocks can later be freed. : Size in bytes of block to allocate : Physical address to allocate memory at. If this memory is not available, the allocation fails. bytes Returns a pointer to block of memory, NULL on error | |
void * | cvmx_bootmem_alloc_named_address (uint64_t size, uint64_t address, char *name) |
: name of block to free | |
Frees a named block. : flags for passing options Returns 0 on failure 1 on success | |
struct cvmx_bootmem_named_block_desc * | cvmx_bootmem_find_named_block (char *name) |
int64_t | cvmx_bootmem_phy_alloc (uint64_t req_size, uint64_t address_min, uint64_t address_max, uint64_t alignment, uint32_t flags) |
int64_t | cvmx_bootmem_phy_named_block_alloc (uint64_t size, uint64_t min_addr, uint64_t max_addr, uint64_t alignment, char *name, uint32_t flags) |
int | cvmx_bootmem_phy_named_block_free (char *name, uint32_t flags) |
int | __cvmx_bootmem_phy_free (uint64_t phy_addr, uint64_t size, uint32_t flags) |
void | cvmx_bootmem_lock (void) |
void | cvmx_bootmem_unlock (void) |
: Name of memory block to find. If NULL pointer given, then | |
Finds a named memory block by name. Also used for finding an unused entry in the named block table. finds unused descriptor, if available. : Flags to control options for the allocation. Returns Pointer to memory block descriptor, NULL if not found. If NULL returned when name parameter is NULL, then no memory block descriptors are available. | |
struct cvmx_bootmem_named_block_desc * | cvmx_bootmem_phy_named_block_find (char *name, uint32_t flags) |
#define CVMX_BOOTMEM_ALIGNMENT_SIZE (16ull) |
Definition at line 42 of file cvmx-bootmem.h.
#define CVMX_BOOTMEM_DESC_MAJ_VER 3 |
Definition at line 89 of file cvmx-bootmem.h.
#define CVMX_BOOTMEM_DESC_MIN_VER 0 |
Definition at line 92 of file cvmx-bootmem.h.
#define CVMX_BOOTMEM_FLAG_END_ALLOC (1 << 0) |
Definition at line 46 of file cvmx-bootmem.h.
#define CVMX_BOOTMEM_FLAG_NO_LOCKING (1 << 1) |
Definition at line 49 of file cvmx-bootmem.h.
#define CVMX_BOOTMEM_NAME_LEN 128 |
Definition at line 36 of file cvmx-bootmem.h.
#define CVMX_BOOTMEM_NUM_NAMED_BLOCKS 64 |
Definition at line 39 of file cvmx-bootmem.h.
Frees a block to the bootmem allocator list. This must be used with care, as the size provided must match the size of the block that was allocated, or the list will become corrupted.
IMPORTANT: This is only intended to be used as part of named block frees and initial population of the free memory list.
Returns 1 on success, 0 on failure
Definition at line 398 of file cvmx-bootmem.c.
Allocate a block of memory from the free list that was passed to the application by the bootloader. This is an allocate-only algorithm, so freeing memory is not possible.
: Size in bytes of block to allocate : Alignment required - must be power of 2
Returns pointer to block of memory, NULL on error
Definition at line 96 of file cvmx-bootmem.c.
Allocate a block of memory from the free list that was passed to the application by the bootloader at a specific address. This is an allocate-only algorithm, so freeing memory is not possible. Allocation will fail if memory cannot be allocated at the specified address.
: Size in bytes of block to allocate : Physical address to allocate memory at. If this memory is not available, the allocation fails. : Alignment required - must be power of 2 Returns pointer to block of memory, NULL on error
Definition at line 89 of file cvmx-bootmem.c.
Definition at line 122 of file cvmx-bootmem.c.
Definition at line 115 of file cvmx-bootmem.c.
void* cvmx_bootmem_alloc_named_range | ( | uint64_t | size, |
uint64_t | min_addr, | ||
uint64_t | max_addr, | ||
uint64_t | align, | ||
char * | name | ||
) |
Definition at line 101 of file cvmx-bootmem.c.
void* cvmx_bootmem_alloc_range | ( | uint64_t | size, |
uint64_t | alignment, | ||
uint64_t | min_addr, | ||
uint64_t | max_addr | ||
) |
Allocate a block of memory from the free list that was passed to the application by the bootloader within a specified address range. This is an allocate-only algorithm, so freeing memory is not possible. Allocation will fail if memory cannot be allocated in the requested range.
: Size in bytes of block to allocate : defines the minimum address of the range : defines the maximum address of the range : Alignment required - must be power of 2 Returns pointer to block of memory, NULL on error
Definition at line 76 of file cvmx-bootmem.c.
|
read |
Definition at line 133 of file cvmx-bootmem.c.
Definition at line 128 of file cvmx-bootmem.c.
Initialize the boot alloc memory structures. This is normally called inside of cvmx_user_app_init()
: Address of the free memory list
Definition at line 149 of file cvmx-bootmem.c.
Locks the bootmem allocator. This is useful in certain situations where multiple allocations must be made without being interrupted. This should be used with the CVMX_BOOTMEM_FLAG_NO_LOCKING flag.
Definition at line 139 of file cvmx-bootmem.c.
int64_t cvmx_bootmem_phy_alloc | ( | uint64_t | req_size, |
uint64_t | address_min, | ||
uint64_t | address_max, | ||
uint64_t | alignment, | ||
uint32_t | flags | ||
) |
Allocates a block of physical memory from the free list, at (optional) requested address and alignment.
: size of region to allocate. All requests are rounded up to be a multiple CVMX_BOOTMEM_ALIGNMENT_SIZE bytes size
: Minimum address that block can occupy.
: Specifies the maximum address_min (inclusive) that the allocation can use.
: Requested alignment of the block. If this alignment cannot be met, the allocation fails. This must be a power of 2. (Note: Alignment of CVMX_BOOTMEM_ALIGNMENT_SIZE bytes is required, and internally enforced. Requested alignments of less than CVMX_BOOTMEM_ALIGNMENT_SIZE are set to CVMX_BOOTMEM_ALIGNMENT_SIZE.)
: Flags to control options for the allocation.
Returns physical address of block allocated, or -1 on failure
Definition at line 185 of file cvmx-bootmem.c.
int64_t cvmx_bootmem_phy_named_block_alloc | ( | uint64_t | size, |
uint64_t | min_addr, | ||
uint64_t | max_addr, | ||
uint64_t | alignment, | ||
char * | name, | ||
uint32_t | flags | ||
) |
Allocates a named block of physical memory from the free list, at (optional) requested address and alignment.
size | size of region to allocate. All requests are rounded up to be a multiple CVMX_BOOTMEM_ALIGNMENT_SIZE bytes size |
min_addr | Minimum address that block can occupy. |
max_addr | Specifies the maximum address_min (inclusive) that the allocation can use. |
alignment | Requested alignment of the block. If this alignment cannot be met, the allocation fails. This must be a power of 2. (Note: Alignment of CVMX_BOOTMEM_ALIGNMENT_SIZE bytes is required, and internally enforced. Requested alignments of less than CVMX_BOOTMEM_ALIGNMENT_SIZE are set to CVMX_BOOTMEM_ALIGNMENT_SIZE.) |
name | name to assign to named block |
flags | Flags to control options for the allocation. |
Definition at line 617 of file cvmx-bootmem.c.
|
read |
Definition at line 522 of file cvmx-bootmem.c.
Definition at line 573 of file cvmx-bootmem.c.