lmb: make LMB memory map persistent and global
The current LMB API's for allocating and reserving memory use a per-caller based memory view. Memory allocated by a caller can then be overwritten by another caller. Make these allocations and reservations persistent using the alloced list data structure. Two alloced lists are declared -- one for the available(free) memory, and one for the used memory. Once full, the list can then be extended at runtime. [sjg: Use a stack to store pointer of lmb struct when running lmb tests] Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Signed-off-by: Simon Glass <sjg@chromium.org> [sjg: Optimise the logic to add a region in lmb_add_region_flags()]
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
/* Define this to avoid #ifdefs later on */
|
||||
struct lmb;
|
||||
struct fdt_region;
|
||||
|
||||
#ifdef USE_HOSTCC
|
||||
@@ -412,18 +411,8 @@ struct bootm_headers {
|
||||
#define BOOTM_STATE_PRE_LOAD 0x00000800
|
||||
#define BOOTM_STATE_MEASURE 0x00001000
|
||||
int state;
|
||||
|
||||
#if defined(CONFIG_LMB) && !defined(USE_HOSTCC)
|
||||
struct lmb lmb; /* for memory mgmt */
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CONFIG_LMB
|
||||
#define images_lmb(_images) (&(_images)->lmb)
|
||||
#else
|
||||
#define images_lmb(_images) NULL
|
||||
#endif
|
||||
|
||||
extern struct bootm_headers images;
|
||||
|
||||
/*
|
||||
@@ -835,13 +824,13 @@ int boot_get_fdt(void *buf, const char *select, uint arch,
|
||||
struct bootm_headers *images, char **of_flat_tree,
|
||||
ulong *of_size);
|
||||
|
||||
void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob);
|
||||
int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size);
|
||||
void boot_fdt_add_mem_rsv_regions(void *fdt_blob);
|
||||
int boot_relocate_fdt(char **of_flat_tree, ulong *of_size);
|
||||
|
||||
int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
|
||||
ulong *initrd_start, ulong *initrd_end);
|
||||
int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end);
|
||||
int boot_get_kbd(struct lmb *lmb, struct bd_info **kbd);
|
||||
int boot_ramdisk_high(ulong rd_data, ulong rd_len, ulong *initrd_start,
|
||||
ulong *initrd_end);
|
||||
int boot_get_cmdline(ulong *cmd_start, ulong *cmd_end);
|
||||
int boot_get_kbd(struct bd_info **kbd);
|
||||
|
||||
/*******************************************************************/
|
||||
/* Legacy format specific code (prefixed with image_) */
|
||||
@@ -1029,11 +1018,10 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
|
||||
*
|
||||
* @images: Images information
|
||||
* @blob: FDT to update
|
||||
* @lmb: Points to logical memory block structure
|
||||
* @lmb: Flag indicating use of lmb for reserving FDT memory region
|
||||
* Return: 0 if ok, <0 on failure
|
||||
*/
|
||||
int image_setup_libfdt(struct bootm_headers *images, void *blob,
|
||||
struct lmb *lmb);
|
||||
int image_setup_libfdt(struct bootm_headers *images, void *blob, bool lmb);
|
||||
|
||||
/**
|
||||
* Set up the FDT to use for booting a kernel
|
||||
|
Reference in New Issue
Block a user