All of lore.kernel.org
 help / color / mirror / Atom feed
* [v2 PATCH] of/flattree: Fix unhandled OF_DT_NOP tag when unflattening the device tree
@ 2010-03-19 20:01 Grant Likely
  2010-03-20  0:24   ` David Gibson
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Likely @ 2010-03-19 20:01 UTC (permalink / raw)
  To: devicetree-discuss, benh, monstr, linuxppc-dev

From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

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.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
v2 - adapted to new location of unflatten_dt_node().

Jason, please test against 2.6.34-rc1

 drivers/of/fdt.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 406757a..dee4fb5 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -376,8 +376,11 @@ 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 = be32_to_cpup((__be32 *)(*p));
 	}
 	if (tag != OF_DT_END_NODE) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [v2 PATCH] of/flattree: Fix unhandled OF_DT_NOP tag when unflattening the device tree
  2010-03-19 20:01 [v2 PATCH] of/flattree: Fix unhandled OF_DT_NOP tag when unflattening the device tree Grant Likely
@ 2010-03-20  0:24   ` David Gibson
  0 siblings, 0 replies; 3+ messages in thread
From: David Gibson @ 2010-03-20  0:24 UTC (permalink / raw)
  To: Grant Likely; +Cc: devicetree-discuss, linuxppc-dev, monstr

On Fri, Mar 19, 2010 at 02:01:49PM -0600, Grant Likely wrote:
> From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> 
> 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.

Fwiw, there's a test program in the libfdt/dtc tree called "nopulate"
which will liberally spread NOPs through a device tree blob (one
between every other tag), which might be useful for testing this

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [v2 PATCH] of/flattree: Fix unhandled OF_DT_NOP tag when unflattening the device tree
@ 2010-03-20  0:24   ` David Gibson
  0 siblings, 0 replies; 3+ messages in thread
From: David Gibson @ 2010-03-20  0:24 UTC (permalink / raw)
  To: Grant Likely
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ

On Fri, Mar 19, 2010 at 02:01:49PM -0600, Grant Likely wrote:
> From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> 
> 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.

Fwiw, there's a test program in the libfdt/dtc tree called "nopulate"
which will liberally spread NOPs through a device tree blob (one
between every other tag), which might be useful for testing this

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-20  0:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-19 20:01 [v2 PATCH] of/flattree: Fix unhandled OF_DT_NOP tag when unflattening the device tree Grant Likely
2010-03-20  0:24 ` David Gibson
2010-03-20  0:24   ` David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.