Skip to contentSkip to conversation

PPC: Skip over OF_DT_NOP when unflattening the device tree

PATCH In review Jason Gunthorpe 3 participants 4 messages Mar 9, 2010 – Mar 19, 2010 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PPC: Skip over OF_DT_NOP when unflattening the device tree

NOPs within the property section are skipped, but NOPs between OF_DT_END_NODE and OF_DT_BEGIN_NODE were not. My firmware NOPs out entire nodes depending on various environment parameters.

of_scan_flat_dt already handles NOP more generally..

---
 arch/powerpc/kernel/prom.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
arch/powerpc/kernel/prom.c +5 -2
index 4ec3008..92137b2 100644
@@ -408,8 +408,11 @@ static unsigned long __init unflatten_dt_node(unsigned long mem,
 		if (!np->type)
 			np->type = "<NULL>";
 	}
-	while (tag == OF_DT_BEGIN_NODE) {
-		mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
+	while (tag == OF_DT_BEGIN_NODE || tag == OF_DT_NOP) {
+		if (tag == OF_DT_NOP)
+			*p += 4;
+		else
+			mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
 		tag = *((u32 *)(*p));
 	}
 	if (tag != OF_DT_END_NODE) {
Signature · 1 line
1.5.4.2
#1 lore raw
Quoted 5 lines · Jason Gunthorpe

NOPs within the property section are skipped, but NOPs between OF_DT_END_NODE and OF_DT_BEGIN_NODE were not. My firmware NOPs out entire nodes depending on various environment parameters.

of_scan_flat_dt already handles NOP more generally..

Good catch, though that code has now moved over to drivers/of and is a bit different. Grant is going to fix it up though.

Cheers,
Ben.

Quoted 23 lines
---
 arch/powerpc/kernel/prom.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
arch/powerpc/kernel/prom.c +5 -2
index 4ec3008..92137b2 100644
@@ -408,8 +408,11 @@ static unsigned long __init unflatten_dt_node(unsigned long mem,
 		if (!np->type)
 			np->type = "<NULL>";
 	}
-	while (tag == OF_DT_BEGIN_NODE) {
-		mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
+	while (tag == OF_DT_BEGIN_NODE || tag == OF_DT_NOP) {
+		if (tag == OF_DT_NOP)
+			*p += 4;
+		else
+			mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
 		tag = *((u32 *)(*p));
 	}
 	if (tag != OF_DT_END_NODE) {
#2 lore raw
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 5 lines · Jason Gunthorpe

NOPs within the property section are skipped, but NOPs between OF_DT_END_NODE and OF_DT_BEGIN_NODE were not. My firmware NOPs out entire nodes depending on various environment parameters.

of_scan_flat_dt already handles NOP more generally..

Good catch, though that code has now moved over to drivers/of and is a bit different. Grant is going to fix it up though.

Ah, I based the patch off 2.6.33..

Grant: let me know if you need some help/testing, nice to run into you again.

Jason

#3 lore raw
Quoted 8 lines · Jason Gunthorpe
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 5 lines · Jason Gunthorpe

NOPs within the property section are skipped, but NOPs between OF_DT_END_NODE and OF_DT_BEGIN_NODE were not. My firmware NOPs out entire nodes depending on various environment parameters.

of_scan_flat_dt already handles NOP more generally..

Quoted 7 lines
Quoted 2 lines

Good catch, though that code has now moved over to drivers/of and is a bit different. Grant is going to fix it up though.

Ah, I based the patch off 2.6.33..

Grant: let me know if you need some help/testing, nice to run into you again.

Would be nice if you could respin and test your patch against 2.6.34-rc1. :-)

Otherwise I'll look at it tomorrow.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.