Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=30437b3e743f33e9b68f813ca24e547aa9fcf7d7
Commit:     30437b3e743f33e9b68f813ca24e547aa9fcf7d7
Parent:     eb6de2863750e696201780283e4c9ada19b4728e
Author:     David Gibson <[EMAIL PROTECTED]>
AuthorDate: Wed Feb 28 14:12:29 2007 +1100
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Thu Mar 8 15:43:35 2007 +1100

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/prom.c         |   23 +++++++++++++++++++++++
 arch/powerpc/kernel/setup-common.c |   22 ++--------------------
 2 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 15ece3a..ef6bfb7 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,
                                            const char *uname, int depth, void 
*data)
 {
        unsigned long *lprop;
+       u32 *prop;
        unsigned long l;
        char *p;
 
@@ -760,6 +761,22 @@ static int __init early_init_dt_scan_chosen(unsigned long 
node,
                crashk_res.end = crashk_res.start + *lprop - 1;
 #endif
 
+#ifdef CONFIG_BLK_DEV_INITRD
+       DBG("Looking for initrd properties... ");
+       prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
+       if (prop) {
+               initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
+               prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
+               if (prop) {
+                       initrd_end = (unsigned long)__va(of_read_ulong(prop, 
l/4));
+                       initrd_below_start_ok = 1;
+               } else {
+                       initrd_start = 0;
+               }
+       }
+       DBG("initrd_start=0x%lx  initrd_end=0x%lx\n", initrd_start, initrd_end);
+#endif /* CONFIG_BLK_DEV_INITRD */
+
        /* Retreive command line */
        p = of_get_flat_dt_prop(node, "bootargs", &l);
        if (p != NULL && l > 0)
@@ -926,6 +943,12 @@ static void __init early_reserve_mem(void)
        self_size = initial_boot_params->totalsize;
        lmb_reserve(self_base, self_size);
 
+#ifdef CONFIG_BLK_DEV_INITRD
+       /* then reserve the initrd, if any */
+       if (initrd_start && (initrd_end > initrd_start))
+               lmb_reserve(__pa(initrd_start), initrd_end - initrd_start);
+#endif /* CONFIG_BLK_DEV_INITRD */
+
 #ifdef CONFIG_PPC32
        /* 
         * Handle the case where we might be booting from an old kexec
diff --git a/arch/powerpc/kernel/setup-common.c 
b/arch/powerpc/kernel/setup-common.c
index 89cfaf4..d050d9a 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -304,26 +304,8 @@ struct seq_operations cpuinfo_op = {
 void __init check_for_initrd(void)
 {
 #ifdef CONFIG_BLK_DEV_INITRD
-       const unsigned int *prop;
-       int len;
-
-       DBG(" -> check_for_initrd()\n");
-
-       if (of_chosen) {
-               prop = get_property(of_chosen, "linux,initrd-start", &len);
-               if (prop != NULL) {
-                       initrd_start = (unsigned long)
-                               __va(of_read_ulong(prop, len / 4));
-                       prop = get_property(of_chosen,
-                                       "linux,initrd-end", &len);
-                       if (prop != NULL) {
-                               initrd_end = (unsigned long)
-                                       __va(of_read_ulong(prop, len / 4));
-                               initrd_below_start_ok = 1;
-                       } else
-                               initrd_start = 0;
-               }
-       }
+       DBG(" -> check_for_initrd()  initrd_start=0x%lx  initrd_end=0x%lx\n",
+           initrd_start, initrd_end);
 
        /* If we were passed an initrd, set the ROOT_DEV properly if the values
         * look sensible. If not, clear initrd reference.
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to