diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 4b2536a05fbe..e20817af61e7 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -33,6 +33,8 @@ #include "of_private.h" +void init_param_mem_base_size(phys_addr_t base, unsigned long size); + /* * of_fdt_limit_memory - limit the number of regions in the /memory node * @limit: maximum entries @@ -685,6 +687,9 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, pr_info("Reserved memory: failed to reserve memory for node '%s': base %pa, size %ld MiB\n", uname, &base, (unsigned long)size / SZ_1M); + if (!strncmp(uname, "param_mem", 9)) + init_param_mem_base_size(base, size); + len -= t_len; if (first) { fdt_reserved_mem_save_node(node, uname, base, size); diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 3fbd7a9f5b8b..b2ea3b1b782d 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -225,16 +225,6 @@ static int __init __rmem_cmp(const void *a, const void *b) if (ra->base > rb->base) return 1; - /* - * Put the dynamic allocations (address == 0, size == 0) before static - * allocations at address 0x0 so that overlap detection works - * correctly. - */ - if (ra->size < rb->size) - return -1; - if (ra->size > rb->size) - return 1; - return 0; } @@ -252,7 +242,8 @@ static void __init __rmem_check_for_overlap(void) this = &reserved_mem[i]; next = &reserved_mem[i + 1]; - + if (!(this->base && next->base)) + continue; if (this->base + this->size > next->base) { phys_addr_t this_end, next_end;