aboutsummaryrefslogtreecommitdiffstats
path: root/board
diff options
context:
space:
mode:
authorSughosh Ganu <sughosh.ganu@linaro.org>2024-08-26 17:29:18 +0530
committerTom Rini <trini@konsulko.com>2024-09-03 14:08:50 -0600
commited17a33fed296a87219b0ff702045ce488bc3771 (patch)
treee1ac01002f7dcd0e1c1adbf5139234038ea58f8f /board
parenta368850ae2551a4fcc5f9a2e9e8e90c056d4fe73 (diff)
downloadu-boot-ed17a33fed296a87219b0ff702045ce488bc3771.tar.gz
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()]
Diffstat (limited to 'board')
-rw-r--r--board/xilinx/common/board.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 0b43407b9e9..40568844004 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -675,7 +675,6 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
{
phys_size_t size;
phys_addr_t reg;
- struct lmb lmb;
if (!total_size)
return gd->ram_top;
@@ -684,11 +683,10 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
panic("Not 64bit aligned DT location: %p\n", gd->fdt_blob);
/* found enough not-reserved memory to relocated U-Boot */
- lmb_init(&lmb);
- lmb_add(&lmb, gd->ram_base, gd->ram_size);
- boot_fdt_add_mem_rsv_regions(&lmb, (void *)gd->fdt_blob);
+ lmb_add(gd->ram_base, gd->ram_size);
+ boot_fdt_add_mem_rsv_regions((void *)gd->fdt_blob);
size = ALIGN(CONFIG_SYS_MALLOC_LEN + total_size, MMU_SECTION_SIZE);
- reg = lmb_alloc(&lmb, size, MMU_SECTION_SIZE);
+ reg = lmb_alloc(size, MMU_SECTION_SIZE);
if (!reg)
reg = gd->ram_top - size;