| .. | .. |
|---|
| 146 | 146 | extern int cvmx_bootmem_init(void *mem_desc_ptr); |
|---|
| 147 | 147 | |
|---|
| 148 | 148 | /** |
|---|
| 149 | | - * Allocate a block of memory from the free list that was passed |
|---|
| 150 | | - * to the application by the bootloader. |
|---|
| 151 | | - * This is an allocate-only algorithm, so freeing memory is not possible. |
|---|
| 152 | | - * |
|---|
| 153 | | - * @size: Size in bytes of block to allocate |
|---|
| 154 | | - * @alignment: Alignment required - must be power of 2 |
|---|
| 155 | | - * |
|---|
| 156 | | - * Returns pointer to block of memory, NULL on error |
|---|
| 157 | | - */ |
|---|
| 158 | | -extern void *cvmx_bootmem_alloc(uint64_t size, uint64_t alignment); |
|---|
| 159 | | - |
|---|
| 160 | | -/** |
|---|
| 161 | 149 | * Allocate a block of memory from the free list that was |
|---|
| 162 | 150 | * passed to the application by the bootloader at a specific |
|---|
| 163 | 151 | * address. This is an allocate-only algorithm, so |
|---|
| .. | .. |
|---|
| 172 | 160 | */ |
|---|
| 173 | 161 | extern void *cvmx_bootmem_alloc_address(uint64_t size, uint64_t address, |
|---|
| 174 | 162 | uint64_t alignment); |
|---|
| 175 | | - |
|---|
| 176 | | -/** |
|---|
| 177 | | - * Allocate a block of memory from the free list that was |
|---|
| 178 | | - * passed to the application by the bootloader within a specified |
|---|
| 179 | | - * address range. This is an allocate-only algorithm, so |
|---|
| 180 | | - * freeing memory is not possible. Allocation will fail if |
|---|
| 181 | | - * memory cannot be allocated in the requested range. |
|---|
| 182 | | - * |
|---|
| 183 | | - * @size: Size in bytes of block to allocate |
|---|
| 184 | | - * @min_addr: defines the minimum address of the range |
|---|
| 185 | | - * @max_addr: defines the maximum address of the range |
|---|
| 186 | | - * @alignment: Alignment required - must be power of 2 |
|---|
| 187 | | - * Returns pointer to block of memory, NULL on error |
|---|
| 188 | | - */ |
|---|
| 189 | | -extern void *cvmx_bootmem_alloc_range(uint64_t size, uint64_t alignment, |
|---|
| 190 | | - uint64_t min_addr, uint64_t max_addr); |
|---|
| 191 | 163 | |
|---|
| 192 | 164 | /** |
|---|
| 193 | 165 | * Frees a previously allocated named bootmem block. |
|---|
| .. | .. |
|---|
| 213 | 185 | */ |
|---|
| 214 | 186 | extern void *cvmx_bootmem_alloc_named(uint64_t size, uint64_t alignment, |
|---|
| 215 | 187 | char *name); |
|---|
| 216 | | - |
|---|
| 217 | | - |
|---|
| 218 | | - |
|---|
| 219 | | -/** |
|---|
| 220 | | - * Allocate a block of memory from the free list that was passed |
|---|
| 221 | | - * to the application by the bootloader, and assign it a name in the |
|---|
| 222 | | - * global named block table. (part of the cvmx_bootmem_descriptor_t structure) |
|---|
| 223 | | - * Named blocks can later be freed. |
|---|
| 224 | | - * |
|---|
| 225 | | - * @size: Size in bytes of block to allocate |
|---|
| 226 | | - * @address: Physical address to allocate memory at. If this |
|---|
| 227 | | - * memory is not available, the allocation fails. |
|---|
| 228 | | - * @name: name of block - must be less than CVMX_BOOTMEM_NAME_LEN |
|---|
| 229 | | - * bytes |
|---|
| 230 | | - * |
|---|
| 231 | | - * Returns a pointer to block of memory, NULL on error |
|---|
| 232 | | - */ |
|---|
| 233 | | -extern void *cvmx_bootmem_alloc_named_address(uint64_t size, uint64_t address, |
|---|
| 234 | | - char *name); |
|---|
| 235 | | - |
|---|
| 236 | | - |
|---|
| 237 | 188 | |
|---|
| 238 | 189 | /** |
|---|
| 239 | 190 | * Allocate a block of memory from a specific range of the free list |
|---|
| .. | .. |
|---|
| 349 | 300 | uint64_t max_addr, |
|---|
| 350 | 301 | uint64_t alignment, |
|---|
| 351 | 302 | char *name, uint32_t flags); |
|---|
| 352 | | - |
|---|
| 353 | | -/** |
|---|
| 354 | | - * Finds a named memory block by name. |
|---|
| 355 | | - * Also used for finding an unused entry in the named block table. |
|---|
| 356 | | - * |
|---|
| 357 | | - * @name: Name of memory block to find. If NULL pointer given, then |
|---|
| 358 | | - * finds unused descriptor, if available. |
|---|
| 359 | | - * |
|---|
| 360 | | - * @flags: Flags to control options for the allocation. |
|---|
| 361 | | - * |
|---|
| 362 | | - * Returns Pointer to memory block descriptor, NULL if not found. |
|---|
| 363 | | - * If NULL returned when name parameter is NULL, then no memory |
|---|
| 364 | | - * block descriptors are available. |
|---|
| 365 | | - */ |
|---|
| 366 | | -struct cvmx_bootmem_named_block_desc * |
|---|
| 367 | | -cvmx_bootmem_phy_named_block_find(char *name, uint32_t flags); |
|---|
| 368 | | - |
|---|
| 369 | | -/** |
|---|
| 370 | | - * Frees a named block. |
|---|
| 371 | | - * |
|---|
| 372 | | - * @name: name of block to free |
|---|
| 373 | | - * @flags: flags for passing options |
|---|
| 374 | | - * |
|---|
| 375 | | - * Returns 0 on failure |
|---|
| 376 | | - * 1 on success |
|---|
| 377 | | - */ |
|---|
| 378 | | -int cvmx_bootmem_phy_named_block_free(char *name, uint32_t flags); |
|---|
| 379 | 303 | |
|---|
| 380 | 304 | /** |
|---|
| 381 | 305 | * Frees a block to the bootmem allocator list. This must |
|---|