]> Pileus Git - ~andy/linux/blobdiff - drivers/of/fdt.c
Merge commit 'v2.6.34-rc1' into for-linus
[~andy/linux] / drivers / of / fdt.c
index 18d282fefe583e831279afbdc4b98b63c3253148..406757a9d7ea62056680808392acd02e2889cda9 100644 (file)
  */
 
 #include <linux/kernel.h>
-#include <linux/lmb.h>
 #include <linux/initrd.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
-
+#include <linux/string.h>
+#include <linux/errno.h>
 
 #ifdef CONFIG_PPC
 #include <asm/machdep.h>
 #endif /* CONFIG_PPC */
 
+#include <asm/page.h>
+
 int __initdata dt_root_addr_cells;
 int __initdata dt_root_size_cells;
 
@@ -310,10 +312,19 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
                pp = unflatten_dt_alloc(&mem, sizeof(struct property),
                                        __alignof__(struct property));
                if (allnextpp) {
-                       if (strcmp(pname, "linux,phandle") == 0) {
+                       /* We accept flattened tree phandles either in
+                        * ePAPR-style "phandle" properties, or the
+                        * legacy "linux,phandle" properties.  If both
+                        * appear and have different values, things
+                        * will get weird.  Don't do that. */
+                       if ((strcmp(pname, "phandle") == 0) ||
+                           (strcmp(pname, "linux,phandle") == 0)) {
                                if (np->phandle == 0)
                                        np->phandle = *((u32 *)*p);
                        }
+                       /* And we process the "ibm,phandle" property
+                        * used in pSeries dynamic device tree
+                        * stuff */
                        if (strcmp(pname, "ibm,phandle") == 0)
                                np->phandle = *((u32 *)*p);
                        pp->name = pname;
@@ -551,7 +562,8 @@ void __init unflatten_device_tree(void)
        pr_debug("  size is %lx, allocating...\n", size);
 
        /* Allocate memory for the expanded device tree */
-       mem = lmb_alloc(size + 4, __alignof__(struct device_node));
+       mem = early_init_dt_alloc_memory_arch(size + 4,
+                       __alignof__(struct device_node));
        mem = (unsigned long) __va(mem);
 
        ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);