[ppc64]  support for ibm,phandle OF property, from Dave Engebretsen:

Upcoming partition firmware requires the use of the ibm,phandle 
property for matching device nodes.  Add a new field in device_node 
to contain this data.


---

 arch/ppc64/kernel/prom.c |   19 ++++++++++++++++++-
 include/asm-ppc64/prom.h |    1 +
 2 files changed, 19 insertions(+), 1 deletion(-)

diff -puN arch/ppc64/kernel/prom.c~ppc64-phandle arch/ppc64/kernel/prom.c
--- 25/arch/ppc64/kernel/prom.c~ppc64-phandle	2004-01-13 23:21:55.000000000 -0800
+++ 25-akpm/arch/ppc64/kernel/prom.c	2004-01-13 23:21:55.000000000 -0800
@@ -1444,6 +1444,23 @@ inspect_node(phandle node, struct device
 		*prev_propp = PTRUNRELOC(pp);
 		prev_propp = &pp->next;
 	}
+
+	/* Add a "linux_phandle" value */
+        if (np->node) {
+		u32 ibm_phandle = 0;
+		int len;
+
+                /* First see if "ibm,phandle" exists and use its value */
+                len = (int)
+                        call_prom(RELOC("getprop"), 4, 1, node, RELOC("ibm,phandle"),
+                                  &ibm_phandle, sizeof(ibm_phandle));
+                if (len < 0) {
+                        np->linux_phandle = np->node;
+                } else {
+                        np->linux_phandle = ibm_phandle;
+		}
+	}
+
 	*prev_propp = 0;
 
 	/* get the node's full name */
@@ -1992,7 +2009,7 @@ find_phandle(phandle ph)
 	struct device_node *np;
 
 	for (np = allnodes; np != 0; np = np->allnext)
-		if (np->node == ph)
+		if (np->linux_phandle == ph)
 			return np;
 	return NULL;
 }
diff -puN include/asm-ppc64/prom.h~ppc64-phandle include/asm-ppc64/prom.h
--- 25/include/asm-ppc64/prom.h~ppc64-phandle	2004-01-13 23:21:55.000000000 -0800
+++ 25-akpm/include/asm-ppc64/prom.h	2004-01-13 23:21:55.000000000 -0800
@@ -120,6 +120,7 @@ struct device_node {
 	char	*name;
 	char	*type;
 	phandle	node;
+	phandle linux_phandle;
 	int	n_addrs;
 	struct	address_range *addrs;
 	int	n_intrs;

_