Commit 04b954a6 authored by David Gibson's avatar David Gibson Committed by Grant Likely

of/flattree: Make the kernel accept ePAPR style phandle information

Currently when processing flattened device trees, the kernel expects
the phandle in a property called "linux,phandle".  The ePAPR spec -
not being Linux specific - instead requires phandles to be encoded in
a property named simply "phandle".  This patch makes the kernel accept
either form when unflattening the device tree.
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent 087f79c4
...@@ -310,10 +310,19 @@ unsigned long __init unflatten_dt_node(unsigned long mem, ...@@ -310,10 +310,19 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
pp = unflatten_dt_alloc(&mem, sizeof(struct property), pp = unflatten_dt_alloc(&mem, sizeof(struct property),
__alignof__(struct property)); __alignof__(struct property));
if (allnextpp) { 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) if (np->phandle == 0)
np->phandle = *((u32 *)*p); np->phandle = *((u32 *)*p);
} }
/* And we process the "ibm,phandle" property
* used in pSeries dynamic device tree
* stuff */
if (strcmp(pname, "ibm,phandle") == 0) if (strcmp(pname, "ibm,phandle") == 0)
np->phandle = *((u32 *)*p); np->phandle = *((u32 *)*p);
pp->name = pname; pp->name = pname;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment