summaryrefslogtreecommitdiff
path: root/arch/powerpc/lib
diff options
context:
space:
mode:
authorSughosh Ganu <[email protected]>2024-08-26 17:29:18 +0530
committerTom Rini <[email protected]>2024-09-03 14:08:50 -0600
commited17a33fed296a87219b0ff702045ce488bc3771 (patch)
treee1ac01002f7dcd0e1c1adbf5139234038ea58f8f /arch/powerpc/lib
parenta368850ae2551a4fcc5f9a2e9e8e90c056d4fe73 (diff)
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 <[email protected]> Signed-off-by: Simon Glass <[email protected]> [sjg: Optimise the logic to add a region in lmb_add_region_flags()]
Diffstat (limited to 'arch/powerpc/lib')
-rw-r--r--arch/powerpc/lib/bootm.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 61e08728dd4..752f72f873f 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -116,7 +116,7 @@ static void boot_jump_linux(struct bootm_headers *images)
return;
}
-void arch_lmb_reserve(struct lmb *lmb)
+void arch_lmb_reserve(void)
{
phys_size_t bootm_size;
ulong size, bootmap_base;
@@ -139,13 +139,13 @@ void arch_lmb_reserve(struct lmb *lmb)
ulong base = bootmap_base + size;
printf("WARNING: adjusting available memory from 0x%lx to 0x%llx\n",
size, (unsigned long long)bootm_size);
- lmb_reserve(lmb, base, bootm_size - size);
+ lmb_reserve(base, bootm_size - size);
}
- arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+ arch_lmb_reserve_generic(get_sp(), gd->ram_top, 4096);
#ifdef CONFIG_MP
- cpu_mp_lmb_reserve(lmb);
+ cpu_mp_lmb_reserve();
#endif
return;
@@ -166,7 +166,6 @@ static void boot_prep_linux(struct bootm_headers *images)
static int boot_cmdline_linux(struct bootm_headers *images)
{
ulong of_size = images->ft_len;
- struct lmb *lmb = &images->lmb;
ulong *cmd_start = &images->cmdline_start;
ulong *cmd_end = &images->cmdline_end;
@@ -174,7 +173,7 @@ static int boot_cmdline_linux(struct bootm_headers *images)
if (!of_size) {
/* allocate space and init command line */
- ret = boot_get_cmdline (lmb, cmd_start, cmd_end);
+ ret = boot_get_cmdline(cmd_start, cmd_end);
if (ret) {
puts("ERROR with allocation of cmdline\n");
return ret;
@@ -187,14 +186,13 @@ static int boot_cmdline_linux(struct bootm_headers *images)
static int boot_bd_t_linux(struct bootm_headers *images)
{
ulong of_size = images->ft_len;
- struct lmb *lmb = &images->lmb;
struct bd_info **kbd = &images->kbd;
int ret = 0;
if (!of_size) {
/* allocate space for kernel copy of board info */
- ret = boot_get_kbd (lmb, kbd);
+ ret = boot_get_kbd(kbd);
if (ret) {
puts("ERROR with allocation of kernel bd\n");
return ret;