[PATCH 2/8] arm/dt: allow bootmem reservation for device tree blob and initrd
Grant Likely
grant.likely at secretlab.ca
Wed Jan 19 07:29:07 EST 2011
This patch adds a function, arm_reserve_devtree(), to allow the device
tree code to reserve the memory used by the FDT blob. It also adds
early_init_dt_setup_initrd() which is the hook used by the flat device
tree code to register the region of memory occupied by an initrd.
[based on original patch written by Jeremy Kerr <jeremy.kerr at canonical.com>]
Signed-off-by: Grant Likely <grant.likely at secretlab.ca>
---
arch/arm/include/asm/setup.h | 2 ++
arch/arm/mm/init.c | 23 +++++++++++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index f1e5a9b..0f3e0ac 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -221,6 +221,8 @@ extern struct meminfo meminfo;
#define bank_phys_end(bank) ((bank)->start + (bank)->size)
#define bank_phys_size(bank) (bank)->size
+extern void arm_reserve_devtree(unsigned long start, unsigned long size);
+
#endif /* __KERNEL__ */
#endif
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 5164069..28ccb21 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -71,6 +71,25 @@ static int __init parse_tag_initrd2(const struct tag *tag)
__tagtable(ATAG_INITRD2, parse_tag_initrd2);
+#ifdef CONFIG_OF_FLATTREE
+#include <linux/of_fdt.h>
+
+static unsigned long phys_devtree_start __initdata = 0;
+static unsigned long phys_devtree_size __initdata = 0;
+
+void __init early_init_dt_setup_initrd_arch(unsigned long start, unsigned long end)
+{
+ phys_initrd_start = start;
+ phys_initrd_size = end - start + 1;
+}
+
+void __init arm_reserve_devtree(unsigned long start, unsigned long size)
+{
+ phys_devtree_start = start;
+ phys_devtree_size = size;
+}
+#endif /* CONFIG_OF_FLATTREE */
+
/*
* This keeps memory configuration data used by a couple memory
* initialization functions, as well as show_mem() for the skipping
@@ -305,6 +324,10 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
initrd_end = initrd_start + phys_initrd_size;
}
#endif
+#ifdef CONFIG_OF_FLATTREE
+ if (phys_devtree_size)
+ memblock_reserve(phys_devtree_start, phys_devtree_size);
+#endif
arm_mm_memblock_reserve();
More information about the devicetree-discuss
mailing list