diff options
author | David Daney <ddaney@caviumnetworks.com> | 2009-05-05 20:35:16 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-06-17 06:06:29 -0400 |
commit | 6fa044ab8ab609bf95423b2841e20a2f4bb3a86d (patch) | |
tree | 666130477775132de1058596cabc17646ce03ed7 /arch/mips/include | |
parent | ce65cc8fe22a572ea9ec88e203388558b6b863af (diff) |
MIPS: Add named alloc functions to OCTEON boot monitor memory allocator.
The various Octeon ethernet drivers use these new functions.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include')
-rw-r--r-- | arch/mips/include/asm/octeon/cvmx-bootmem.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/arch/mips/include/asm/octeon/cvmx-bootmem.h b/arch/mips/include/asm/octeon/cvmx-bootmem.h index 1cbe4b55889d..8e708bdb43f7 100644 --- a/arch/mips/include/asm/octeon/cvmx-bootmem.h +++ b/arch/mips/include/asm/octeon/cvmx-bootmem.h | |||
@@ -183,6 +183,64 @@ extern void *cvmx_bootmem_alloc_range(uint64_t size, uint64_t alignment, | |||
183 | * Returns 0 on failure, | 183 | * Returns 0 on failure, |
184 | * !0 on success | 184 | * !0 on success |
185 | */ | 185 | */ |
186 | |||
187 | |||
188 | /** | ||
189 | * Allocate a block of memory from the free list that was passed | ||
190 | * to the application by the bootloader, and assign it a name in the | ||
191 | * global named block table. (part of the cvmx_bootmem_descriptor_t structure) | ||
192 | * Named blocks can later be freed. | ||
193 | * | ||
194 | * @size: Size in bytes of block to allocate | ||
195 | * @alignment: Alignment required - must be power of 2 | ||
196 | * @name: name of block - must be less than CVMX_BOOTMEM_NAME_LEN bytes | ||
197 | * | ||
198 | * Returns a pointer to block of memory, NULL on error | ||
199 | */ | ||
200 | extern void *cvmx_bootmem_alloc_named(uint64_t size, uint64_t alignment, | ||
201 | char *name); | ||
202 | |||
203 | |||
204 | |||
205 | /** | ||
206 | * Allocate a block of memory from the free list that was passed | ||
207 | * to the application by the bootloader, and assign it a name in the | ||
208 | * global named block table. (part of the cvmx_bootmem_descriptor_t structure) | ||
209 | * Named blocks can later be freed. | ||
210 | * | ||
211 | * @size: Size in bytes of block to allocate | ||
212 | * @address: Physical address to allocate memory at. If this | ||
213 | * memory is not available, the allocation fails. | ||
214 | * @name: name of block - must be less than CVMX_BOOTMEM_NAME_LEN | ||
215 | * bytes | ||
216 | * | ||
217 | * Returns a pointer to block of memory, NULL on error | ||
218 | */ | ||
219 | extern void *cvmx_bootmem_alloc_named_address(uint64_t size, uint64_t address, | ||
220 | char *name); | ||
221 | |||
222 | |||
223 | |||
224 | /** | ||
225 | * Allocate a block of memory from a specific range of the free list | ||
226 | * that was passed to the application by the bootloader, and assign it | ||
227 | * a name in the global named block table. (part of the | ||
228 | * cvmx_bootmem_descriptor_t structure) Named blocks can later be | ||
229 | * freed. If request cannot be satisfied within the address range | ||
230 | * specified, NULL is returned | ||
231 | * | ||
232 | * @size: Size in bytes of block to allocate | ||
233 | * @min_addr: minimum address of range | ||
234 | * @max_addr: maximum address of range | ||
235 | * @align: Alignment of memory to be allocated. (must be a power of 2) | ||
236 | * @name: name of block - must be less than CVMX_BOOTMEM_NAME_LEN bytes | ||
237 | * | ||
238 | * Returns a pointer to block of memory, NULL on error | ||
239 | */ | ||
240 | extern void *cvmx_bootmem_alloc_named_range(uint64_t size, uint64_t min_addr, | ||
241 | uint64_t max_addr, uint64_t align, | ||
242 | char *name); | ||
243 | |||
186 | extern int cvmx_bootmem_free_named(char *name); | 244 | extern int cvmx_bootmem_free_named(char *name); |
187 | 245 | ||
188 | /** | 246 | /** |
@@ -224,6 +282,33 @@ int64_t cvmx_bootmem_phy_alloc(uint64_t req_size, uint64_t address_min, | |||
224 | uint32_t flags); | 282 | uint32_t flags); |
225 | 283 | ||
226 | /** | 284 | /** |
285 | * Allocates a named block of physical memory from the free list, at | ||
286 | * (optional) requested address and alignment. | ||
287 | * | ||
288 | * @param size size of region to allocate. All requests are rounded | ||
289 | * up to be a multiple CVMX_BOOTMEM_ALIGNMENT_SIZE | ||
290 | * bytes size | ||
291 | * @param min_addr Minimum address that block can occupy. | ||
292 | * @param max_addr Specifies the maximum address_min (inclusive) that | ||
293 | * the allocation can use. | ||
294 | * @param alignment Requested alignment of the block. If this | ||
295 | * alignment cannot be met, the allocation fails. | ||
296 | * This must be a power of 2. (Note: Alignment of | ||
297 | * CVMX_BOOTMEM_ALIGNMENT_SIZE bytes is required, and | ||
298 | * internally enforced. Requested alignments of less | ||
299 | * than CVMX_BOOTMEM_ALIGNMENT_SIZE are set to | ||
300 | * CVMX_BOOTMEM_ALIGNMENT_SIZE.) | ||
301 | * @param name name to assign to named block | ||
302 | * @param flags Flags to control options for the allocation. | ||
303 | * | ||
304 | * @return physical address of block allocated, or -1 on failure | ||
305 | */ | ||
306 | int64_t cvmx_bootmem_phy_named_block_alloc(uint64_t size, uint64_t min_addr, | ||
307 | uint64_t max_addr, | ||
308 | uint64_t alignment, | ||
309 | char *name, uint32_t flags); | ||
310 | |||
311 | /** | ||
227 | * Finds a named memory block by name. | 312 | * Finds a named memory block by name. |
228 | * Also used for finding an unused entry in the named block table. | 313 | * Also used for finding an unused entry in the named block table. |
229 | * | 314 | * |