of/fdt: move memreserve and dtb memory reservations into core
Move the /memreserve/ processing and dtb memory reservations into early_init_fdt_scan_reserved_mem. This converts arm, arm64, and powerpc as they are the only users of early_init_fdt_scan_reserved_mem. memblock_reserve is safe to call on the same region twice, so the reservation check for the dtb in powerpc 32-bit reservations is safe to remove. Signed-off-by: Rob Herring <robh@kernel.org> Tested-by: Michal Simek <michal.simek@xilinx.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Tested-by: Grant Likely <grant.likely@linaro.org> Tested-by: Stephen Chivers <schivers@csc.com>
This commit is contained in:
@@ -32,33 +32,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
|
||||
arm_add_memory(base, size);
|
||||
}
|
||||
|
||||
void __init arm_dt_memblock_reserve(void)
|
||||
{
|
||||
u64 *reserve_map, base, size;
|
||||
|
||||
if (!initial_boot_params)
|
||||
return;
|
||||
|
||||
/* Reserve the dtb region */
|
||||
memblock_reserve(virt_to_phys(initial_boot_params),
|
||||
be32_to_cpu(initial_boot_params->totalsize));
|
||||
|
||||
/*
|
||||
* Process the reserve map. This will probably overlap the initrd
|
||||
* and dtb locations which are already reserved, but overlaping
|
||||
* doesn't hurt anything
|
||||
*/
|
||||
reserve_map = ((void*)initial_boot_params) +
|
||||
be32_to_cpu(initial_boot_params->off_mem_rsvmap);
|
||||
while (1) {
|
||||
base = be64_to_cpup(reserve_map++);
|
||||
size = be64_to_cpup(reserve_map++);
|
||||
if (!size)
|
||||
break;
|
||||
memblock_reserve(base, size);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
extern struct of_cpu_method __cpu_method_of_table_begin[];
|
||||
extern struct of_cpu_method __cpu_method_of_table_end[];
|
||||
|
Reference in New Issue
Block a user