summaryrefslogtreecommitdiff
path: root/flattree.c
diff options
context:
space:
mode:
authorMilton Miller <miltonm@bga.com>2007-06-09 23:21:31 -0500
committerJon Loeliger <jdl@freescale.com>2007-06-11 08:40:00 -0500
commitce243227f1fd9d0353b428481b5a599db16a9d05 (patch)
tree10662f9279cd157c1ffc4720a3bba79fe20d05a4 /flattree.c
parent41eecd4c2acaca01295fdb48ddc9ec5520f5a7d4 (diff)
downloaddtc-ce243227f1fd9d0353b428481b5a599db16a9d05.tar.gz
dtc: parse NOP in dtb input
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>
Diffstat (limited to 'flattree.c')
-rw-r--r--flattree.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/flattree.c b/flattree.c
index b54f7ef..b802e2c 100644
--- a/flattree.c
+++ b/flattree.c
@@ -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(struct inbuf *dtbuf,
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,