[PATCH 15/18] Add initrd information to the device tree in ft_finalize().

Scott Wood scottwood at freescale.com
Thu Jan 25 08:07:29 EST 2007


linux,initrd-start and linux,initrd-end are added to the device tree
based on the values that platform code puts in the initrd struct.
ft_finalize() is also made global, so that platform code can do further
manipulation before returning to generic code.

Signed-off-by: Scott Wood <scottwood at freescale.com>
---
 arch/powerpc/boot/flatdevtree_misc.c |   14 +++++++++++++-
 arch/powerpc/boot/ops.h              |    1 +
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree_misc.c b/arch/powerpc/boot/flatdevtree_misc.c
index da49ffb..eb8d48d 100644
--- a/arch/powerpc/boot/flatdevtree_misc.c
+++ b/arch/powerpc/boot/flatdevtree_misc.c
@@ -33,8 +33,20 @@ static int ft_setprop(const void *phandl
 	return ft_set_prop(&fdtm_cxt, phandle, propname, buf, buflen);
 }
 
-static unsigned long ft_finalize(void)
+unsigned long ft_finalize(void)
 {
+	unsigned long initrd_end = initrd.addr + initrd.size;
+	void *devp;
+
+	if (initrd.size && (devp = finddevice("/chosen"))) {
+		setprop(devp, "linux,initrd-start", &initrd.addr,
+		        sizeof(initrd.addr));
+		setprop(devp, "linux,initrd-end", &initrd_end,
+		        sizeof(initrd_end));
+
+		ft_add_rsvmap(&fdtm_cxt, initrd.addr, initrd.size);
+	}
+
 	ft_end_tree(&fdtm_cxt);
 	return (unsigned long)fdtm_cxt.bph;
 }
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index 42c723d..0bc4a68 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -63,6 +63,7 @@ int platform_init(unsigned long r3, unsi
                   unsigned long r6, unsigned long r7,
                   char *dt_blob_start, char *dt_blob_end);
 int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device);
+unsigned long ft_finalize(void);
 int serial_console_init(void);
 int ns16550_console_init(void *devp, struct serial_console_data *scdp);
 void *simple_alloc_init(char *base, u32 heap_size, u32 granularity,
-- 
1.4.4




More information about the Linuxppc-dev mailing list