18c2ecf20Sopenharmony_ci/***********************license start***************
28c2ecf20Sopenharmony_ci * Author: Cavium Networks
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Contact: support@caviumnetworks.com
58c2ecf20Sopenharmony_ci * This file is part of the OCTEON SDK
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (c) 2003-2008 Cavium Networks
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * This file is free software; you can redistribute it and/or modify
108c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License, Version 2, as
118c2ecf20Sopenharmony_ci * published by the Free Software Foundation.
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * This file is distributed in the hope that it will be useful, but
148c2ecf20Sopenharmony_ci * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
158c2ecf20Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
168c2ecf20Sopenharmony_ci * NONINFRINGEMENT.  See the GNU General Public License for more
178c2ecf20Sopenharmony_ci * details.
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License
208c2ecf20Sopenharmony_ci * along with this file; if not, write to the Free Software
218c2ecf20Sopenharmony_ci * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
228c2ecf20Sopenharmony_ci * or visit http://www.gnu.org/licenses/.
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * This file may also be available under a different license from Cavium.
258c2ecf20Sopenharmony_ci * Contact Cavium Networks for more information
268c2ecf20Sopenharmony_ci ***********************license end**************************************/
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/*
298c2ecf20Sopenharmony_ci * Simple allocate only memory allocator.  Used to allocate memory at
308c2ecf20Sopenharmony_ci * application start time.
318c2ecf20Sopenharmony_ci */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#ifndef __CVMX_BOOTMEM_H__
348c2ecf20Sopenharmony_ci#define __CVMX_BOOTMEM_H__
358c2ecf20Sopenharmony_ci/* Must be multiple of 8, changing breaks ABI */
368c2ecf20Sopenharmony_ci#define CVMX_BOOTMEM_NAME_LEN 128
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/* Can change without breaking ABI */
398c2ecf20Sopenharmony_ci#define CVMX_BOOTMEM_NUM_NAMED_BLOCKS 64
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* minimum alignment of bootmem alloced blocks */
428c2ecf20Sopenharmony_ci#define CVMX_BOOTMEM_ALIGNMENT_SIZE	(16ull)
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* Flags for cvmx_bootmem_phy_mem* functions */
458c2ecf20Sopenharmony_ci/* Allocate from end of block instead of beginning */
468c2ecf20Sopenharmony_ci#define CVMX_BOOTMEM_FLAG_END_ALLOC    (1 << 0)
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* Don't do any locking. */
498c2ecf20Sopenharmony_ci#define CVMX_BOOTMEM_FLAG_NO_LOCKING   (1 << 1)
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/* First bytes of each free physical block of memory contain this structure,
528c2ecf20Sopenharmony_ci * which is used to maintain the free memory list.  Since the bootloader is
538c2ecf20Sopenharmony_ci * only 32 bits, there is a union providing 64 and 32 bit versions.  The
548c2ecf20Sopenharmony_ci * application init code converts addresses to 64 bit addresses before the
558c2ecf20Sopenharmony_ci * application starts.
568c2ecf20Sopenharmony_ci */
578c2ecf20Sopenharmony_cistruct cvmx_bootmem_block_header {
588c2ecf20Sopenharmony_ci	/*
598c2ecf20Sopenharmony_ci	 * Note: these are referenced from assembly routines in the
608c2ecf20Sopenharmony_ci	 * bootloader, so this structure should not be changed
618c2ecf20Sopenharmony_ci	 * without changing those routines as well.
628c2ecf20Sopenharmony_ci	 */
638c2ecf20Sopenharmony_ci	uint64_t next_block_addr;
648c2ecf20Sopenharmony_ci	uint64_t size;
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci};
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci/*
698c2ecf20Sopenharmony_ci * Structure for named memory blocks.  Number of descriptors available
708c2ecf20Sopenharmony_ci * can be changed without affecting compatibility, but name length
718c2ecf20Sopenharmony_ci * changes require a bump in the bootmem descriptor version Note: This
728c2ecf20Sopenharmony_ci * structure must be naturally 64 bit aligned, as a single memory
738c2ecf20Sopenharmony_ci * image will be used by both 32 and 64 bit programs.
748c2ecf20Sopenharmony_ci */
758c2ecf20Sopenharmony_cistruct cvmx_bootmem_named_block_desc {
768c2ecf20Sopenharmony_ci	/* Base address of named block */
778c2ecf20Sopenharmony_ci	uint64_t base_addr;
788c2ecf20Sopenharmony_ci	/*
798c2ecf20Sopenharmony_ci	 * Size actually allocated for named block (may differ from
808c2ecf20Sopenharmony_ci	 * requested).
818c2ecf20Sopenharmony_ci	 */
828c2ecf20Sopenharmony_ci	uint64_t size;
838c2ecf20Sopenharmony_ci	/* name of named block */
848c2ecf20Sopenharmony_ci	char name[CVMX_BOOTMEM_NAME_LEN];
858c2ecf20Sopenharmony_ci};
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* Current descriptor versions */
888c2ecf20Sopenharmony_ci/* CVMX bootmem descriptor major version */
898c2ecf20Sopenharmony_ci#define CVMX_BOOTMEM_DESC_MAJ_VER   3
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci/* CVMX bootmem descriptor minor version */
928c2ecf20Sopenharmony_ci#define CVMX_BOOTMEM_DESC_MIN_VER   0
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/* First three members of cvmx_bootmem_desc_t are left in original
958c2ecf20Sopenharmony_ci * positions for backwards compatibility.
968c2ecf20Sopenharmony_ci */
978c2ecf20Sopenharmony_cistruct cvmx_bootmem_desc {
988c2ecf20Sopenharmony_ci#if defined(__BIG_ENDIAN_BITFIELD) || defined(CVMX_BUILD_FOR_LINUX_HOST)
998c2ecf20Sopenharmony_ci	/* spinlock to control access to list */
1008c2ecf20Sopenharmony_ci	uint32_t lock;
1018c2ecf20Sopenharmony_ci	/* flags for indicating various conditions */
1028c2ecf20Sopenharmony_ci	uint32_t flags;
1038c2ecf20Sopenharmony_ci	uint64_t head_addr;
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	/* Incremented when incompatible changes made */
1068c2ecf20Sopenharmony_ci	uint32_t major_version;
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci	/*
1098c2ecf20Sopenharmony_ci	 * Incremented changed when compatible changes made, reset to
1108c2ecf20Sopenharmony_ci	 * zero when major incremented.
1118c2ecf20Sopenharmony_ci	 */
1128c2ecf20Sopenharmony_ci	uint32_t minor_version;
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci	uint64_t app_data_addr;
1158c2ecf20Sopenharmony_ci	uint64_t app_data_size;
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci	/* number of elements in named blocks array */
1188c2ecf20Sopenharmony_ci	uint32_t named_block_num_blocks;
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci	/* length of name array in bootmem blocks */
1218c2ecf20Sopenharmony_ci	uint32_t named_block_name_len;
1228c2ecf20Sopenharmony_ci	/* address of named memory block descriptors */
1238c2ecf20Sopenharmony_ci	uint64_t named_block_array_addr;
1248c2ecf20Sopenharmony_ci#else                           /* __LITTLE_ENDIAN */
1258c2ecf20Sopenharmony_ci	uint32_t flags;
1268c2ecf20Sopenharmony_ci	uint32_t lock;
1278c2ecf20Sopenharmony_ci	uint64_t head_addr;
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci	uint32_t minor_version;
1308c2ecf20Sopenharmony_ci	uint32_t major_version;
1318c2ecf20Sopenharmony_ci	uint64_t app_data_addr;
1328c2ecf20Sopenharmony_ci	uint64_t app_data_size;
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci	uint32_t named_block_name_len;
1358c2ecf20Sopenharmony_ci	uint32_t named_block_num_blocks;
1368c2ecf20Sopenharmony_ci	uint64_t named_block_array_addr;
1378c2ecf20Sopenharmony_ci#endif
1388c2ecf20Sopenharmony_ci};
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci/**
1418c2ecf20Sopenharmony_ci * Initialize the boot alloc memory structures. This is
1428c2ecf20Sopenharmony_ci * normally called inside of cvmx_user_app_init()
1438c2ecf20Sopenharmony_ci *
1448c2ecf20Sopenharmony_ci * @mem_desc_ptr:	Address of the free memory list
1458c2ecf20Sopenharmony_ci */
1468c2ecf20Sopenharmony_ciextern int cvmx_bootmem_init(void *mem_desc_ptr);
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci/**
1498c2ecf20Sopenharmony_ci * Allocate a block of memory from the free list that was
1508c2ecf20Sopenharmony_ci * passed to the application by the bootloader at a specific
1518c2ecf20Sopenharmony_ci * address. This is an allocate-only algorithm, so
1528c2ecf20Sopenharmony_ci * freeing memory is not possible. Allocation will fail if
1538c2ecf20Sopenharmony_ci * memory cannot be allocated at the specified address.
1548c2ecf20Sopenharmony_ci *
1558c2ecf20Sopenharmony_ci * @size:      Size in bytes of block to allocate
1568c2ecf20Sopenharmony_ci * @address:   Physical address to allocate memory at.	If this memory is not
1578c2ecf20Sopenharmony_ci *		    available, the allocation fails.
1588c2ecf20Sopenharmony_ci * @alignment: Alignment required - must be power of 2
1598c2ecf20Sopenharmony_ci * Returns pointer to block of memory, NULL on error
1608c2ecf20Sopenharmony_ci */
1618c2ecf20Sopenharmony_ciextern void *cvmx_bootmem_alloc_address(uint64_t size, uint64_t address,
1628c2ecf20Sopenharmony_ci					uint64_t alignment);
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci/**
1658c2ecf20Sopenharmony_ci * Frees a previously allocated named bootmem block.
1668c2ecf20Sopenharmony_ci *
1678c2ecf20Sopenharmony_ci * @name:   name of block to free
1688c2ecf20Sopenharmony_ci *
1698c2ecf20Sopenharmony_ci * Returns 0 on failure,
1708c2ecf20Sopenharmony_ci *	   !0 on success
1718c2ecf20Sopenharmony_ci */
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci/**
1758c2ecf20Sopenharmony_ci * Allocate a block of memory from the free list that was passed
1768c2ecf20Sopenharmony_ci * to the application by the bootloader, and assign it a name in the
1778c2ecf20Sopenharmony_ci * global named block table.  (part of the cvmx_bootmem_descriptor_t structure)
1788c2ecf20Sopenharmony_ci * Named blocks can later be freed.
1798c2ecf20Sopenharmony_ci *
1808c2ecf20Sopenharmony_ci * @size:      Size in bytes of block to allocate
1818c2ecf20Sopenharmony_ci * @alignment: Alignment required - must be power of 2
1828c2ecf20Sopenharmony_ci * @name:      name of block - must be less than CVMX_BOOTMEM_NAME_LEN bytes
1838c2ecf20Sopenharmony_ci *
1848c2ecf20Sopenharmony_ci * Returns a pointer to block of memory, NULL on error
1858c2ecf20Sopenharmony_ci */
1868c2ecf20Sopenharmony_ciextern void *cvmx_bootmem_alloc_named(uint64_t size, uint64_t alignment,
1878c2ecf20Sopenharmony_ci				      char *name);
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci/**
1908c2ecf20Sopenharmony_ci * Allocate a block of memory from a specific range of the free list
1918c2ecf20Sopenharmony_ci * that was passed to the application by the bootloader, and assign it
1928c2ecf20Sopenharmony_ci * a name in the global named block table.  (part of the
1938c2ecf20Sopenharmony_ci * cvmx_bootmem_descriptor_t structure) Named blocks can later be
1948c2ecf20Sopenharmony_ci * freed.  If request cannot be satisfied within the address range
1958c2ecf20Sopenharmony_ci * specified, NULL is returned
1968c2ecf20Sopenharmony_ci *
1978c2ecf20Sopenharmony_ci * @size:      Size in bytes of block to allocate
1988c2ecf20Sopenharmony_ci * @min_addr:  minimum address of range
1998c2ecf20Sopenharmony_ci * @max_addr:  maximum address of range
2008c2ecf20Sopenharmony_ci * @align:     Alignment of memory to be allocated. (must be a power of 2)
2018c2ecf20Sopenharmony_ci * @name:      name of block - must be less than CVMX_BOOTMEM_NAME_LEN bytes
2028c2ecf20Sopenharmony_ci *
2038c2ecf20Sopenharmony_ci * Returns a pointer to block of memory, NULL on error
2048c2ecf20Sopenharmony_ci */
2058c2ecf20Sopenharmony_ciextern void *cvmx_bootmem_alloc_named_range(uint64_t size, uint64_t min_addr,
2068c2ecf20Sopenharmony_ci					    uint64_t max_addr, uint64_t align,
2078c2ecf20Sopenharmony_ci					    char *name);
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci/**
2108c2ecf20Sopenharmony_ci * Allocate if needed a block of memory from a specific range of the
2118c2ecf20Sopenharmony_ci * free list that was passed to the application by the bootloader, and
2128c2ecf20Sopenharmony_ci * assign it a name in the global named block table.  (part of the
2138c2ecf20Sopenharmony_ci * cvmx_bootmem_descriptor_t structure) Named blocks can later be
2148c2ecf20Sopenharmony_ci * freed.  If the requested name block is already allocated, return
2158c2ecf20Sopenharmony_ci * the pointer to block of memory.  If request cannot be satisfied
2168c2ecf20Sopenharmony_ci * within the address range specified, NULL is returned
2178c2ecf20Sopenharmony_ci *
2188c2ecf20Sopenharmony_ci * @param size   Size in bytes of block to allocate
2198c2ecf20Sopenharmony_ci * @param min_addr  minimum address of range
2208c2ecf20Sopenharmony_ci * @param max_addr  maximum address of range
2218c2ecf20Sopenharmony_ci * @param align  Alignment of memory to be allocated. (must be a power of 2)
2228c2ecf20Sopenharmony_ci * @param name   name of block - must be less than CVMX_BOOTMEM_NAME_LEN bytes
2238c2ecf20Sopenharmony_ci * @param init   Initialization function
2248c2ecf20Sopenharmony_ci *
2258c2ecf20Sopenharmony_ci * The initialization function is optional, if omitted the named block
2268c2ecf20Sopenharmony_ci * is initialized to all zeros when it is created, i.e. once.
2278c2ecf20Sopenharmony_ci *
2288c2ecf20Sopenharmony_ci * @return pointer to block of memory, NULL on error
2298c2ecf20Sopenharmony_ci */
2308c2ecf20Sopenharmony_civoid *cvmx_bootmem_alloc_named_range_once(uint64_t size,
2318c2ecf20Sopenharmony_ci					  uint64_t min_addr,
2328c2ecf20Sopenharmony_ci					  uint64_t max_addr,
2338c2ecf20Sopenharmony_ci					  uint64_t align,
2348c2ecf20Sopenharmony_ci					  char *name,
2358c2ecf20Sopenharmony_ci					  void (*init) (void *));
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ciextern int cvmx_bootmem_free_named(char *name);
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci/**
2408c2ecf20Sopenharmony_ci * Finds a named bootmem block by name.
2418c2ecf20Sopenharmony_ci *
2428c2ecf20Sopenharmony_ci * @name:   name of block to free
2438c2ecf20Sopenharmony_ci *
2448c2ecf20Sopenharmony_ci * Returns pointer to named block descriptor on success
2458c2ecf20Sopenharmony_ci *	   0 on failure
2468c2ecf20Sopenharmony_ci */
2478c2ecf20Sopenharmony_cistruct cvmx_bootmem_named_block_desc *cvmx_bootmem_find_named_block(char *name);
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci/**
2508c2ecf20Sopenharmony_ci * Allocates a block of physical memory from the free list, at
2518c2ecf20Sopenharmony_ci * (optional) requested address and alignment.
2528c2ecf20Sopenharmony_ci *
2538c2ecf20Sopenharmony_ci * @req_size: size of region to allocate.  All requests are rounded up
2548c2ecf20Sopenharmony_ci *	      to be a multiple CVMX_BOOTMEM_ALIGNMENT_SIZE bytes size
2558c2ecf20Sopenharmony_ci *
2568c2ecf20Sopenharmony_ci * @address_min: Minimum address that block can occupy.
2578c2ecf20Sopenharmony_ci *
2588c2ecf20Sopenharmony_ci * @address_max: Specifies the maximum address_min (inclusive) that
2598c2ecf20Sopenharmony_ci *		 the allocation can use.
2608c2ecf20Sopenharmony_ci *
2618c2ecf20Sopenharmony_ci * @alignment: Requested alignment of the block.  If this alignment
2628c2ecf20Sopenharmony_ci *	       cannot be met, the allocation fails.  This must be a
2638c2ecf20Sopenharmony_ci *	       power of 2.  (Note: Alignment of
2648c2ecf20Sopenharmony_ci *	       CVMX_BOOTMEM_ALIGNMENT_SIZE bytes is required, and
2658c2ecf20Sopenharmony_ci *	       internally enforced.  Requested alignments of less than
2668c2ecf20Sopenharmony_ci *	       CVMX_BOOTMEM_ALIGNMENT_SIZE are set to
2678c2ecf20Sopenharmony_ci *	       CVMX_BOOTMEM_ALIGNMENT_SIZE.)
2688c2ecf20Sopenharmony_ci *
2698c2ecf20Sopenharmony_ci * @flags:     Flags to control options for the allocation.
2708c2ecf20Sopenharmony_ci *
2718c2ecf20Sopenharmony_ci * Returns physical address of block allocated, or -1 on failure
2728c2ecf20Sopenharmony_ci */
2738c2ecf20Sopenharmony_ciint64_t cvmx_bootmem_phy_alloc(uint64_t req_size, uint64_t address_min,
2748c2ecf20Sopenharmony_ci			       uint64_t address_max, uint64_t alignment,
2758c2ecf20Sopenharmony_ci			       uint32_t flags);
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci/**
2788c2ecf20Sopenharmony_ci * Allocates a named block of physical memory from the free list, at
2798c2ecf20Sopenharmony_ci * (optional) requested address and alignment.
2808c2ecf20Sopenharmony_ci *
2818c2ecf20Sopenharmony_ci * @param size	    size of region to allocate.	 All requests are rounded
2828c2ecf20Sopenharmony_ci *		    up to be a multiple CVMX_BOOTMEM_ALIGNMENT_SIZE
2838c2ecf20Sopenharmony_ci *		    bytes size
2848c2ecf20Sopenharmony_ci * @param min_addr Minimum address that block can occupy.
2858c2ecf20Sopenharmony_ci * @param max_addr  Specifies the maximum address_min (inclusive) that
2868c2ecf20Sopenharmony_ci *		    the allocation can use.
2878c2ecf20Sopenharmony_ci * @param alignment Requested alignment of the block.  If this
2888c2ecf20Sopenharmony_ci *		    alignment cannot be met, the allocation fails.
2898c2ecf20Sopenharmony_ci *		    This must be a power of 2.	(Note: Alignment of
2908c2ecf20Sopenharmony_ci *		    CVMX_BOOTMEM_ALIGNMENT_SIZE bytes is required, and
2918c2ecf20Sopenharmony_ci *		    internally enforced.  Requested alignments of less
2928c2ecf20Sopenharmony_ci *		    than CVMX_BOOTMEM_ALIGNMENT_SIZE are set to
2938c2ecf20Sopenharmony_ci *		    CVMX_BOOTMEM_ALIGNMENT_SIZE.)
2948c2ecf20Sopenharmony_ci * @param name	    name to assign to named block
2958c2ecf20Sopenharmony_ci * @param flags	    Flags to control options for the allocation.
2968c2ecf20Sopenharmony_ci *
2978c2ecf20Sopenharmony_ci * @return physical address of block allocated, or -1 on failure
2988c2ecf20Sopenharmony_ci */
2998c2ecf20Sopenharmony_ciint64_t cvmx_bootmem_phy_named_block_alloc(uint64_t size, uint64_t min_addr,
3008c2ecf20Sopenharmony_ci					   uint64_t max_addr,
3018c2ecf20Sopenharmony_ci					   uint64_t alignment,
3028c2ecf20Sopenharmony_ci					   char *name, uint32_t flags);
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci/**
3058c2ecf20Sopenharmony_ci * Frees a block to the bootmem allocator list.	 This must
3068c2ecf20Sopenharmony_ci * be used with care, as the size provided must match the size
3078c2ecf20Sopenharmony_ci * of the block that was allocated, or the list will become
3088c2ecf20Sopenharmony_ci * corrupted.
3098c2ecf20Sopenharmony_ci *
3108c2ecf20Sopenharmony_ci * IMPORTANT:  This is only intended to be used as part of named block
3118c2ecf20Sopenharmony_ci * frees and initial population of the free memory list.
3128c2ecf20Sopenharmony_ci *							*
3138c2ecf20Sopenharmony_ci *
3148c2ecf20Sopenharmony_ci * @phy_addr: physical address of block
3158c2ecf20Sopenharmony_ci * @size:     size of block in bytes.
3168c2ecf20Sopenharmony_ci * @flags:    flags for passing options
3178c2ecf20Sopenharmony_ci *
3188c2ecf20Sopenharmony_ci * Returns 1 on success,
3198c2ecf20Sopenharmony_ci *	   0 on failure
3208c2ecf20Sopenharmony_ci */
3218c2ecf20Sopenharmony_ciint __cvmx_bootmem_phy_free(uint64_t phy_addr, uint64_t size, uint32_t flags);
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci/**
3248c2ecf20Sopenharmony_ci * Locks the bootmem allocator.	 This is useful in certain situations
3258c2ecf20Sopenharmony_ci * where multiple allocations must be made without being interrupted.
3268c2ecf20Sopenharmony_ci * This should be used with the CVMX_BOOTMEM_FLAG_NO_LOCKING flag.
3278c2ecf20Sopenharmony_ci *
3288c2ecf20Sopenharmony_ci */
3298c2ecf20Sopenharmony_civoid cvmx_bootmem_lock(void);
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci/**
3328c2ecf20Sopenharmony_ci * Unlocks the bootmem allocator.  This is useful in certain situations
3338c2ecf20Sopenharmony_ci * where multiple allocations must be made without being interrupted.
3348c2ecf20Sopenharmony_ci * This should be used with the CVMX_BOOTMEM_FLAG_NO_LOCKING flag.
3358c2ecf20Sopenharmony_ci *
3368c2ecf20Sopenharmony_ci */
3378c2ecf20Sopenharmony_civoid cvmx_bootmem_unlock(void);
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ciextern struct cvmx_bootmem_desc *cvmx_bootmem_get_desc(void);
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_ci#endif /*   __CVMX_BOOTMEM_H__ */
342