* [PATCH] dtc: parse NOP in dtb input
@ 2007-06-10 4:21 Milton Miller
2007-06-11 13:41 ` Jon Loeliger
2007-06-12 4:31 ` David Gibson
0 siblings, 2 replies; 3+ messages in thread
From: Milton Miller @ 2007-06-10 4:21 UTC (permalink / raw)
To: jdl; +Cc: linuxppc-dev, david
Version 16 and later of the flat device tree format allow NOPs
to be placed in the tree. When processing dtb input, dtc must
recognise them.
Previously it would produce the error message
FATAL ERROR: Invalid opcode word 00000004 in device tree blob
Signed-off-by: Milton Miller <miltonm@bga.com>
---
I was trying to look at the output of convert_flattree_inplace
when I found this. ftdump.c was able to process the input,
producing // [NOP] comments when encountered.
--- dtc/flattree.c.orig 2007-06-07 15:23:53.000000000 -0500
+++ dtc/flattree.c 2007-06-07 15:32:01.000000000 -0500
@@ -27,6 +27,7 @@
#define FTF_BOOTCPUID 0x8
#define FTF_STRTABSIZE 0x10
#define FTF_STRUCTSIZE 0x20
+#define FTF_NOPS 0x40
static struct version_info {
int version;
@@ -41,9 +42,9 @@ static struct version_info {
{3, 1, BPH_V3_SIZE,
FTF_FULLPATH|FTF_VARALIGN|FTF_NAMEPROPS|FTF_BOOTCPUID|FTF_STRTABSIZE},
{16, 16, BPH_V3_SIZE,
- FTF_BOOTCPUID|FTF_STRTABSIZE},
+ FTF_BOOTCPUID|FTF_STRTABSIZE|FTF_NOPS},
{17, 16, BPH_V17_SIZE,
- FTF_BOOTCPUID|FTF_STRTABSIZE|FTF_STRUCTSIZE},
+ FTF_BOOTCPUID|FTF_STRTABSIZE|FTF_STRUCTSIZE|FTF_NOPS},
};
struct emitter {
@@ -774,6 +775,13 @@ static struct node *unflatten_tree(struc
die("Premature OF_DT_END in device tree blob\n");
break;
+ case OF_DT_NOP:
+ if (flags & FTF_NOPS)
+ break;
+
+ die("OF_DT_NOP in device tree blob\n");
+ break;
+
default:
die("Invalid opcode word %08x in device tree blob\n",
val);
@@ -895,6 +903,8 @@ struct boot_info *dt_from_blob(FILE *f)
if (version < 16) {
flags |= FTF_FULLPATH | FTF_NAMEPROPS | FTF_VARALIGN;
+ } else {
+ flags |= FTF_NOPS;
}
inbuf_init(&memresvbuf,
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] dtc: parse NOP in dtb input
2007-06-10 4:21 [PATCH] dtc: parse NOP in dtb input Milton Miller
@ 2007-06-11 13:41 ` Jon Loeliger
2007-06-12 4:31 ` David Gibson
1 sibling, 0 replies; 3+ messages in thread
From: Jon Loeliger @ 2007-06-11 13:41 UTC (permalink / raw)
To: Milton Miller; +Cc: linuxppc-dev, david
So, like, the other day Milton Miller mumbled:
> Version 16 and later of the flat device tree format allow NOPs
> to be placed in the tree. When processing dtb input, dtc must
> recognise them.
>
> Previously it would produce the error message
> FATAL ERROR: Invalid opcode word 00000004 in device tree blob
>
> Signed-off-by: Milton Miller <miltonm@bga.com>
Applied.
Thanks,
jdl
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dtc: parse NOP in dtb input
2007-06-10 4:21 [PATCH] dtc: parse NOP in dtb input Milton Miller
2007-06-11 13:41 ` Jon Loeliger
@ 2007-06-12 4:31 ` David Gibson
1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2007-06-12 4:31 UTC (permalink / raw)
To: Milton Miller; +Cc: linuxppc-dev, jdl
On Sat, Jun 09, 2007 at 11:21:31PM -0500, Milton Miller wrote:
> Version 16 and later of the flat device tree format allow NOPs
> to be placed in the tree. When processing dtb input, dtc must
> recognise them.
>
> Previously it would produce the error message
> FATAL ERROR: Invalid opcode word 00000004 in device tree blob
>
> Signed-off-by: Milton Miller <miltonm@bga.com>
> ---
>
> I was trying to look at the output of convert_flattree_inplace
> when I found this. ftdump.c was able to process the input,
> producing // [NOP] comments when encountered.
Oops, we didn't parse NOPs already. That's a bit of an oversight.
[snip]
> @@ -774,6 +775,13 @@ static struct node *unflatten_tree(struc
> die("Premature OF_DT_END in device tree blob\n");
> break;
>
> + case OF_DT_NOP:
> + if (flags & FTF_NOPS)
> + break;
> +
> + die("OF_DT_NOP in device tree blob\n");
> + break;
> +
Actually, I think we should accept the NOPs (with at most a warning)
on all DTB versions. They may not have been defined for the early
versions, but they're not ambiguous.
--
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:[~2007-06-12 4:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-10 4:21 [PATCH] dtc: parse NOP in dtb input Milton Miller
2007-06-11 13:41 ` Jon Loeliger
2007-06-12 4:31 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).