aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/prom.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-02-27 22:12:29 -0500
committerPaul Mackerras <paulus@samba.org>2007-03-07 23:43:35 -0500
commit30437b3e743f33e9b68f813ca24e547aa9fcf7d7 (patch)
tree6ff8799e8fbfd717f288e7365a5329a01505e9be /arch/powerpc/kernel/prom.c
parenteb6de2863750e696201780283e4c9ada19b4728e (diff)
[POWERPC] Automatically lmb_reserve() initrd
At present, when an initrd is passed to the kernel used flat device tree properties, the memory the initrd occupies must also be reserved in the flat tree's reserve map, or the kernel may overwrite it. That makes life more complicated than it could be for the bootwrapper. This patch makes the kernel automatically reserve the initrd's space. That in turn requires parsing the initrd parameters earlier than they are currently, in early_init_dt_scan_chosen() instead of check_for_initrd(). Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
-rw-r--r--arch/powerpc/kernel/prom.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 15ece3abfb37..ef6bfb70b24a 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -719,6 +719,7 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
719 const char *uname, int depth, void *data) 719 const char *uname, int depth, void *data)
720{ 720{
721 unsigned long *lprop; 721 unsigned long *lprop;
722 u32 *prop;
722 unsigned long l; 723 unsigned long l;
723 char *p; 724 char *p;
724 725
@@ -760,6 +761,22 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
760 crashk_res.end = crashk_res.start + *lprop - 1; 761 crashk_res.end = crashk_res.start + *lprop - 1;
761#endif 762#endif
762 763
764#ifdef CONFIG_BLK_DEV_INITRD
765 DBG("Looking for initrd properties... ");
766 prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
767 if (prop) {
768 initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
769 prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
770 if (prop) {
771 initrd_end = (unsigned long)__va(of_read_ulong(prop, l/4));
772 initrd_below_start_ok = 1;
773 } else {
774 initrd_start = 0;
775 }
776 }
777 DBG("initrd_start=0x%lx initrd_end=0x%lx\n", initrd_start, initrd_end);
778#endif /* CONFIG_BLK_DEV_INITRD */
779
763 /* Retreive command line */ 780 /* Retreive command line */
764 p = of_get_flat_dt_prop(node, "bootargs", &l); 781 p = of_get_flat_dt_prop(node, "bootargs", &l);
765 if (p != NULL && l > 0) 782 if (p != NULL && l > 0)
@@ -926,6 +943,12 @@ static void __init early_reserve_mem(void)
926 self_size = initial_boot_params->totalsize; 943 self_size = initial_boot_params->totalsize;
927 lmb_reserve(self_base, self_size); 944 lmb_reserve(self_base, self_size);
928 945
946#ifdef CONFIG_BLK_DEV_INITRD
947 /* then reserve the initrd, if any */
948 if (initrd_start && (initrd_end > initrd_start))
949 lmb_reserve(__pa(initrd_start), initrd_end - initrd_start);
950#endif /* CONFIG_BLK_DEV_INITRD */
951
929#ifdef CONFIG_PPC32 952#ifdef CONFIG_PPC32
930 /* 953 /*
931 * Handle the case where we might be booting from an old kexec 954 * Handle the case where we might be booting from an old kexec