History

scripts/dtc: Update to upstream version 0931cea3ba20

Sync to upstream dtc commit 0931cea3ba20 ("dtc: fdtdump: check fdt if not in scanning mode"). In particular, this pulls in dtc overlay support. This adds the following commits from upstream: f88865469b65 dtc: Fix memory leak in character literal parsing 00fbb8696b66 Rename boot_info 1ef86ad2c24f dtc: Clean up /dts-v1/ and /plugin/ handling in grammar e3c769aa9c16 dtc: Don't always generate __symbols__ for plugins c96cb3c0169e tests: Don't use -@ on plugin de/recompile tests 66381538ce24 tests: Remove "suppression of fixups" tests ba765b273f0f tests: Clarify dtc overlay tests 6ea8cd944fcd tests: More thorough tests of libfdt overlay application without dtc 7d8ef6e1db97 tests: Correct fdt handling of overlays without fixups and base trees without symbols b4dc0ed8b127 tests: Fix double expansion bugs in test code 3ea879dc0c8f tests: Split overlay tests into those with do/don't exercise dtc plugin generation 47b4d66a2f11 tests: Test auto-alias generation on base tree, not overlay 72e1ad811523 tests: Make overlay/plugin tests unconditional e7b3c3b5951b tests: Add overlay tests 9637e3f772a9 tests: Add check_path test 20f29d8d41f6 dtc: Plugin and fixup support a2c92cac53f8 dtc: Document the dynamic plugin internals 8f70ac39801d checks: Pass boot_info instead of root node ea10f953878f libfdt: add missing errors to fdt_strerror() daa75e8fa594 libfdt: fix fdt_stringlist_search() e28eff5b787a libfdt: fix fdt_stringlist_count() ae97c7722840 tests: overlay: Rename the device tree blobs to be more explicit 96162d2bd9cb tests: overlay: Add test suffix to the compiled blobs 5ce8634733b7 libfdt: Add fdt_overlay_apply to the exported symbols 804a9db90ad2 fdt: strerr: Remove spurious BADOVERLAY e8c3a1a493fa tests: overlay: Move back the bad fixup tests 7a72d89d3f81 libfdt: overlay: Fix symbols and fixups nodes condition cabbaa972cdd libfdt: overlay: Report a bad overlay for mismatching local fixups deb0a5c1aeaa libfdt: Add BADPHANDLE error string 7b7a6be9ba15 libfdt: Don't use 'index' as a local variable name aea8860d831e tests: Add tests cases for the overlay code 0cdd06c5135b libfdt: Add overlay application function 39240cc865cf libfdt: Extend the reach of FDT_ERR_BADPHANDLE 4aa3a6f5e6d9 libfdt: Add new errors for the overlay code 6d1832c9e64b dtc: Remove "home page" link 45fd440a9561 Fix some typing errors in libfdt.h and livetree.c a59be4939c13 Merge tag 'v1.4.2' a34bb721caca dtc: Fix assorted problems in the testcases for the -a option 874f40588d3e Implement the -a option to pad dtb aligned ec02b34c05be dtc: Makefile improvements for release uploading 1ed45d40a137 dtc: Bump version to 1.4.2 36fd7331fb11 libfdt: simplify fdt_del_mem_rsv() d877364e4a0f libfdt: Add fdt_setprop_inplace_namelen_partial 3e9037aaad44 libfdt: Add fdt_getprop_namelen_w 84e0e1346c68 libfdt: Add max phandle retrieval function d29126c90acb libfdt: Add iterator over properties 902d0f0953d0 libfdt: Add a subnodes iterator macro c539075ba8ba fdtput.c: Fix memory leak. f79ddb83e185 fdtget.c: Fix memory leak 1074ee54b63f convert-dtsv0-lexer.l: fix memory leak e24d39a024e6 fdtdump.c: make sure size_t argument to memchr is always unsigned. 44a59713cf05 Remove unused srcpos_dump() function cb9241ae3453 DTC: Fix memory leak on flatname. 1ee0ae24ea09 Simplify check field and macro names 9d97527a8621 Remove property check functions 2e709d158e11 Remove tree check functions c4cb12e193e3 Alter grammar to allow multiple /dts-v1/ tags d71d25d76012 Use xasprintf() in srcpos 9dc404958e9c util: Add xasprintf portable asprintf variant beef80b8b55f Correct a missing space in a fdt_header cast 68d43cec1253 Correct line lengths in libfdt.h b0dbceafd49a Correct space-after-tab in libfdt.h

Rob Herring committed 9 years ago

Commit 6f05afc1 parent 0c744ea24 files · +1661 −1019Browse files

Unified · Split

24 files
  1. scripts/dtc/checks.c +181 −168
  2. scripts/dtc/dtc-lexer.l +13 −8
  3. scripts/dtc/dtc-lexer.lex.c_shipped +331 −319
  4. scripts/dtc/dtc-parser.tab.c_shipped +392 −360
  5. scripts/dtc/dtc-parser.tab.h_shipped +29 −25
  6. scripts/dtc/dtc-parser.y +30 −4
  7. scripts/dtc/dtc.c +57 −12
  8. scripts/dtc/dtc.h +27 −12
  9. scripts/dtc/flattree.c +27 −14
  10. scripts/dtc/fstree.c +2 −3
  11. scripts/dtc/libfdt/Makefile.libfdt +1 −1
  12. scripts/dtc/libfdt/fdt_ro.c +28 −2
  13. scripts/dtc/libfdt/fdt_rw.c +1 −5
  14. scripts/dtc/libfdt/fdt_strerror.c +6 −0
  15. scripts/dtc/libfdt/fdt_wip.c +25 −4
  16. scripts/dtc/libfdt/libfdt.h +180 −30
  17. scripts/dtc/libfdt/libfdt_env.h +1 −0
  18. scripts/dtc/livetree.c +283 −16
  19. scripts/dtc/srcpos.c +8 −27
  20. scripts/dtc/srcpos.h +0 −1
  21. scripts/dtc/treesource.c +7 −7
  22. scripts/dtc/util.c +30 −0
  23. scripts/dtc/util.h +1 −0
  24. scripts/dtc/version_gen.h +1 −1
scripts/dtc/checks.c+181−168
@@ -40,16 +40,11 @@ enum checkstatus { · 39 unmodified lines
4040
4141 struct check;
4242
43−typedef void (*tree_check_fn)(struct check *c, struct node *dt);
44−typedef void (*node_check_fn)(struct check *c, struct node *dt, struct node *node);
45−typedef void (*prop_check_fn)(struct check *c, struct node *dt,
46− struct node *node, struct property *prop);
43+typedef void (*check_fn)(struct check *c, struct dt_info *dti, struct node *node);
4744
4845 struct check {
4946 const char *name;
50− tree_check_fn tree_fn;
51− node_check_fn node_fn;
52− prop_check_fn prop_fn;
47+ check_fn fn;
5348 void *data;
5449 bool warn, error;
5550 enum checkstatus status;
@@ -58,45 +53,24 @@ struct check { · 2 unmodified lines
5853 struct check **prereq;
5954 };
6055
61−#define CHECK_ENTRY(nm, tfn, nfn, pfn, d, w, e, ...) \
62− static struct check *nm##_prereqs[] = { __VA_ARGS__ }; \
63− static struct check nm = { \
64− .name = #nm, \
65− .tree_fn = (tfn), \
66− .node_fn = (nfn), \
67− .prop_fn = (pfn), \
68− .data = (d), \
69− .warn = (w), \
70− .error = (e), \
56+#define CHECK_ENTRY(_nm, _fn, _d, _w, _e, ...) \
57+ static struct check *_nm##_prereqs[] = { __VA_ARGS__ }; \
58+ static struct check _nm = { \
59+ .name = #_nm, \
60+ .fn = (_fn), \
61+ .data = (_d), \
62+ .warn = (_w), \
63+ .error = (_e), \
7164 .status = UNCHECKED, \
72− .num_prereqs = ARRAY_SIZE(nm##_prereqs), \
73− .prereq = nm##_prereqs, \
65+ .num_prereqs = ARRAY_SIZE(_nm##_prereqs), \
66+ .prereq = _nm##_prereqs, \
7467 };
75−#define WARNING(nm, tfn, nfn, pfn, d, ...) \
76− CHECK_ENTRY(nm, tfn, nfn, pfn, d, true, false, __VA_ARGS__)
77−#define ERROR(nm, tfn, nfn, pfn, d, ...) \
78− CHECK_ENTRY(nm, tfn, nfn, pfn, d, false, true, __VA_ARGS__)
79−#define CHECK(nm, tfn, nfn, pfn, d, ...) \
80− CHECK_ENTRY(nm, tfn, nfn, pfn, d, false, false, __VA_ARGS__)
81−
82−#define TREE_WARNING(nm, d, ...) \
83− WARNING(nm, check_##nm, NULL, NULL, d, __VA_ARGS__)
84−#define TREE_ERROR(nm, d, ...) \
85− ERROR(nm, check_##nm, NULL, NULL, d, __VA_ARGS__)
86−#define TREE_CHECK(nm, d, ...) \
87− CHECK(nm, check_##nm, NULL, NULL, d, __VA_ARGS__)
88−#define NODE_WARNING(nm, d, ...) \
89− WARNING(nm, NULL, check_##nm, NULL, d, __VA_ARGS__)
90−#define NODE_ERROR(nm, d, ...) \
91− ERROR(nm, NULL, check_##nm, NULL, d, __VA_ARGS__)
92−#define NODE_CHECK(nm, d, ...) \
93− CHECK(nm, NULL, check_##nm, NULL, d, __VA_ARGS__)
94−#define PROP_WARNING(nm, d, ...) \
95− WARNING(nm, NULL, NULL, check_##nm, d, __VA_ARGS__)
96−#define PROP_ERROR(nm, d, ...) \
97− ERROR(nm, NULL, NULL, check_##nm, d, __VA_ARGS__)
98−#define PROP_CHECK(nm, d, ...) \
99− CHECK(nm, NULL, NULL, check_##nm, d, __VA_ARGS__)
68+#define WARNING(_nm, _fn, _d, ...) \
69+ CHECK_ENTRY(_nm, _fn, _d, true, false, __VA_ARGS__)
70+#define ERROR(_nm, _fn, _d, ...) \
71+ CHECK_ENTRY(_nm, _fn, _d, false, true, __VA_ARGS__)
72+#define CHECK(_nm, _fn, _d, ...) \
73+ CHECK_ENTRY(_nm, _fn, _d, false, false, __VA_ARGS__)
10074
10175 #ifdef __GNUC__
10276 static inline void check_msg(struct check *c, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
@@ -123,27 +97,21 @@ static inline void check_msg(struct check *c, const char *fmt, ...) · 20 unmodified lines
12397 check_msg((c), __VA_ARGS__); \
12498 } while (0)
12599
126−static void check_nodes_props(struct check *c, struct node *dt, struct node *node)
100+static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node)
127101 {
128102 struct node *child;
129− struct property *prop;
130103
131104 TRACE(c, "%s", node->fullpath);
132− if (c->node_fn)
133− c->node_fn(c, dt, node);
134−
135− if (c->prop_fn)
136− for_each_property(node, prop) {
137− TRACE(c, "%s\t'%s'", node->fullpath, prop->name);
138− c->prop_fn(c, dt, node, prop);
139− }
105+ if (c->fn)
106+ c->fn(c, dti, node);
140107
141108 for_each_child(node, child)
142− check_nodes_props(c, dt, child);
109+ check_nodes_props(c, dti, child);
143110 }
144111
145−static bool run_check(struct check *c, struct node *dt)
112+static bool run_check(struct check *c, struct dt_info *dti)
146113 {
114+ struct node *dt = dti->dt;
147115 bool error = false;
148116 int i;
149117
@@ -156,7 +124,7 @@ static bool run_check(struct check *c, struct node *dt) · 6 unmodified lines
156124
157125 for (i = 0; i < c->num_prereqs; i++) {
158126 struct check *prq = c->prereq[i];
159− error = error || run_check(prq, dt);
127+ error = error || run_check(prq, dti);
160128 if (prq->status != PASSED) {
161129 c->status = PREREQ;
162130 check_msg(c, "Failed prerequisite '%s'",
@@ -167,11 +135,8 @@ static bool run_check(struct check *c, struct node *dt) · 4 unmodified lines
167135 if (c->status != UNCHECKED)
168136 goto out;
169137
170− if (c->node_fn || c->prop_fn)
171− check_nodes_props(c, dt, dt);
138+ check_nodes_props(c, dti, dt);
172139
173− if (c->tree_fn)
174− c->tree_fn(c, dt);
175140 if (c->status == UNCHECKED)
176141 c->status = PASSED;
177142
@@ -189,13 +154,14 @@ out: · 11 unmodified lines
189154 */
190155
191156 /* A check which always fails, for testing purposes only */
192−static inline void check_always_fail(struct check *c, struct node *dt)
157+static inline void check_always_fail(struct check *c, struct dt_info *dti,
158+ struct node *node)
193159 {
194160 FAIL(c, "always_fail check");
195161 }
196−TREE_CHECK(always_fail, NULL);
162+CHECK(always_fail, check_always_fail, NULL);
197163
198−static void check_is_string(struct check *c, struct node *root,
164+static void check_is_string(struct check *c, struct dt_info *dti,
199165 struct node *node)
200166 {
201167 struct property *prop;
@@ -210,11 +176,11 @@ static void check_is_string(struct check *c, struct node *root, · 8 unmodified lines
210176 propname, node->fullpath);
211177 }
212178 #define WARNING_IF_NOT_STRING(nm, propname) \
213− WARNING(nm, NULL, check_is_string, NULL, (propname))
179+ WARNING(nm, check_is_string, (propname))
214180 #define ERROR_IF_NOT_STRING(nm, propname) \
215− ERROR(nm, NULL, check_is_string, NULL, (propname))
181+ ERROR(nm, check_is_string, (propname))
216182
217−static void check_is_cell(struct check *c, struct node *root,
183+static void check_is_cell(struct check *c, struct dt_info *dti,
218184 struct node *node)
219185 {
220186 struct property *prop;
@@ -229,15 +195,15 @@ static void check_is_cell(struct check *c, struct node *root, · 8 unmodified lines
229195 propname, node->fullpath);
230196 }
231197 #define WARNING_IF_NOT_CELL(nm, propname) \
232− WARNING(nm, NULL, check_is_cell, NULL, (propname))
198+ WARNING(nm, check_is_cell, (propname))
233199 #define ERROR_IF_NOT_CELL(nm, propname) \
234− ERROR(nm, NULL, check_is_cell, NULL, (propname))
200+ ERROR(nm, check_is_cell, (propname))
235201
236202 /*
237203 * Structural check functions
238204 */
239205
240−static void check_duplicate_node_names(struct check *c, struct node *dt,
206+static void check_duplicate_node_names(struct check *c, struct dt_info *dti,
241207 struct node *node)
242208 {
243209 struct node *child, *child2;
@@ -250,9 +216,9 @@ static void check_duplicate_node_names(struct check *c, struct node *dt, · 6 unmodified lines
250216 FAIL(c, "Duplicate node name %s",
251217 child->fullpath);
252218 }
253−NODE_ERROR(duplicate_node_names, NULL);
219+ERROR(duplicate_node_names, check_duplicate_node_names, NULL);
254220
255−static void check_duplicate_property_names(struct check *c, struct node *dt,
221+static void check_duplicate_property_names(struct check *c, struct dt_info *dti,
256222 struct node *node)
257223 {
258224 struct property *prop, *prop2;
@@ -267,14 +233,14 @@ static void check_duplicate_property_names(struct check *c, struct node *dt, · 8 unmodified lines
267233 }
268234 }
269235 }
270−NODE_ERROR(duplicate_property_names, NULL);
236+ERROR(duplicate_property_names, check_duplicate_property_names, NULL);
271237
272238 #define LOWERCASE "abcdefghijklmnopqrstuvwxyz"
273239 #define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
274240 #define DIGITS "0123456789"
275241 #define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"
276242
277−static void check_node_name_chars(struct check *c, struct node *dt,
243+static void check_node_name_chars(struct check *c, struct dt_info *dti,
278244 struct node *node)
279245 {
280246 int n = strspn(node->name, c->data);
@@ -283,19 +249,19 @@ static void check_node_name_chars(struct check *c, struct node *dt, · 2 unmodified lines
283249 FAIL(c, "Bad character '%c' in node %s",
284250 node->name[n], node->fullpath);
285251 }
286−NODE_ERROR(node_name_chars, PROPNODECHARS "@");
252+ERROR(node_name_chars, check_node_name_chars, PROPNODECHARS "@");
287253
288−static void check_node_name_format(struct check *c, struct node *dt,
254+static void check_node_name_format(struct check *c, struct dt_info *dti,
289255 struct node *node)
290256 {
291257 if (strchr(get_unitname(node), '@'))
292258 FAIL(c, "Node %s has multiple '@' characters in name",
293259 node->fullpath);
294260 }
295−NODE_ERROR(node_name_format, NULL, &node_name_chars);
261+ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars);
296262
297−static void check_unit_address_vs_reg(struct check *c, struct node *dt,
298− struct node *node)
263+static void check_unit_address_vs_reg(struct check *c, struct dt_info *dti,
264+ struct node *node)
299265 {
300266 const char *unitname = get_unitname(node);
301267 struct property *prop = get_property(node, "reg");
@@ -316,18 +282,22 @@ static void check_unit_address_vs_reg(struct check *c, struct node *dt, · 14 unmodified lines
316282 node->fullpath);
317283 }
318284 }
319−NODE_WARNING(unit_address_vs_reg, NULL);
285+WARNING(unit_address_vs_reg, check_unit_address_vs_reg, NULL);
320286
321−static void check_property_name_chars(struct check *c, struct node *dt,
322− struct node *node, struct property *prop)
287+static void check_property_name_chars(struct check *c, struct dt_info *dti,
288+ struct node *node)
323289 {
324− int n = strspn(prop->name, c->data);
290+ struct property *prop;
291+
292+ for_each_property(node, prop) {
293+ int n = strspn(prop->name, c->data);
325294
326− if (n < strlen(prop->name))
327− FAIL(c, "Bad character '%c' in property name \"%s\", node %s",
328− prop->name[n], prop->name, node->fullpath);
295+ if (n < strlen(prop->name))
296+ FAIL(c, "Bad character '%c' in property name \"%s\", node %s",
297+ prop->name[n], prop->name, node->fullpath);
298+ }
329299 }
330−PROP_ERROR(property_name_chars, PROPNODECHARS);
300+ERROR(property_name_chars, check_property_name_chars, PROPNODECHARS);
331301
332302 #define DESCLABEL_FMT "%s%s%s%s%s"
333303 #define DESCLABEL_ARGS(node,prop,mark) \
@@ -336,10 +306,11 @@ PROP_ERROR(property_name_chars, PROPNODECHARS); · 2 unmodified lines
336306 ((prop) ? (prop)->name : ""), \
337307 ((prop) ? "' in " : ""), (node)->fullpath
338308
339−static void check_duplicate_label(struct check *c, struct node *dt,
309+static void check_duplicate_label(struct check *c, struct dt_info *dti,
340310 const char *label, struct node *node,
341311 struct property *prop, struct marker *mark)
342312 {
313+ struct node *dt = dti->dt;
343314 struct node *othernode = NULL;
344315 struct property *otherprop = NULL;
345316 struct marker *othermark = NULL;
@@ -362,44 +333,43 @@ static void check_duplicate_label(struct check *c, struct node *dt, · 16 unmodified lines
362333 DESCLABEL_ARGS(othernode, otherprop, othermark));
363334 }
364335
365−static void check_duplicate_label_node(struct check *c, struct node *dt,
336+static void check_duplicate_label_node(struct check *c, struct dt_info *dti,
366337 struct node *node)
367338 {
368339 struct label *l;
340+ struct property *prop;
369341
370342 for_each_label(node->labels, l)
371− check_duplicate_label(c, dt, l->label, node, NULL, NULL);
372−}
373−static void check_duplicate_label_prop(struct check *c, struct node *dt,
374− struct node *node, struct property *prop)
375−{
376− struct marker *m = prop->val.markers;
377− struct label *l;
343+ check_duplicate_label(c, dti, l->label, node, NULL, NULL);
344+
345+ for_each_property(node, prop) {
346+ struct marker *m = prop->val.markers;
378347
379− for_each_label(prop->labels, l)
380− check_duplicate_label(c, dt, l->label, node, prop, NULL);
348+ for_each_label(prop->labels, l)
349+ check_duplicate_label(c, dti, l->label, node, prop, NULL);
381350
382− for_each_marker_of_type(m, LABEL)
383− check_duplicate_label(c, dt, m->ref, node, prop, m);
351+ for_each_marker_of_type(m, LABEL)
352+ check_duplicate_label(c, dti, m->ref, node, prop, m);
353+ }
384354 }
385−ERROR(duplicate_label, NULL, check_duplicate_label_node,
386− check_duplicate_label_prop, NULL);
355+ERROR(duplicate_label, check_duplicate_label_node, NULL);
387356
388−static void check_explicit_phandles(struct check *c, struct node *root,
389− struct node *node, struct property *prop)
357+static cell_t check_phandle_prop(struct check *c, struct dt_info *dti,
358+ struct node *node, const char *propname)
390359 {
360+ struct node *root = dti->dt;
361+ struct property *prop;
391362 struct marker *m;
392− struct node *other;
393363 cell_t phandle;
394364
395− if (!streq(prop->name, "phandle")
396− && !streq(prop->name, "linux,phandle"))
397− return;
365+ prop = get_property(node, propname);
366+ if (!prop)
367+ return 0;
398368
399369 if (prop->val.len != sizeof(cell_t)) {
400370 FAIL(c, "%s has bad length (%d) %s property",
401371 node->fullpath, prop->val.len, prop->name);
402− return;
372+ return 0;
403373 }
404374
405375 m = prop->val.markers;
@@ -411,14 +381,13 @@ static void check_explicit_phandles(struct check *c, struct node *root, · 5 unmodified lines
411381 * by construction. */ {
412382 FAIL(c, "%s in %s is a reference to another node",
413383 prop->name, node->fullpath);
414− return;
415384 }
416385 /* But setting this node's phandle equal to its own
417386 * phandle is allowed - that means allocate a unique
418387 * phandle for this node, even if it's not otherwise
419388 * referenced. The value will be filled in later, so
420− * no further checking for now. */
421− return;
389+ * we treat it as having no phandle data for now. */
390+ return 0;
422391 }
423392
424393 phandle = propval_cell(prop);
@@ -426,12 +395,36 @@ static void check_explicit_phandles(struct check *c, struct node *root, · 1 unmodified line
426395 if ((phandle == 0) || (phandle == -1)) {
427396 FAIL(c, "%s has bad value (0x%x) in %s property",
428397 node->fullpath, phandle, prop->name);
429− return;
398+ return 0;
430399 }
431400
432− if (node->phandle && (node->phandle != phandle))
433− FAIL(c, "%s has %s property which replaces existing phandle information",
434− node->fullpath, prop->name);
401+ return phandle;
402+}
403+
404+static void check_explicit_phandles(struct check *c, struct dt_info *dti,
405+ struct node *node)
406+{
407+ struct node *root = dti->dt;
408+ struct node *other;
409+ cell_t phandle, linux_phandle;
410+
411+ /* Nothing should have assigned phandles yet */
412+ assert(!node->phandle);
413+
414+ phandle = check_phandle_prop(c, dti, node, "phandle");
415+
416+ linux_phandle = check_phandle_prop(c, dti, node, "linux,phandle");
417+
418+ if (!phandle && !linux_phandle)
419+ /* No valid phandles; nothing further to check */
420+ return;
421+
422+ if (linux_phandle && phandle && (phandle != linux_phandle))
423+ FAIL(c, "%s has mismatching 'phandle' and 'linux,phandle'"
424+ " properties", node->fullpath);
425+
426+ if (linux_phandle && !phandle)
427+ phandle = linux_phandle;
435428
436429 other = get_node_by_phandle(root, phandle);
437430 if (other && (other != node)) {
@@ -442,9 +435,9 @@ static void check_explicit_phandles(struct check *c, struct node *root, · 4 unmodified lines
442435
443436 node->phandle = phandle;
444437 }
445−PROP_ERROR(explicit_phandles, NULL);
438+ERROR(explicit_phandles, check_explicit_phandles, NULL);
446439
447−static void check_name_properties(struct check *c, struct node *root,
440+static void check_name_properties(struct check *c, struct dt_info *dti,
448441 struct node *node)
449442 {
450443 struct property **pp, *prop = NULL;
@@ -472,60 +465,73 @@ static void check_name_properties(struct check *c, struct node *root, · 21 unmodified lines
472465 }
473466 }
474467 ERROR_IF_NOT_STRING(name_is_string, "name");
475−NODE_ERROR(name_properties, NULL, &name_is_string);
468+ERROR(name_properties, check_name_properties, NULL, &name_is_string);
476469
477470 /*
478471 * Reference fixup functions
479472 */
480473
481−static void fixup_phandle_references(struct check *c, struct node *dt,
482− struct node *node, struct property *prop)
474+static void fixup_phandle_references(struct check *c, struct dt_info *dti,
475+ struct node *node)
483476 {
484− struct marker *m = prop->val.markers;
485− struct node *refnode;
486− cell_t phandle;
477+ struct node *dt = dti->dt;
478+ struct property *prop;
487479
488− for_each_marker_of_type(m, REF_PHANDLE) {
489− assert(m->offset + sizeof(cell_t) <= prop->val.len);
480+ for_each_property(node, prop) {
481+ struct marker *m = prop->val.markers;
482+ struct node *refnode;
483+ cell_t phandle;
484+
485+ for_each_marker_of_type(m, REF_PHANDLE) {
486+ assert(m->offset + sizeof(cell_t) <= prop->val.len);
487+
488+ refnode = get_node_by_ref(dt, m->ref);
489+ if (! refnode) {
490+ if (!(dti->dtsflags & DTSF_PLUGIN))
491+ FAIL(c, "Reference to non-existent node or "
492+ "label \"%s\"\n", m->ref);
493+ else /* mark the entry as unresolved */
494+ *((cell_t *)(prop->val.val + m->offset)) =
495+ cpu_to_fdt32(0xffffffff);
496+ continue;
497+ }
490498
491− refnode = get_node_by_ref(dt, m->ref);
492− if (! refnode) {
493− FAIL(c, "Reference to non-existent node or label \"%s\"\n",
494− m->ref);
495− continue;
499+ phandle = get_node_phandle(dt, refnode);
500+ *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
496501 }
497−
498− phandle = get_node_phandle(dt, refnode);
499− *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
500502 }
501503 }
502−ERROR(phandle_references, NULL, NULL, fixup_phandle_references, NULL,
504+ERROR(phandle_references, fixup_phandle_references, NULL,
503505 &duplicate_node_names, &explicit_phandles);
504506
505−static void fixup_path_references(struct check *c, struct node *dt,
506− struct node *node, struct property *prop)
507+static void fixup_path_references(struct check *c, struct dt_info *dti,
508+ struct node *node)
507509 {
508− struct marker *m = prop->val.markers;
509− struct node *refnode;
510− char *path;
511−
512− for_each_marker_of_type(m, REF_PATH) {
513− assert(m->offset <= prop->val.len);
514−
515− refnode = get_node_by_ref(dt, m->ref);
516− if (!refnode) {
517− FAIL(c, "Reference to non-existent node or label \"%s\"\n",
518− m->ref);
519− continue;
520− }
510+ struct node *dt = dti->dt;
511+ struct property *prop;
512+
513+ for_each_property(node, prop) {
514+ struct marker *m = prop->val.markers;
515+ struct node *refnode;
516+ char *path;
517+
518+ for_each_marker_of_type(m, REF_PATH) {
519+ assert(m->offset <= prop->val.len);
521520
522− path = refnode->fullpath;
523− prop->val = data_insert_at_marker(prop->val, m, path,
524− strlen(path) + 1);
521+ refnode = get_node_by_ref(dt, m->ref);
522+ if (!refnode) {
523+ FAIL(c, "Reference to non-existent node or label \"%s\"\n",
524+ m->ref);
525+ continue;
526+ }
527+
528+ path = refnode->fullpath;
529+ prop->val = data_insert_at_marker(prop->val, m, path,
530+ strlen(path) + 1);
531+ }
525532 }
526533 }
527−ERROR(path_references, NULL, NULL, fixup_path_references, NULL,
528− &duplicate_node_names);
534+ERROR(path_references, fixup_path_references, NULL, &duplicate_node_names);
529535
530536 /*
531537 * Semantic checks
@@ -538,7 +544,7 @@ WARNING_IF_NOT_STRING(device_type_is_string, "device_type"); · 6 unmodified lines
538544 WARNING_IF_NOT_STRING(model_is_string, "model");
539545 WARNING_IF_NOT_STRING(status_is_string, "status");
540546
541−static void fixup_addr_size_cells(struct check *c, struct node *dt,
547+static void fixup_addr_size_cells(struct check *c, struct dt_info *dti,
542548 struct node *node)
543549 {
544550 struct property *prop;
@@ -554,7 +560,7 @@ static void fixup_addr_size_cells(struct check *c, struct node *dt, · 9 unmodified lines
554560 if (prop)
555561 node->size_cells = propval_cell(prop);
556562 }
557−WARNING(addr_size_cells, NULL, fixup_addr_size_cells, NULL, NULL,
563+WARNING(addr_size_cells, fixup_addr_size_cells, NULL,
558564 &address_cells_is_cell, &size_cells_is_cell);
559565
560566 #define node_addr_cells(n) \
@@ -562,7 +568,7 @@ WARNING(addr_size_cells, NULL, fixup_addr_size_cells, NULL, NULL, · 1 unmodified line
562568 #define node_size_cells(n) \
563569 (((n)->size_cells == -1) ? 1 : (n)->size_cells)
564570
565−static void check_reg_format(struct check *c, struct node *dt,
571+static void check_reg_format(struct check *c, struct dt_info *dti,
566572 struct node *node)
567573 {
568574 struct property *prop;
@@ -589,9 +595,9 @@ static void check_reg_format(struct check *c, struct node *dt, · 20 unmodified lines
589595 "(#address-cells == %d, #size-cells == %d)",
590596 node->fullpath, prop->val.len, addr_cells, size_cells);
591597 }
592−NODE_WARNING(reg_format, NULL, &addr_size_cells);
598+WARNING(reg_format, check_reg_format, NULL, &addr_size_cells);
593599
594−static void check_ranges_format(struct check *c, struct node *dt,
600+static void check_ranges_format(struct check *c, struct dt_info *dti,
595601 struct node *node)
596602 {
597603 struct property *prop;
@@ -630,12 +636,12 @@ static void check_ranges_format(struct check *c, struct node *dt, · 32 unmodified lines
630636 p_addr_cells, c_addr_cells, c_size_cells);
631637 }
632638 }
633−NODE_WARNING(ranges_format, NULL, &addr_size_cells);
639+WARNING(ranges_format, check_ranges_format, NULL, &addr_size_cells);
634640
635641 /*
636642 * Style checks
637643 */
638−static void check_avoid_default_addr_size(struct check *c, struct node *dt,
644+static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti,
639645 struct node *node)
640646 {
641647 struct property *reg, *ranges;
@@ -657,14 +663,21 @@ static void check_avoid_default_addr_size(struct check *c, struct node *dt, · 15 unmodified lines
657663 FAIL(c, "Relying on default #size-cells value for %s",
658664 node->fullpath);
659665 }
660−NODE_WARNING(avoid_default_addr_size, NULL, &addr_size_cells);
666+WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL,
667+ &addr_size_cells);
661668
662669 static void check_obsolete_chosen_interrupt_controller(struct check *c,
663− struct node *dt)
670+ struct dt_info *dti,
671+ struct node *node)
664672 {
673+ struct node *dt = dti->dt;
665674 struct node *chosen;
666675 struct property *prop;
667676
677+ if (node != dt)
678+ return;
679+
680+
668681 chosen = get_node_by_path(dt, "/chosen");
669682 if (!chosen)
670683 return;
@@ -674,7 +687,8 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, · 3 unmodified lines
674687 FAIL(c, "/chosen has obsolete \"interrupt-controller\" "
675688 "property");
676689 }
677−TREE_WARNING(obsolete_chosen_interrupt_controller, NULL);
690+WARNING(obsolete_chosen_interrupt_controller,
691+ check_obsolete_chosen_interrupt_controller, NULL);
678692
679693 static struct check *check_table[] = {
680694 &duplicate_node_names, &duplicate_property_names,
@@ -760,9 +774,8 @@ void parse_checks_option(bool warn, bool error, const char *arg) · 79 unmodified lines
760774 die("Unrecognized check name \"%s\"\n", name);
761775 }
762776
763−void process_checks(bool force, struct boot_info *bi)
777+void process_checks(bool force, struct dt_info *dti)
764778 {
765− struct node *dt = bi->dt;
766779 int i;
767780 int error = 0;
768781
@@ -770,7 +783,7 @@ void process_checks(bool force, struct boot_info *bi) · 1 unmodified line
770783 struct check *c = check_table[i];
771784
772785 if (c->warn || c->error)
773− error = error || run_check(c, dt);
786+ error = error || run_check(c, dti);
774787 }
775788
776789 if (error) {
scripts/dtc/dtc-lexer.l+13−8
@@ -121,6 +121,11 @@ static void lexical_error(const char *fmt, ...); · 120 unmodified lines
121121 return DT_V1;
122122 }
123123
124+<*>"/plugin/" {
125+ DPRINT("Keyword: /plugin/\n");
126+ return DT_PLUGIN;
127+ }
128+
124129 <*>"/memreserve/" {
125130 DPRINT("Keyword: /memreserve/\n");
126131 BEGIN_DEFAULT();
@@ -184,16 +189,16 @@ static void lexical_error(const char *fmt, ...); · 57 unmodified lines
184189 if (d.len == 1) {
185190 lexical_error("Empty character literal");
186191 yylval.integer = 0;
187− return DT_CHAR_LITERAL;
188− }
192+ } else {
193+ yylval.integer = (unsigned char)d.val[0];
189194
190− yylval.integer = (unsigned char)d.val[0];
191−
192− if (d.len > 2)
193− lexical_error("Character literal has %d"
194− " characters instead of 1",
195− d.len - 1);
195+ if (d.len > 2)
196+ lexical_error("Character literal has %d"
197+ " characters instead of 1",
198+ d.len - 1);
199+ }
196200
201+ data_free(d);
197202 return DT_CHAR_LITERAL;
198203 }
199204
scripts/dtc/dtc-lexer.lex.c_shipped+331−319
@@ -8,8 +8,8 @@ · 7 unmodified lines
88
99 #define FLEX_SCANNER
1010 #define YY_FLEX_MAJOR_VERSION 2
11−#define YY_FLEX_MINOR_VERSION 5
12−#define YY_FLEX_SUBMINOR_VERSION 39
11+#define YY_FLEX_MINOR_VERSION 6
12+#define YY_FLEX_SUBMINOR_VERSION 1
1313 #if YY_FLEX_SUBMINOR_VERSION > 0
1414 #define FLEX_BETA
1515 #endif
@@ -88,25 +88,13 @@ typedef unsigned int flex_uint32_t; · 72 unmodified lines
8888
8989 #endif /* ! FLEXINT_H */
9090
91−#ifdef __cplusplus
92−
93−/* The "const" storage-class-modifier is valid. */
94−#define YY_USE_CONST
95−
96−#else /* ! __cplusplus */
97−
98−/* C99 requires __STDC__ to be defined as 1. */
99−#if defined (__STDC__)
100−
101−#define YY_USE_CONST
102−
103−#endif /* defined (__STDC__) */
104−#endif /* ! __cplusplus */
105−
106−#ifdef YY_USE_CONST
91+/* TODO: this is always defined, so inline it */
10792 #define yyconst const
93+
94+#if defined(__GNUC__) && __GNUC__ >= 3
95+#define yynoreturn __attribute__((__noreturn__))
10896 #else
109−#define yyconst
97+#define yynoreturn
11098 #endif
11199
112100 /* Returned upon end-of-file. */
@@ -167,7 +155,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; · 54 unmodified lines
167155 typedef size_t yy_size_t;
168156 #endif
169157
170−extern yy_size_t yyleng;
158+extern int yyleng;
171159
172160 extern FILE *yyin, *yyout;
173161
@@ -206,12 +194,12 @@ struct yy_buffer_state · 32 unmodified lines
206194 /* Size of input buffer in bytes, not including room for EOB
207195 * characters.
208196 */
209− yy_size_t yy_buf_size;
197+ int yy_buf_size;
210198
211199 /* Number of characters read into yy_ch_buf, not including EOB
212200 * characters.
213201 */
214− yy_size_t yy_n_chars;
202+ int yy_n_chars;
215203
216204 /* Whether we "own" the buffer - i.e., we know we created it,
217205 * and can realloc() it to grow it, and should free() it to
@@ -234,7 +222,7 @@ struct yy_buffer_state · 16 unmodified lines
234222
235223 int yy_bs_lineno; /**< The line count. */
236224 int yy_bs_column; /**< The column count. */
237−
225+
238226 /* Whether to try to fill the input buffer when we reach the
239227 * end of it.
240228 */
@@ -262,7 +250,7 @@ struct yy_buffer_state · 21 unmodified lines
262250 /* Stack of input buffers. */
263251 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
264252 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
265−static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
253+static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
266254
267255 /* We provide macros for accessing buffer states in case in the
268256 * future we want to put the buffer states in a more general
@@ -281,11 +269,11 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ · 12 unmodified lines
281269
282270 /* yy_hold_char holds the character lost when yytext is formed. */
283271 static char yy_hold_char;
284−static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
285−yy_size_t yyleng;
272+static int yy_n_chars; /* number of characters read into yy_ch_buf */
273+int yyleng;
286274
287275 /* Points to current character in buffer. */
288−static char *yy_c_buf_p = (char *) 0;
276+static char *yy_c_buf_p = NULL;
289277 static int yy_init = 0; /* whether we need to initialize */
290278 static int yy_start = 0; /* start state number */
291279
@@ -310,7 +298,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); · 18 unmodified lines
310298
311299 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
312300 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
313−YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
301+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
314302
315303 void *yyalloc (yy_size_t );
316304 void *yyrealloc (void *,yy_size_t );
@@ -342,12 +330,12 @@ void yyfree (void * ); · 25 unmodified lines
342330
343331 /* Begin user sect3 */
344332
345−#define yywrap() 1
333+#define yywrap() (/*CONSTCOND*/1)
346334 #define YY_SKIP_YYWRAP
347335
348336 typedef unsigned char YY_CHAR;
349337
350−FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
338+FILE *yyin = NULL, *yyout = NULL;
351339
352340 typedef int yy_state_type;
353341
@@ -356,25 +344,28 @@ extern int yylineno; · 2 unmodified lines
356344 int yylineno = 1;
357345
358346 extern char *yytext;
347+#ifdef yytext_ptr
348+#undef yytext_ptr
349+#endif
359350 #define yytext_ptr yytext
360351
361352 static yy_state_type yy_get_previous_state (void );
362353 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
363354 static int yy_get_next_buffer (void );
364−static void yy_fatal_error (yyconst char msg[] );
355+static void yynoreturn yy_fatal_error (yyconst char* msg );
365356
366357 /* Done after the current pattern has been matched and before the
367358 * corresponding action - sets up yytext.
368359 */
369360 #define YY_DO_BEFORE_ACTION \
370361 (yytext_ptr) = yy_bp; \
371− yyleng = (size_t) (yy_cp - yy_bp); \
362+ yyleng = (int) (yy_cp - yy_bp); \
372363 (yy_hold_char) = *yy_cp; \
373364 *yy_cp = '\0'; \
374365 (yy_c_buf_p) = yy_cp;
375366
376−#define YY_NUM_RULES 30
377−#define YY_END_OF_BUFFER 31
367+#define YY_NUM_RULES 31
368+#define YY_END_OF_BUFFER 32
378369 /* This struct is not used in this scanner,
379370 but its presence is necessary. */
380371 struct yy_trans_info
@@ -382,28 +373,29 @@ struct yy_trans_info · 1 unmodified line
382373 flex_int32_t yy_verify;
383374 flex_int32_t yy_nxt;
384375 };
385−static yyconst flex_int16_t yy_accept[159] =
376+static yyconst flex_int16_t yy_accept[166] =
386377 { 0,
387− 0, 0, 0, 0, 0, 0, 0, 0, 31, 29,
388− 18, 18, 29, 29, 29, 29, 29, 29, 29, 29,
389− 29, 29, 29, 29, 29, 29, 15, 16, 16, 29,
390− 16, 10, 10, 18, 26, 0, 3, 0, 27, 12,
391− 0, 0, 11, 0, 0, 0, 0, 0, 0, 0,
392− 21, 23, 25, 24, 22, 0, 9, 28, 0, 0,
393− 0, 14, 14, 16, 16, 16, 10, 10, 10, 0,
394− 12, 0, 11, 0, 0, 0, 20, 0, 0, 0,
395− 0, 0, 0, 0, 0, 16, 10, 10, 10, 0,
396− 13, 19, 0, 0, 0, 0, 0, 0, 0, 0,
397−
398− 0, 16, 0, 0, 0, 0, 0, 0, 0, 0,
399− 0, 16, 6, 0, 0, 0, 0, 0, 0, 2,
400− 0, 0, 0, 0, 0, 0, 0, 0, 4, 17,
401− 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
402− 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
403− 5, 8, 0, 0, 0, 0, 7, 0
378+ 0, 0, 0, 0, 0, 0, 0, 0, 32, 30,
379+ 19, 19, 30, 30, 30, 30, 30, 30, 30, 30,
380+ 30, 30, 30, 30, 30, 30, 16, 17, 17, 30,
381+ 17, 11, 11, 19, 27, 0, 3, 0, 28, 13,
382+ 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,
383+ 0, 22, 24, 26, 25, 23, 0, 10, 29, 0,
384+ 0, 0, 15, 15, 17, 17, 17, 11, 11, 11,
385+ 0, 13, 0, 12, 0, 0, 0, 21, 0, 0,
386+ 0, 0, 0, 0, 0, 0, 0, 17, 11, 11,
387+ 11, 0, 14, 20, 0, 0, 0, 0, 0, 0,
388+
389+ 0, 0, 0, 0, 17, 0, 0, 0, 0, 0,
390+ 0, 0, 0, 0, 0, 17, 7, 0, 0, 0,
391+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
392+ 0, 0, 0, 0, 4, 18, 0, 0, 5, 2,
393+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
394+ 0, 0, 1, 0, 0, 0, 0, 6, 9, 0,
395+ 0, 0, 0, 8, 0
404396 } ;
405397
406−static yyconst flex_int32_t yy_ec[256] =
398+static yyconst YY_CHAR yy_ec[256] =
407399 { 0,
408400 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
409401 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
@@ -416,9 +408,9 @@ static yyconst flex_int32_t yy_ec[256] = · 6 unmodified lines
416408 22, 22, 22, 22, 24, 22, 22, 25, 22, 22,
417409 1, 26, 27, 1, 22, 1, 21, 28, 29, 30,
418410
419− 31, 21, 22, 22, 32, 22, 22, 33, 34, 35,
420− 36, 37, 22, 38, 39, 40, 41, 42, 22, 25,
421− 43, 22, 44, 45, 46, 1, 1, 1, 1, 1,
411+ 31, 21, 32, 22, 33, 22, 22, 34, 35, 36,
412+ 37, 38, 22, 39, 40, 41, 42, 43, 22, 25,
413+ 44, 22, 45, 46, 47, 1, 1, 1, 1, 1,
422414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -435,163 +427,165 @@ static yyconst flex_int32_t yy_ec[256] = · 10 unmodified lines
435427 1, 1, 1, 1, 1
436428 } ;
437429
438−static yyconst flex_int32_t yy_meta[47] =
430+static yyconst YY_CHAR yy_meta[48] =
439431 { 0,
440432 1, 1, 1, 1, 1, 1, 2, 3, 1, 2,
441433 2, 2, 4, 5, 5, 5, 6, 1, 1, 1,
442434 7, 8, 8, 8, 8, 1, 1, 7, 7, 7,
443435 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
444− 8, 8, 8, 3, 1, 4
436+ 8, 8, 8, 8, 3, 1, 4
445437 } ;
446438
447−static yyconst flex_int16_t yy_base[173] =
439+static yyconst flex_uint16_t yy_base[180] =
448440 { 0,
449− 0, 383, 34, 382, 65, 381, 37, 105, 387, 391,
450− 54, 111, 367, 110, 109, 109, 112, 41, 366, 104,
451− 367, 338, 124, 117, 0, 144, 391, 0, 121, 0,
452− 135, 155, 140, 179, 391, 160, 391, 379, 391, 0,
453− 368, 141, 391, 167, 370, 376, 346, 103, 342, 345,
454− 391, 391, 391, 391, 391, 358, 391, 391, 175, 342,
455− 338, 391, 355, 0, 185, 339, 184, 347, 346, 0,
456− 0, 322, 175, 357, 175, 363, 352, 324, 330, 323,
457− 332, 326, 201, 324, 329, 322, 391, 333, 181, 309,
458− 391, 341, 340, 313, 320, 338, 178, 311, 146, 317,
459−
460− 314, 315, 335, 331, 303, 300, 309, 299, 308, 188,
461− 336, 335, 391, 305, 320, 281, 283, 271, 203, 288,
462− 281, 271, 266, 264, 245, 242, 208, 104, 391, 391,
463− 244, 218, 204, 219, 206, 224, 201, 212, 204, 229,
464− 215, 208, 207, 200, 219, 391, 233, 221, 200, 181,
465− 391, 391, 149, 122, 86, 41, 391, 391, 245, 251,
466− 259, 263, 267, 273, 280, 284, 292, 300, 304, 310,
467− 318, 326
441+ 0, 393, 35, 392, 66, 391, 38, 107, 397, 401,
442+ 55, 113, 377, 112, 111, 111, 114, 42, 376, 106,
443+ 377, 347, 126, 120, 0, 147, 401, 0, 124, 0,
444+ 137, 158, 170, 163, 401, 153, 401, 389, 401, 0,
445+ 378, 120, 401, 131, 380, 386, 355, 139, 351, 355,
446+ 351, 401, 401, 401, 401, 401, 367, 401, 401, 185,
447+ 350, 346, 401, 364, 0, 185, 347, 189, 356, 355,
448+ 0, 0, 330, 180, 366, 141, 372, 361, 332, 338,
449+ 331, 341, 334, 326, 205, 331, 337, 329, 401, 341,
450+ 167, 316, 401, 349, 348, 320, 328, 346, 180, 318,
451+
452+ 324, 209, 324, 320, 322, 342, 338, 309, 306, 315,
453+ 305, 315, 312, 192, 342, 341, 401, 293, 306, 282,
454+ 268, 252, 255, 203, 285, 282, 272, 268, 252, 233,
455+ 232, 239, 208, 107, 401, 401, 238, 211, 401, 211,
456+ 212, 208, 228, 203, 215, 207, 233, 222, 212, 211,
457+ 203, 227, 401, 237, 225, 204, 185, 401, 401, 149,
458+ 128, 88, 42, 401, 401, 253, 259, 267, 271, 275,
459+ 281, 288, 292, 300, 308, 312, 318, 326, 334
468460 } ;
469461
470−static yyconst flex_int16_t yy_def[173] =
462+static yyconst flex_int16_t yy_def[180] =
471463 { 0,
472− 158, 1, 1, 3, 158, 5, 1, 1, 158, 158,
473− 158, 158, 158, 159, 160, 161, 158, 158, 158, 158,
474− 162, 158, 158, 158, 163, 162, 158, 164, 165, 164,
475− 164, 158, 158, 158, 158, 159, 158, 159, 158, 166,
476− 158, 161, 158, 161, 167, 168, 158, 158, 158, 158,
477− 158, 158, 158, 158, 158, 162, 158, 158, 158, 158,
478− 158, 158, 162, 164, 165, 164, 158, 158, 158, 169,
479− 166, 170, 161, 167, 167, 168, 158, 158, 158, 158,
480− 158, 158, 158, 158, 158, 164, 158, 158, 169, 170,
481− 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
482−
483− 158, 164, 158, 158, 158, 158, 158, 158, 158, 171,
484− 158, 164, 158, 158, 158, 158, 158, 158, 171, 158,
485− 171, 158, 158, 158, 158, 158, 158, 158, 158, 158,
486− 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
487− 172, 158, 158, 158, 172, 158, 172, 158, 158, 158,
488− 158, 158, 158, 158, 158, 158, 158, 0, 158, 158,
489− 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
490− 158, 158
464+ 165, 1, 1, 3, 165, 5, 1, 1, 165, 165,
465+ 165, 165, 165, 166, 167, 168, 165, 165, 165, 165,
466+ 169, 165, 165, 165, 170, 169, 165, 171, 172, 171,
467+ 171, 165, 165, 165, 165, 166, 165, 166, 165, 173,
468+ 165, 168, 165, 168, 174, 175, 165, 165, 165, 165,
469+ 165, 165, 165, 165, 165, 165, 169, 165, 165, 165,
470+ 165, 165, 165, 169, 171, 172, 171, 165, 165, 165,
471+ 176, 173, 177, 168, 174, 174, 175, 165, 165, 165,
472+ 165, 165, 165, 165, 165, 165, 165, 171, 165, 165,
473+ 176, 177, 165, 165, 165, 165, 165, 165, 165, 165,
474+
475+ 165, 165, 165, 165, 171, 165, 165, 165, 165, 165,
476+ 165, 165, 165, 178, 165, 171, 165, 165, 165, 165,
477+ 165, 165, 165, 178, 165, 178, 165, 165, 165, 165,
478+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
479+ 165, 165, 165, 165, 165, 165, 165, 179, 165, 165,
480+ 165, 179, 165, 179, 165, 165, 165, 165, 165, 165,
481+ 165, 165, 165, 165, 0, 165, 165, 165, 165, 165,
482+ 165, 165, 165, 165, 165, 165, 165, 165, 165
491483 } ;
492484
493−static yyconst flex_int16_t yy_nxt[438] =
485+static yyconst flex_uint16_t yy_nxt[449] =
494486 { 0,
495487 10, 11, 12, 11, 13, 14, 10, 15, 16, 10,
496488 10, 10, 17, 10, 10, 10, 10, 18, 19, 20,
497489 21, 21, 21, 21, 21, 10, 10, 21, 21, 21,
498490 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
499− 21, 21, 21, 10, 22, 10, 24, 25, 25, 25,
500− 32, 33, 33, 157, 26, 34, 34, 34, 51, 52,
501− 27, 26, 26, 26, 26, 10, 11, 12, 11, 13,
502− 14, 28, 15, 16, 28, 28, 28, 24, 28, 28,
503− 28, 10, 18, 19, 20, 29, 29, 29, 29, 29,
504− 30, 10, 29, 29, 29, 29, 29, 29, 29, 29,
505−
506− 29, 29, 29, 29, 29, 29, 29, 29, 10, 22,
507− 10, 23, 34, 34, 34, 37, 39, 43, 32, 33,
508− 33, 45, 54, 55, 46, 59, 45, 64, 156, 46,
509− 64, 64, 64, 79, 44, 38, 59, 57, 134, 47,
510− 135, 48, 80, 49, 47, 50, 48, 99, 61, 43,
511− 50, 110, 41, 67, 67, 67, 60, 63, 63, 63,
512− 57, 155, 68, 69, 63, 37, 44, 66, 67, 67,
513− 67, 63, 63, 63, 63, 73, 59, 68, 69, 70,
514− 34, 34, 34, 43, 75, 38, 154, 92, 83, 83,
515− 83, 64, 44, 120, 64, 64, 64, 67, 67, 67,
516−
517− 44, 57, 99, 68, 69, 107, 68, 69, 120, 127,
518− 108, 153, 152, 121, 83, 83, 83, 133, 133, 133,
519− 146, 133, 133, 133, 146, 140, 140, 140, 121, 141,
520− 140, 140, 140, 151, 141, 158, 150, 149, 148, 144,
521− 147, 143, 142, 139, 147, 36, 36, 36, 36, 36,
522− 36, 36, 36, 40, 138, 137, 136, 40, 40, 42,
523− 42, 42, 42, 42, 42, 42, 42, 56, 56, 56,
524− 56, 62, 132, 62, 64, 131, 130, 64, 129, 64,
525− 64, 65, 128, 158, 65, 65, 65, 65, 71, 127,
526− 71, 71, 74, 74, 74, 74, 74, 74, 74, 74,
527−
528− 76, 76, 76, 76, 76, 76, 76, 76, 89, 126,
529− 89, 90, 125, 90, 90, 124, 90, 90, 119, 119,
530− 119, 119, 119, 119, 119, 119, 145, 145, 145, 145,
531− 145, 145, 145, 145, 123, 122, 59, 59, 118, 117,
532− 116, 115, 114, 113, 45, 112, 108, 111, 109, 106,
533− 105, 104, 46, 103, 91, 87, 102, 101, 100, 98,
534− 97, 96, 95, 94, 93, 77, 75, 91, 88, 87,
535− 86, 57, 85, 84, 57, 82, 81, 78, 77, 75,
536− 72, 158, 58, 57, 53, 35, 158, 31, 23, 23,
537− 9, 158, 158, 158, 158, 158, 158, 158, 158, 158,
538−
539− 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
540− 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
541− 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
542− 158, 158, 158, 158, 158, 158, 158
491+ 21, 21, 21, 21, 10, 22, 10, 24, 25, 25,
492+ 25, 32, 33, 33, 164, 26, 34, 34, 34, 52,
493+ 53, 27, 26, 26, 26, 26, 10, 11, 12, 11,
494+ 13, 14, 28, 15, 16, 28, 28, 28, 24, 28,
495+ 28, 28, 10, 18, 19, 20, 29, 29, 29, 29,
496+ 29, 30, 10, 29, 29, 29, 29, 29, 29, 29,
497+
498+ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
499+ 10, 22, 10, 23, 34, 34, 34, 37, 39, 43,
500+ 32, 33, 33, 45, 55, 56, 46, 60, 43, 45,
501+ 65, 163, 46, 65, 65, 65, 44, 38, 60, 74,
502+ 58, 47, 141, 48, 142, 44, 49, 47, 50, 48,
503+ 76, 51, 62, 94, 50, 41, 44, 51, 37, 61,
504+ 64, 64, 64, 58, 34, 34, 34, 64, 162, 80,
505+ 67, 68, 68, 68, 64, 64, 64, 64, 38, 81,
506+ 69, 70, 71, 68, 68, 68, 60, 161, 43, 69,
507+ 70, 65, 69, 70, 65, 65, 65, 125, 85, 85,
508+
509+ 85, 58, 68, 68, 68, 44, 102, 110, 125, 133,
510+ 102, 69, 70, 111, 114, 160, 159, 126, 85, 85,
511+ 85, 140, 140, 140, 140, 140, 140, 153, 126, 147,
512+ 147, 147, 153, 148, 147, 147, 147, 158, 148, 165,
513+ 157, 156, 155, 151, 150, 149, 146, 154, 145, 144,
514+ 143, 139, 154, 36, 36, 36, 36, 36, 36, 36,
515+ 36, 40, 138, 137, 136, 40, 40, 42, 42, 42,
516+ 42, 42, 42, 42, 42, 57, 57, 57, 57, 63,
517+ 135, 63, 65, 134, 165, 65, 133, 65, 65, 66,
518+ 132, 131, 66, 66, 66, 66, 72, 130, 72, 72,
519+
520+ 75, 75, 75, 75, 75, 75, 75, 75, 77, 77,
521+ 77, 77, 77, 77, 77, 77, 91, 129, 91, 92,
522+ 128, 92, 92, 127, 92, 92, 124, 124, 124, 124,
523+ 124, 124, 124, 124, 152, 152, 152, 152, 152, 152,
524+ 152, 152, 60, 60, 123, 122, 121, 120, 119, 118,
525+ 117, 45, 116, 111, 115, 113, 112, 109, 108, 107,
526+ 46, 106, 93, 89, 105, 104, 103, 101, 100, 99,
527+ 98, 97, 96, 95, 78, 76, 93, 90, 89, 88,
528+ 58, 87, 86, 58, 84, 83, 82, 79, 78, 76,
529+ 73, 165, 59, 58, 54, 35, 165, 31, 23, 23,
530+
531+ 9, 165, 165, 165, 165, 165, 165, 165, 165, 165,
532+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
533+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
534+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
535+ 165, 165, 165, 165, 165, 165, 165, 165
543536 } ;
544537
545−static yyconst flex_int16_t yy_chk[438] =
538+static yyconst flex_int16_t yy_chk[449] =
546539 { 0,
547540 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
548541 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
549542 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
550543 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
551− 1, 1, 1, 1, 1, 1, 3, 3, 3, 3,
552− 7, 7, 7, 156, 3, 11, 11, 11, 18, 18,
553− 3, 3, 3, 3, 3, 5, 5, 5, 5, 5,
544+ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
545+ 3, 7, 7, 7, 163, 3, 11, 11, 11, 18,
546+ 18, 3, 3, 3, 3, 3, 5, 5, 5, 5,
554547 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
555548 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
556549 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
557550
558551 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
559− 5, 8, 12, 12, 12, 14, 15, 16, 8, 8,
560− 8, 17, 20, 20, 17, 23, 24, 29, 155, 24,
561− 29, 29, 29, 48, 16, 14, 31, 29, 128, 17,
562− 128, 17, 48, 17, 24, 17, 24, 99, 24, 42,
563− 24, 99, 15, 33, 33, 33, 23, 26, 26, 26,
564− 26, 154, 33, 33, 26, 36, 42, 31, 32, 32,
565− 32, 26, 26, 26, 26, 44, 59, 32, 32, 32,
566− 34, 34, 34, 73, 75, 36, 153, 75, 59, 59,
567− 59, 65, 44, 110, 65, 65, 65, 67, 67, 67,
568−
569− 73, 65, 83, 89, 89, 97, 67, 67, 119, 127,
570− 97, 150, 149, 110, 83, 83, 83, 133, 133, 133,
571− 141, 127, 127, 127, 145, 136, 136, 136, 119, 136,
572− 140, 140, 140, 148, 140, 147, 144, 143, 142, 139,
573− 141, 138, 137, 135, 145, 159, 159, 159, 159, 159,
574− 159, 159, 159, 160, 134, 132, 131, 160, 160, 161,
575− 161, 161, 161, 161, 161, 161, 161, 162, 162, 162,
576− 162, 163, 126, 163, 164, 125, 124, 164, 123, 164,
577− 164, 165, 122, 121, 165, 165, 165, 165, 166, 120,
578− 166, 166, 167, 167, 167, 167, 167, 167, 167, 167,
579−
580− 168, 168, 168, 168, 168, 168, 168, 168, 169, 118,
581− 169, 170, 117, 170, 170, 116, 170, 170, 171, 171,
582− 171, 171, 171, 171, 171, 171, 172, 172, 172, 172,
583− 172, 172, 172, 172, 115, 114, 112, 111, 109, 108,
584− 107, 106, 105, 104, 103, 102, 101, 100, 98, 96,
585− 95, 94, 93, 92, 90, 88, 86, 85, 84, 82,
586− 81, 80, 79, 78, 77, 76, 74, 72, 69, 68,
587− 66, 63, 61, 60, 56, 50, 49, 47, 46, 45,
552+ 5, 5, 5, 8, 12, 12, 12, 14, 15, 16,
553+ 8, 8, 8, 17, 20, 20, 17, 23, 42, 24,
554+ 29, 162, 24, 29, 29, 29, 16, 14, 31, 44,
555+ 29, 17, 134, 17, 134, 42, 17, 24, 17, 24,
556+ 76, 17, 24, 76, 24, 15, 44, 24, 36, 23,
557+ 26, 26, 26, 26, 34, 34, 34, 26, 161, 48,
558+ 31, 32, 32, 32, 26, 26, 26, 26, 36, 48,
559+ 32, 32, 32, 33, 33, 33, 60, 160, 74, 91,
560+ 91, 66, 33, 33, 66, 66, 66, 114, 60, 60,
561+
562+ 60, 66, 68, 68, 68, 74, 85, 99, 124, 133,
563+ 102, 68, 68, 99, 102, 157, 156, 114, 85, 85,
564+ 85, 133, 133, 133, 140, 140, 140, 148, 124, 143,
565+ 143, 143, 152, 143, 147, 147, 147, 155, 147, 154,
566+ 151, 150, 149, 146, 145, 144, 142, 148, 141, 138,
567+ 137, 132, 152, 166, 166, 166, 166, 166, 166, 166,
568+ 166, 167, 131, 130, 129, 167, 167, 168, 168, 168,
569+ 168, 168, 168, 168, 168, 169, 169, 169, 169, 170,
570+ 128, 170, 171, 127, 126, 171, 125, 171, 171, 172,
571+ 123, 122, 172, 172, 172, 172, 173, 121, 173, 173,
572+
573+ 174, 174, 174, 174, 174, 174, 174, 174, 175, 175,
574+ 175, 175, 175, 175, 175, 175, 176, 120, 176, 177,
575+ 119, 177, 177, 118, 177, 177, 178, 178, 178, 178,
576+ 178, 178, 178, 178, 179, 179, 179, 179, 179, 179,
577+ 179, 179, 116, 115, 113, 112, 111, 110, 109, 108,
578+ 107, 106, 105, 104, 103, 101, 100, 98, 97, 96,
579+ 95, 94, 92, 90, 88, 87, 86, 84, 83, 82,
580+ 81, 80, 79, 78, 77, 75, 73, 70, 69, 67,
581+ 64, 62, 61, 57, 51, 50, 49, 47, 46, 45,
588582 41, 38, 22, 21, 19, 13, 9, 6, 4, 2,
589− 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
590583
591− 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
592− 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
593− 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
594− 158, 158, 158, 158, 158, 158, 158
584+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
585+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
586+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
587+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
588+ 165, 165, 165, 165, 165, 165, 165, 165
595589 } ;
596590
597591 static yy_state_type yy_last_accepting_state;
@@ -662,7 +656,7 @@ static int dts_version = 1; · 64 unmodified lines
662656 static void push_input_file(const char *filename);
663657 static bool pop_input_file(void);
664658 static void lexical_error(const char *fmt, ...);
665−#line 666 "dtc-lexer.lex.c"
659+#line 660 "dtc-lexer.lex.c"
666660
667661 #define INITIAL 0
668662 #define BYTESTRING 1
@@ -698,19 +692,19 @@ void yyset_extra (YY_EXTRA_TYPE user_defined ); · 29 unmodified lines
698692
699693 FILE *yyget_in (void );
700694
701−void yyset_in (FILE * in_str );
695+void yyset_in (FILE * _in_str );
702696
703697 FILE *yyget_out (void );
704698
705−void yyset_out (FILE * out_str );
699+void yyset_out (FILE * _out_str );
706700
707−yy_size_t yyget_leng (void );
701+ int yyget_leng (void );
708702
709703 char *yyget_text (void );
710704
711705 int yyget_lineno (void );
712706
713−void yyset_lineno (int line_number );
707+void yyset_lineno (int _line_number );
714708
715709 /* Macros after this point can all be overridden by user definitions in
716710 * section 1.
@@ -724,6 +718,10 @@ extern int yywrap (void ); · 7 unmodified lines
724718 #endif
725719 #endif
726720
721+#ifndef YY_NO_UNPUT
722+
723+#endif
724+
727725 #ifndef yytext_ptr
728726 static void yy_flex_strncpy (char *,yyconst char *,int );
729727 #endif
@@ -757,7 +755,7 @@ static int input (void ); · 27 unmodified lines
757755 /* This used to be an fputs(), but since the string might contain NUL's,
758756 * we now use fwrite().
759757 */
760−#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
758+#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
761759 #endif
762760
763761 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -781,7 +779,7 @@ static int input (void ); · 17 unmodified lines
781779 else \
782780 { \
783781 errno=0; \
784− while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
782+ while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
785783 { \
786784 if( errno != EINTR) \
787785 { \
@@ -836,7 +834,7 @@ extern int yylex (void); · 48 unmodified lines
836834
837835 /* Code executed at the end of each rule. */
838836 #ifndef YY_BREAK
839−#define YY_BREAK break;
837+#define YY_BREAK /*LINTED*/break;
840838 #endif
841839
842840 #define YY_RULE_SETUP \
@@ -849,9 +847,9 @@ extern int yylex (void); · 6 unmodified lines
849847 */
850848 YY_DECL
851849 {
852− register yy_state_type yy_current_state;
853− register char *yy_cp, *yy_bp;
854− register int yy_act;
850+ yy_state_type yy_current_state;
851+ char *yy_cp, *yy_bp;
852+ int yy_act;
855853
856854 if ( !(yy_init) )
857855 {
@@ -882,9 +880,9 @@ YY_DECL · 24 unmodified lines
882880 {
883881 #line 68 "dtc-lexer.l"
884882
885−#line 886 "dtc-lexer.lex.c"
883+#line 884 "dtc-lexer.lex.c"
886884
887− while ( 1 ) /* loops until end-of-file is reached */
885+ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
888886 {
889887 yy_cp = (yy_c_buf_p);
890888
@@ -901,7 +899,7 @@ YY_DECL · 10 unmodified lines
901899 yy_match:
902900 do
903901 {
904− register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
902+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
905903 if ( yy_accept[yy_current_state] )
906904 {
907905 (yy_last_accepting_state) = yy_current_state;
@@ -910,13 +908,13 @@ yy_match: · 2 unmodified lines
910908 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
911909 {
912910 yy_current_state = (int) yy_def[yy_current_state];
913− if ( yy_current_state >= 159 )
911+ if ( yy_current_state >= 166 )
914912 yy_c = yy_meta[(unsigned int) yy_c];
915913 }
916− yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
914+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
917915 ++yy_cp;
918916 }
919− while ( yy_current_state != 158 );
917+ while ( yy_current_state != 165 );
920918 yy_cp = (yy_last_accepting_cpos);
921919 yy_current_state = (yy_last_accepting_state);
922920
@@ -1014,24 +1012,32 @@ YY_RULE_SETUP · 91 unmodified lines
10141012 case 5:
10151013 YY_RULE_SETUP
10161014 #line 124 "dtc-lexer.l"
1015+{
1016+ DPRINT("Keyword: /plugin/\n");
1017+ return DT_PLUGIN;
1018+ }
1019+ YY_BREAK
1020+case 6:
1021+YY_RULE_SETUP
1022+#line 129 "dtc-lexer.l"
10171023 {
10181024 DPRINT("Keyword: /memreserve/\n");
10191025 BEGIN_DEFAULT();
10201026 return DT_MEMRESERVE;
10211027 }
10221028 YY_BREAK
1023−case 6:
1029+case 7:
10241030 YY_RULE_SETUP
1025−#line 130 "dtc-lexer.l"
1031+#line 135 "dtc-lexer.l"
10261032 {
10271033 DPRINT("Keyword: /bits/\n");
10281034 BEGIN_DEFAULT();
10291035 return DT_BITS;
10301036 }
10311037 YY_BREAK
1032−case 7:
1038+case 8:
10331039 YY_RULE_SETUP
1034−#line 136 "dtc-lexer.l"
1040+#line 141 "dtc-lexer.l"
10351041 {
10361042 DPRINT("Keyword: /delete-property/\n");
10371043 DPRINT("<PROPNODENAME>\n");
@@ -1039,9 +1045,9 @@ YY_RULE_SETUP · 1 unmodified line
10391045 return DT_DEL_PROP;
10401046 }
10411047 YY_BREAK
1042−case 8:
1048+case 9:
10431049 YY_RULE_SETUP
1044−#line 143 "dtc-lexer.l"
1050+#line 148 "dtc-lexer.l"
10451051 {
10461052 DPRINT("Keyword: /delete-node/\n");
10471053 DPRINT("<PROPNODENAME>\n");
@@ -1049,9 +1055,9 @@ YY_RULE_SETUP · 1 unmodified line
10491055 return DT_DEL_NODE;
10501056 }
10511057 YY_BREAK
1052−case 9:
1058+case 10:
10531059 YY_RULE_SETUP
1054−#line 150 "dtc-lexer.l"
1060+#line 155 "dtc-lexer.l"
10551061 {
10561062 DPRINT("Label: %s\n", yytext);
10571063 yylval.labelref = xstrdup(yytext);
@@ -1059,9 +1065,9 @@ YY_RULE_SETUP · 1 unmodified line
10591065 return DT_LABEL;
10601066 }
10611067 YY_BREAK
1062−case 10:
1068+case 11:
10631069 YY_RULE_SETUP
1064−#line 157 "dtc-lexer.l"
1070+#line 162 "dtc-lexer.l"
10651071 {
10661072 char *e;
10671073 DPRINT("Integer Literal: '%s'\n", yytext);
@@ -1084,10 +1090,10 @@ YY_RULE_SETUP · 16 unmodified lines
10841090 return DT_LITERAL;
10851091 }
10861092 YY_BREAK
1087−case 11:
1088−/* rule 11 can match eol */
1093+case 12:
1094+/* rule 12 can match eol */
10891095 YY_RULE_SETUP
1090−#line 179 "dtc-lexer.l"
1096+#line 184 "dtc-lexer.l"
10911097 {
10921098 struct data d;
10931099 DPRINT("Character literal: %s\n", yytext);
@@ -1096,31 +1102,31 @@ YY_RULE_SETUP · 2 unmodified lines
10961102 if (d.len == 1) {
10971103 lexical_error("Empty character literal");
10981104 yylval.integer = 0;
1099− return DT_CHAR_LITERAL;
1100− }
1101−
1102− yylval.integer = (unsigned char)d.val[0];
1105+ } else {
1106+ yylval.integer = (unsigned char)d.val[0];
11031107
1104− if (d.len > 2)
1105− lexical_error("Character literal has %d"
1106− " characters instead of 1",
1107− d.len - 1);
1108+ if (d.len > 2)
1109+ lexical_error("Character literal has %d"
1110+ " characters instead of 1",
1111+ d.len - 1);
1112+ }
11081113
1114+ data_free(d);
11091115 return DT_CHAR_LITERAL;
11101116 }
11111117 YY_BREAK
1112−case 12:
1118+case 13:
11131119 YY_RULE_SETUP
1114−#line 200 "dtc-lexer.l"
1120+#line 205 "dtc-lexer.l"
11151121 { /* label reference */
11161122 DPRINT("Ref: %s\n", yytext+1);
11171123 yylval.labelref = xstrdup(yytext+1);
11181124 return DT_REF;
11191125 }
11201126 YY_BREAK
1121−case 13:
1127+case 14:
11221128 YY_RULE_SETUP
1123−#line 206 "dtc-lexer.l"
1129+#line 211 "dtc-lexer.l"
11241130 { /* new-style path reference */
11251131 yytext[yyleng-1] = '\0';
11261132 DPRINT("Ref: %s\n", yytext+2);
@@ -1128,27 +1134,27 @@ YY_RULE_SETUP · 1 unmodified line
11281134 return DT_REF;
11291135 }
11301136 YY_BREAK
1131−case 14:
1137+case 15:
11321138 YY_RULE_SETUP
1133−#line 213 "dtc-lexer.l"
1139+#line 218 "dtc-lexer.l"
11341140 {
11351141 yylval.byte = strtol(yytext, NULL, 16);
11361142 DPRINT("Byte: %02x\n", (int)yylval.byte);
11371143 return DT_BYTE;
11381144 }
11391145 YY_BREAK
1140−case 15:
1146+case 16:
11411147 YY_RULE_SETUP
1142−#line 219 "dtc-lexer.l"
1148+#line 224 "dtc-lexer.l"
11431149 {
11441150 DPRINT("/BYTESTRING\n");
11451151 BEGIN_DEFAULT();
11461152 return ']';
11471153 }
11481154 YY_BREAK
1149−case 16:
1155+case 17:
11501156 YY_RULE_SETUP
1151−#line 225 "dtc-lexer.l"
1157+#line 230 "dtc-lexer.l"
11521158 {
11531159 DPRINT("PropNodeName: %s\n", yytext);
11541160 yylval.propnodename = xstrdup((yytext[0] == '\\') ?
@@ -1157,75 +1163,75 @@ YY_RULE_SETUP · 2 unmodified lines
11571163 return DT_PROPNODENAME;
11581164 }
11591165 YY_BREAK
1160−case 17:
1166+case 18:
11611167 YY_RULE_SETUP
1162−#line 233 "dtc-lexer.l"
1168+#line 238 "dtc-lexer.l"
11631169 {
11641170 DPRINT("Binary Include\n");
11651171 return DT_INCBIN;
11661172 }
11671173 YY_BREAK
1168−case 18:
1169−/* rule 18 can match eol */
1170−YY_RULE_SETUP
1171−#line 238 "dtc-lexer.l"
1172−/* eat whitespace */
1173− YY_BREAK
11741174 case 19:
11751175 /* rule 19 can match eol */
11761176 YY_RULE_SETUP
1177−#line 239 "dtc-lexer.l"
1178−/* eat C-style comments */
1177+#line 243 "dtc-lexer.l"
1178+/* eat whitespace */
11791179 YY_BREAK
11801180 case 20:
11811181 /* rule 20 can match eol */
11821182 YY_RULE_SETUP
1183−#line 240 "dtc-lexer.l"
1184−/* eat C++-style comments */
1183+#line 244 "dtc-lexer.l"
1184+/* eat C-style comments */
11851185 YY_BREAK
11861186 case 21:
1187+/* rule 21 can match eol */
11871188 YY_RULE_SETUP
1188−#line 242 "dtc-lexer.l"
1189−{ return DT_LSHIFT; };
1189+#line 245 "dtc-lexer.l"
1190+/* eat C++-style comments */
11901191 YY_BREAK
11911192 case 22:
11921193 YY_RULE_SETUP
1193−#line 243 "dtc-lexer.l"
1194−{ return DT_RSHIFT; };
1194+#line 247 "dtc-lexer.l"
1195+{ return DT_LSHIFT; };
11951196 YY_BREAK
11961197 case 23:
11971198 YY_RULE_SETUP
1198−#line 244 "dtc-lexer.l"
1199−{ return DT_LE; };
1199+#line 248 "dtc-lexer.l"
1200+{ return DT_RSHIFT; };
12001201 YY_BREAK
12011202 case 24:
12021203 YY_RULE_SETUP
1203−#line 245 "dtc-lexer.l"
1204−{ return DT_GE; };
1204+#line 249 "dtc-lexer.l"
1205+{ return DT_LE; };
12051206 YY_BREAK
12061207 case 25:
12071208 YY_RULE_SETUP
1208−#line 246 "dtc-lexer.l"
1209−{ return DT_EQ; };
1209+#line 250 "dtc-lexer.l"
1210+{ return DT_GE; };
12101211 YY_BREAK
12111212 case 26:
12121213 YY_RULE_SETUP
1213−#line 247 "dtc-lexer.l"
1214−{ return DT_NE; };
1214+#line 251 "dtc-lexer.l"
1215+{ return DT_EQ; };
12151216 YY_BREAK
12161217 case 27:
12171218 YY_RULE_SETUP
1218−#line 248 "dtc-lexer.l"
1219−{ return DT_AND; };
1219+#line 252 "dtc-lexer.l"
1220+{ return DT_NE; };
12201221 YY_BREAK
12211222 case 28:
12221223 YY_RULE_SETUP
1223−#line 249 "dtc-lexer.l"
1224−{ return DT_OR; };
1224+#line 253 "dtc-lexer.l"
1225+{ return DT_AND; };
12251226 YY_BREAK
12261227 case 29:
12271228 YY_RULE_SETUP
1228−#line 251 "dtc-lexer.l"
1229+#line 254 "dtc-lexer.l"
1230+{ return DT_OR; };
1231+ YY_BREAK
1232+case 30:
1233+YY_RULE_SETUP
1234+#line 256 "dtc-lexer.l"
12291235 {
12301236 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
12311237 (unsigned)yytext[0]);
@@ -1241,12 +1247,12 @@ YY_RULE_SETUP · 9 unmodified lines
12411247 return yytext[0];
12421248 }
12431249 YY_BREAK
1244−case 30:
1250+case 31:
12451251 YY_RULE_SETUP
1246−#line 266 "dtc-lexer.l"
1252+#line 271 "dtc-lexer.l"
12471253 ECHO;
12481254 YY_BREAK
1249−#line 1250 "dtc-lexer.lex.c"
1255+#line 1256 "dtc-lexer.lex.c"
12501256
12511257 case YY_END_OF_BUFFER:
12521258 {
@@ -1388,9 +1394,9 @@ ECHO; · 135 unmodified lines
13881394 */
13891395 static int yy_get_next_buffer (void)
13901396 {
1391− register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1392− register char *source = (yytext_ptr);
1393− register int number_to_move, i;
1397+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1398+ char *source = (yytext_ptr);
1399+ yy_size_t number_to_move, i;
13941400 int ret_val;
13951401
13961402 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
@@ -1419,7 +1425,7 @@ static int yy_get_next_buffer (void) · 22 unmodified lines
14191425 /* Try to read more data. */
14201426
14211427 /* First move last chars to start of buffer. */
1422− number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1428+ number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
14231429
14241430 for ( i = 0; i < number_to_move; ++i )
14251431 *(dest++) = *(source++);
@@ -1432,7 +1438,7 @@ static int yy_get_next_buffer (void) · 6 unmodified lines
14321438
14331439 else
14341440 {
1435− yy_size_t num_to_read =
1441+ int num_to_read =
14361442 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
14371443
14381444 while ( num_to_read <= 0 )
@@ -1446,7 +1452,7 @@ static int yy_get_next_buffer (void) · 7 unmodified lines
14461452
14471453 if ( b->yy_is_our_buffer )
14481454 {
1449− yy_size_t new_size = b->yy_buf_size * 2;
1455+ int new_size = b->yy_buf_size * 2;
14501456
14511457 if ( new_size <= 0 )
14521458 b->yy_buf_size += b->yy_buf_size / 8;
@@ -1459,7 +1465,7 @@ static int yy_get_next_buffer (void) · 6 unmodified lines
14591465 }
14601466 else
14611467 /* Can't grow it, we don't own it. */
1462− b->yy_ch_buf = 0;
1468+ b->yy_ch_buf = NULL;
14631469
14641470 if ( ! b->yy_ch_buf )
14651471 YY_FATAL_ERROR(
@@ -1501,9 +1507,9 @@ static int yy_get_next_buffer (void) · 35 unmodified lines
15011507 else
15021508 ret_val = EOB_ACT_CONTINUE_SCAN;
15031509
1504− if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1510+ if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
15051511 /* Extend the array by 50%, plus the number we really need. */
1506− yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1512+ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
15071513 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
15081514 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
15091515 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
@@ -1522,15 +1528,15 @@ static int yy_get_next_buffer (void) · 12 unmodified lines
15221528
15231529 static yy_state_type yy_get_previous_state (void)
15241530 {
1525− register yy_state_type yy_current_state;
1526− register char *yy_cp;
1531+ yy_state_type yy_current_state;
1532+ char *yy_cp;
15271533
15281534 yy_current_state = (yy_start);
15291535 yy_current_state += YY_AT_BOL();
15301536
15311537 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
15321538 {
1533− register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1539+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
15341540 if ( yy_accept[yy_current_state] )
15351541 {
15361542 (yy_last_accepting_state) = yy_current_state;
@@ -1539,10 +1545,10 @@ static int yy_get_next_buffer (void) · 2 unmodified lines
15391545 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
15401546 {
15411547 yy_current_state = (int) yy_def[yy_current_state];
1542− if ( yy_current_state >= 159 )
1548+ if ( yy_current_state >= 166 )
15431549 yy_c = yy_meta[(unsigned int) yy_c];
15441550 }
1545− yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1551+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
15461552 }
15471553
15481554 return yy_current_state;
@@ -1555,10 +1561,10 @@ static int yy_get_next_buffer (void) · 6 unmodified lines
15551561 */
15561562 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
15571563 {
1558− register int yy_is_jam;
1559− register char *yy_cp = (yy_c_buf_p);
1564+ int yy_is_jam;
1565+ char *yy_cp = (yy_c_buf_p);
15601566
1561− register YY_CHAR yy_c = 1;
1567+ YY_CHAR yy_c = 1;
15621568 if ( yy_accept[yy_current_state] )
15631569 {
15641570 (yy_last_accepting_state) = yy_current_state;
@@ -1567,15 +1573,19 @@ static int yy_get_next_buffer (void) · 2 unmodified lines
15671573 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
15681574 {
15691575 yy_current_state = (int) yy_def[yy_current_state];
1570− if ( yy_current_state >= 159 )
1576+ if ( yy_current_state >= 166 )
15711577 yy_c = yy_meta[(unsigned int) yy_c];
15721578 }
1573− yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1574− yy_is_jam = (yy_current_state == 158);
1579+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1580+ yy_is_jam = (yy_current_state == 165);
15751581
15761582 return yy_is_jam ? 0 : yy_current_state;
15771583 }
15781584
1585+#ifndef YY_NO_UNPUT
1586+
1587+#endif
1588+
15791589 #ifndef YY_NO_INPUT
15801590 #ifdef __cplusplus
15811591 static int yyinput (void)
@@ -1600,7 +1610,7 @@ static int yy_get_next_buffer (void) · 18 unmodified lines
16001610
16011611 else
16021612 { /* need more input */
1603− yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1613+ int offset = (yy_c_buf_p) - (yytext_ptr);
16041614 ++(yy_c_buf_p);
16051615
16061616 switch ( yy_get_next_buffer( ) )
@@ -1624,7 +1634,7 @@ static int yy_get_next_buffer (void) · 17 unmodified lines
16241634 case EOB_ACT_END_OF_FILE:
16251635 {
16261636 if ( yywrap( ) )
1627− return EOF;
1637+ return 0;
16281638
16291639 if ( ! (yy_did_buffer_switch_on_eof) )
16301640 YY_NEW_FILE;
@@ -1727,7 +1737,7 @@ static void yy_load_buffer_state (void) · 96 unmodified lines
17271737 if ( ! b )
17281738 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
17291739
1730− b->yy_buf_size = size;
1740+ b->yy_buf_size = (yy_size_t)size;
17311741
17321742 /* yy_ch_buf has to be 2 characters longer than the size given because
17331743 * we need to put in 2 end-of-buffer characters.
@@ -1874,7 +1884,7 @@ void yypop_buffer_state (void) · 140 unmodified lines
18741884 */
18751885 static void yyensure_buffer_stack (void)
18761886 {
1877− yy_size_t num_to_alloc;
1887+ int num_to_alloc;
18781888
18791889 if (!(yy_buffer_stack)) {
18801890
@@ -1882,15 +1892,15 @@ static void yyensure_buffer_stack (void) · 1 unmodified line
18821892 * scanner will even need a stack. We use 2 instead of 1 to avoid an
18831893 * immediate realloc on the next call.
18841894 */
1885− num_to_alloc = 1;
1895+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
18861896 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
18871897 (num_to_alloc * sizeof(struct yy_buffer_state*)
18881898 );
18891899 if ( ! (yy_buffer_stack) )
18901900 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1891−
1901+
18921902 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1893−
1903+
18941904 (yy_buffer_stack_max) = num_to_alloc;
18951905 (yy_buffer_stack_top) = 0;
18961906 return;
@@ -1899,7 +1909,7 @@ static void yyensure_buffer_stack (void) · 2 unmodified lines
18991909 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
19001910
19011911 /* Increase the buffer to prepare for a possible push. */
1902− int grow_size = 8 /* arbitrary grow size */;
1912+ yy_size_t grow_size = 8 /* arbitrary grow size */;
19031913
19041914 num_to_alloc = (yy_buffer_stack_max) + grow_size;
19051915 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
@@ -1919,7 +1929,7 @@ static void yyensure_buffer_stack (void) · 13 unmodified lines
19191929 * @param base the character buffer
19201930 * @param size the size in bytes of the character buffer
19211931 *
1922− * @return the newly allocated buffer state object.
1932+ * @return the newly allocated buffer state object.
19231933 */
19241934 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
19251935 {
@@ -1929,7 +1939,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) · 3 unmodified lines
19291939 base[size-2] != YY_END_OF_BUFFER_CHAR ||
19301940 base[size-1] != YY_END_OF_BUFFER_CHAR )
19311941 /* They forgot to leave room for the EOB's. */
1932− return 0;
1942+ return NULL;
19331943
19341944 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
19351945 if ( ! b )
@@ -1938,7 +1948,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) · 2 unmodified lines
19381948 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
19391949 b->yy_buf_pos = b->yy_ch_buf = base;
19401950 b->yy_is_our_buffer = 0;
1941− b->yy_input_file = 0;
1951+ b->yy_input_file = NULL;
19421952 b->yy_n_chars = b->yy_buf_size;
19431953 b->yy_is_interactive = 0;
19441954 b->yy_at_bol = 1;
@@ -1961,7 +1971,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) · 16 unmodified lines
19611971 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
19621972 {
19631973
1964− return yy_scan_bytes(yystr,strlen(yystr) );
1974+ return yy_scan_bytes(yystr,(int) strlen(yystr) );
19651975 }
19661976
19671977 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
@@ -1971,7 +1981,7 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) · 3 unmodified lines
19711981 *
19721982 * @return the newly allocated buffer state object.
19731983 */
1974−YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
1984+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
19751985 {
19761986 YY_BUFFER_STATE b;
19771987 char *buf;
@@ -1979,7 +1989,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len · 1 unmodified line
19791989 yy_size_t i;
19801990
19811991 /* Get memory for full buffer, including space for trailing EOB's. */
1982− n = _yybytes_len + 2;
1992+ n = (yy_size_t) _yybytes_len + 2;
19831993 buf = (char *) yyalloc(n );
19841994 if ( ! buf )
19851995 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
@@ -2005,9 +2015,9 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len · 19 unmodified lines
20052015 #define YY_EXIT_FAILURE 2
20062016 #endif
20072017
2008−static void yy_fatal_error (yyconst char* msg )
2018+static void yynoreturn yy_fatal_error (yyconst char* msg )
20092019 {
2010− (void) fprintf( stderr, "%s\n", msg );
2020+ (void) fprintf( stderr, "%s\n", msg );
20112021 exit( YY_EXIT_FAILURE );
20122022 }
20132023
@@ -2035,7 +2045,7 @@ static void yy_fatal_error (yyconst char* msg ) · 21 unmodified lines
20352045 */
20362046 int yyget_lineno (void)
20372047 {
2038−
2048+
20392049 return yylineno;
20402050 }
20412051
@@ -2058,7 +2068,7 @@ FILE *yyget_out (void) · 16 unmodified lines
20582068 /** Get the length of the current token.
20592069 *
20602070 */
2061−yy_size_t yyget_leng (void)
2071+int yyget_leng (void)
20622072 {
20632073 return yyleng;
20642074 }
@@ -2073,29 +2083,29 @@ char *yyget_text (void) · 8 unmodified lines
20732083 }
20742084
20752085 /** Set the current line number.
2076− * @param line_number
2086+ * @param _line_number line number
20772087 *
20782088 */
2079−void yyset_lineno (int line_number )
2089+void yyset_lineno (int _line_number )
20802090 {
20812091
2082− yylineno = line_number;
2092+ yylineno = _line_number;
20832093 }
20842094
20852095 /** Set the input stream. This does not discard the current
20862096 * input buffer.
2087− * @param in_str A readable stream.
2097+ * @param _in_str A readable stream.
20882098 *
20892099 * @see yy_switch_to_buffer
20902100 */
2091−void yyset_in (FILE * in_str )
2101+void yyset_in (FILE * _in_str )
20922102 {
2093− yyin = in_str ;
2103+ yyin = _in_str ;
20942104 }
20952105
2096−void yyset_out (FILE * out_str )
2106+void yyset_out (FILE * _out_str )
20972107 {
2098− yyout = out_str ;
2108+ yyout = _out_str ;
20992109 }
21002110
21012111 int yyget_debug (void)
@@ -2103,9 +2113,9 @@ int yyget_debug (void) · 1 unmodified line
21032113 return yy_flex_debug;
21042114 }
21052115
2106−void yyset_debug (int bdebug )
2116+void yyset_debug (int _bdebug )
21072117 {
2108− yy_flex_debug = bdebug ;
2118+ yy_flex_debug = _bdebug ;
21092119 }
21102120
21112121 static int yy_init_globals (void)
@@ -2114,10 +2124,10 @@ static int yy_init_globals (void) · 2 unmodified lines
21142124 * This function is called from yylex_destroy(), so don't allocate here.
21152125 */
21162126
2117− (yy_buffer_stack) = 0;
2127+ (yy_buffer_stack) = NULL;
21182128 (yy_buffer_stack_top) = 0;
21192129 (yy_buffer_stack_max) = 0;
2120− (yy_c_buf_p) = (char *) 0;
2130+ (yy_c_buf_p) = NULL;
21212131 (yy_init) = 0;
21222132 (yy_start) = 0;
21232133
@@ -2126,8 +2136,8 @@ static int yy_init_globals (void) · 2 unmodified lines
21262136 yyin = stdin;
21272137 yyout = stdout;
21282138 #else
2129− yyin = (FILE *) 0;
2130− yyout = (FILE *) 0;
2139+ yyin = NULL;
2140+ yyout = NULL;
21312141 #endif
21322142
21332143 /* For future reference: Set errno on error, since we are called by
@@ -2165,7 +2175,8 @@ int yylex_destroy (void) · 31 unmodified lines
21652175 #ifndef yytext_ptr
21662176 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
21672177 {
2168− register int i;
2178+
2179+ int i;
21692180 for ( i = 0; i < n; ++i )
21702181 s1[i] = s2[i];
21712182 }
@@ -2174,7 +2185,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) · 2 unmodified lines
21742185 #ifdef YY_NEED_STRLEN
21752186 static int yy_flex_strlen (yyconst char * s )
21762187 {
2177− register int n;
2188+ int n;
21782189 for ( n = 0; s[n]; ++n )
21792190 ;
21802191
@@ -2184,11 +2195,12 @@ static int yy_flex_strlen (yyconst char * s ) · 3 unmodified lines
21842195
21852196 void *yyalloc (yy_size_t size )
21862197 {
2187− return (void *) malloc( size );
2198+ return malloc(size);
21882199 }
21892200
21902201 void *yyrealloc (void * ptr, yy_size_t size )
21912202 {
2203+
21922204 /* The cast to (char *) in the following accommodates both
21932205 * implementations that use char* generic pointers, and those
21942206 * that use void* generic pointers. It works with the latter
@@ -2196,17 +2208,17 @@ void *yyrealloc (void * ptr, yy_size_t size ) · 1 unmodified line
21962208 * any pointer type to void*, and deal with argument conversions
21972209 * as though doing an assignment.
21982210 */
2199− return (void *) realloc( (char *) ptr, size );
2211+ return realloc(ptr, size);
22002212 }
22012213
22022214 void yyfree (void * ptr )
22032215 {
2204− free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2216+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
22052217 }
22062218
22072219 #define YYTABLES_NAME "yytables"
22082220
2209−#line 265 "dtc-lexer.l"
2221+#line 271 "dtc-lexer.l"
22102222
22112223
22122224
scripts/dtc/dtc-parser.tab.c_shipped+392−360
@@ -1,8 +1,8 @@
1−/* A Bison parser, made by GNU Bison 3.0.2. */
1+/* A Bison parser, made by GNU Bison 3.0.4. */
22
33 /* Bison implementation for Yacc-like parsers in C
44
5− Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
5+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
66
77 This program is free software: you can redistribute it and/or modify
88 it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ · 35 unmodified lines
4444 #define YYBISON 1
4545
4646 /* Bison version. */
47−#define YYBISON_VERSION "3.0.2"
47+#define YYBISON_VERSION "3.0.4"
4848
4949 /* Skeleton name. */
5050 #define YYSKELETON_NAME "yacc.c"
@@ -65,6 +65,7 @@ · 14 unmodified lines
6565 #line 20 "dtc-parser.y" /* yacc.c:339 */
6666
6767 #include <stdio.h>
68+#include <inttypes.h>
6869
6970 #include "dtc.h"
7071 #include "srcpos.h"
@@ -77,10 +78,10 @@ extern void yyerror(char const *s); · 6 unmodified lines
7778 treesource_error = true; \
7879 } while (0)
7980
80−extern struct boot_info *the_boot_info;
81+extern struct dt_info *parser_output;
8182 extern bool treesource_error;
8283
83−#line 84 "dtc-parser.tab.c" /* yacc.c:339 */
84+#line 85 "dtc-parser.tab.c" /* yacc.c:339 */
8485
8586 # ifndef YY_NULLPTR
8687 # if defined __cplusplus && 201103L <= __cplusplus
@@ -116,35 +117,36 @@ extern int yydebug; · 29 unmodified lines
116117 enum yytokentype
117118 {
118119 DT_V1 = 258,
119− DT_MEMRESERVE = 259,
120− DT_LSHIFT = 260,
121− DT_RSHIFT = 261,
122− DT_LE = 262,
123− DT_GE = 263,
124− DT_EQ = 264,
125− DT_NE = 265,
126− DT_AND = 266,
127− DT_OR = 267,
128− DT_BITS = 268,
129− DT_DEL_PROP = 269,
130− DT_DEL_NODE = 270,
131− DT_PROPNODENAME = 271,
132− DT_LITERAL = 272,
133− DT_CHAR_LITERAL = 273,
134− DT_BYTE = 274,
135− DT_STRING = 275,
136− DT_LABEL = 276,
137− DT_REF = 277,
138− DT_INCBIN = 278
120+ DT_PLUGIN = 259,
121+ DT_MEMRESERVE = 260,
122+ DT_LSHIFT = 261,
123+ DT_RSHIFT = 262,
124+ DT_LE = 263,
125+ DT_GE = 264,
126+ DT_EQ = 265,
127+ DT_NE = 266,
128+ DT_AND = 267,
129+ DT_OR = 268,
130+ DT_BITS = 269,
131+ DT_DEL_PROP = 270,
132+ DT_DEL_NODE = 271,
133+ DT_PROPNODENAME = 272,
134+ DT_LITERAL = 273,
135+ DT_CHAR_LITERAL = 274,
136+ DT_BYTE = 275,
137+ DT_STRING = 276,
138+ DT_LABEL = 277,
139+ DT_REF = 278,
140+ DT_INCBIN = 279
139141 };
140142 #endif
141143
142144 /* Value type. */
143145 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
144−typedef union YYSTYPE YYSTYPE;
146+
145147 union YYSTYPE
146148 {
147−#line 38 "dtc-parser.y" /* yacc.c:355 */
149+#line 39 "dtc-parser.y" /* yacc.c:355 */
148150
149151 char *propnodename;
150152 char *labelref;
@@ -162,9 +164,12 @@ union YYSTYPE · 11 unmodified lines
162164 struct node *nodelist;
163165 struct reserve_info *re;
164166 uint64_t integer;
167+ unsigned int flags;
165168
166−#line 167 "dtc-parser.tab.c" /* yacc.c:355 */
169+#line 170 "dtc-parser.tab.c" /* yacc.c:355 */
167170 };
171+
172+typedef union YYSTYPE YYSTYPE;
168173 # define YYSTYPE_IS_TRIVIAL 1
169174 # define YYSTYPE_IS_DECLARED 1
170175 #endif
@@ -192,7 +197,7 @@ int yyparse (void); · 21 unmodified lines
192197
193198 /* Copy the second part of user declarations. */
194199
195−#line 196 "dtc-parser.tab.c" /* yacc.c:358 */
200+#line 201 "dtc-parser.tab.c" /* yacc.c:358 */
196201
197202 #ifdef short
198203 # undef short
@@ -434,23 +439,23 @@ union yyalloc · 235 unmodified lines
434439 #endif /* !YYCOPY_NEEDED */
435440
436441 /* YYFINAL -- State number of the termination state. */
437−#define YYFINAL 4
442+#define YYFINAL 6
438443 /* YYLAST -- Last index in YYTABLE. */
439−#define YYLAST 136
444+#define YYLAST 138
440445
441446 /* YYNTOKENS -- Number of terminals. */
442−#define YYNTOKENS 47
447+#define YYNTOKENS 48
443448 /* YYNNTS -- Number of nonterminals. */
444−#define YYNNTS 28
449+#define YYNNTS 30
445450 /* YYNRULES -- Number of rules. */
446−#define YYNRULES 80
451+#define YYNRULES 84
447452 /* YYNSTATES -- Number of states. */
448−#define YYNSTATES 144
453+#define YYNSTATES 149
449454
450455 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
451456 by yylex, with out-of-bounds checking. */
452457 #define YYUNDEFTOK 2
453−#define YYMAXUTOK 278
458+#define YYMAXUTOK 279
454459
455460 #define YYTRANSLATE(YYX) \
456461 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -462,16 +467,16 @@ static const yytype_uint8 yytranslate[] = · 5 unmodified lines
462467 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465− 2, 2, 2, 46, 2, 2, 2, 44, 40, 2,
466− 32, 34, 43, 41, 33, 42, 2, 25, 2, 2,
467− 2, 2, 2, 2, 2, 2, 2, 2, 37, 24,
468− 35, 28, 29, 36, 2, 2, 2, 2, 2, 2,
470+ 2, 2, 2, 47, 2, 2, 2, 45, 41, 2,
471+ 33, 35, 44, 42, 34, 43, 2, 26, 2, 2,
472+ 2, 2, 2, 2, 2, 2, 2, 2, 38, 25,
473+ 36, 29, 30, 37, 2, 2, 2, 2, 2, 2,
469474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471− 2, 30, 2, 31, 39, 2, 2, 2, 2, 2,
476+ 2, 31, 2, 32, 40, 2, 2, 2, 2, 2,
472477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
474− 2, 2, 2, 26, 38, 27, 45, 2, 2, 2,
479+ 2, 2, 2, 27, 39, 28, 46, 2, 2, 2,
475480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
476481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
477482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -486,22 +491,22 @@ static const yytype_uint8 yytranslate[] = · 8 unmodified lines
486491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
487492 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
488493 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
489− 15, 16, 17, 18, 19, 20, 21, 22, 23
494+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
490495 };
491496
492497 #if YYDEBUG
493498 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
494499 static const yytype_uint16 yyrline[] =
495500 {
496− 0, 104, 104, 113, 116, 123, 127, 135, 139, 144,
497− 155, 165, 180, 188, 191, 198, 202, 206, 210, 218,
498− 222, 226, 230, 234, 250, 260, 268, 271, 275, 282,
499− 298, 303, 322, 336, 343, 344, 345, 352, 356, 357,
500− 361, 362, 366, 367, 371, 372, 376, 377, 381, 382,
501− 386, 387, 388, 392, 393, 394, 395, 396, 400, 401,
502− 402, 406, 407, 408, 412, 413, 422, 431, 435, 436,
503− 437, 438, 443, 446, 450, 458, 461, 465, 473, 477,
504− 481
501+ 0, 109, 109, 117, 121, 128, 129, 139, 142, 149,
502+ 153, 161, 165, 170, 181, 191, 206, 214, 217, 224,
503+ 228, 232, 236, 244, 248, 252, 256, 260, 276, 286,
504+ 294, 297, 301, 308, 324, 329, 348, 362, 369, 370,
505+ 371, 378, 382, 383, 387, 388, 392, 393, 397, 398,
506+ 402, 403, 407, 408, 412, 413, 414, 418, 419, 420,
507+ 421, 422, 426, 427, 428, 432, 433, 434, 438, 439,
508+ 448, 457, 461, 462, 463, 464, 469, 472, 476, 484,
509+ 487, 491, 499, 503, 507
505510 };
506511 #endif
507512
@@ -510,19 +515,20 @@ static const yytype_uint16 yyrline[] = · 2 unmodified lines
510515 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
511516 static const char *const yytname[] =
512517 {
513− "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT",
514− "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR",
515− "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL",
516− "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF",
517− "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'",
518− "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'",
519− "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile",
520− "memreserves", "memreserve", "devicetree", "nodedef", "proplist",
521− "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim",
522− "integer_expr", "integer_trinary", "integer_or", "integer_and",
523− "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq",
524− "integer_rela", "integer_shift", "integer_add", "integer_mul",
525− "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR
518+ "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE",
519+ "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND",
520+ "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME",
521+ "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL",
522+ "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['",
523+ "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'",
524+ "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile",
525+ "header", "headers", "memreserves", "memreserve", "devicetree",
526+ "nodedef", "proplist", "propdef", "propdata", "propdataprefix",
527+ "arrayprefix", "integer_prim", "integer_expr", "integer_trinary",
528+ "integer_or", "integer_and", "integer_bitor", "integer_bitxor",
529+ "integer_bitand", "integer_eq", "integer_rela", "integer_shift",
530+ "integer_add", "integer_mul", "integer_unary", "bytestring", "subnodes",
531+ "subnode", YY_NULLPTR
526532 };
527533 #endif
528534
@@ -533,16 +539,16 @@ static const yytype_uint16 yytoknum[] = · 4 unmodified lines
533539 {
534540 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
535541 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
536− 275, 276, 277, 278, 59, 47, 123, 125, 61, 62,
537− 91, 93, 40, 44, 41, 60, 63, 58, 124, 94,
538− 38, 43, 45, 42, 37, 126, 33
542+ 275, 276, 277, 278, 279, 59, 47, 123, 125, 61,
543+ 62, 91, 93, 40, 44, 41, 60, 63, 58, 124,
544+ 94, 38, 43, 45, 42, 37, 126, 33
539545 };
540546 # endif
541547
542−#define YYPACT_NINF -81
548+#define YYPACT_NINF -44
543549
544550 #define yypact_value_is_default(Yystate) \
545− (!!((Yystate) == (-81)))
551+ (!!((Yystate) == (-44)))
546552
547553 #define YYTABLE_NINF -1
548554
@@ -553,21 +559,21 @@ static const yytype_uint16 yytoknum[] = · 4 unmodified lines
553559 STATE-NUM. */
554560 static const yytype_int8 yypact[] =
555561 {
556− 16, -11, 21, 10, -81, 25, 10, 19, 10, -81,
557− -81, -9, 25, -81, 2, 51, -81, -9, -9, -9,
558− -81, 1, -81, -6, 50, 14, 28, 29, 36, 3,
559− 58, 44, -3, -81, 47, -81, -81, 65, 68, 2,
560− 2, -81, -81, -81, -81, -9, -9, -9, -9, -9,
561− -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
562− -9, -9, -9, -9, -81, 63, 69, 2, -81, -81,
563− 50, 57, 14, 28, 29, 36, 3, 3, 58, 58,
564− 58, 58, 44, 44, -3, -3, -81, -81, -81, 79,
565− 80, -8, 63, -81, 72, 63, -81, -81, -9, 76,
566− 77, -81, -81, -81, -81, -81, 78, -81, -81, -81,
567− -81, -81, 35, 4, -81, -81, -81, -81, 86, -81,
568− -81, -81, 73, -81, -81, 33, 71, 84, 39, -81,
569− -81, -81, -81, -81, 41, -81, -81, -81, 25, -81,
570− 74, 25, 75, -81
562+ 14, 27, 61, 14, 8, 18, -44, -44, 37, 8,
563+ 40, 8, 64, -44, -44, -12, 37, -44, 50, 52,
564+ -44, -44, -12, -12, -12, -44, 51, -44, -4, 78,
565+ 53, 54, 55, 17, 2, 30, 38, -3, -44, 66,
566+ -44, -44, 70, 72, 50, 50, -44, -44, -44, -44,
567+ -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
568+ -12, -12, -12, -12, -12, -12, -12, -12, -12, -44,
569+ 3, 73, 50, -44, -44, 78, 59, 53, 54, 55,
570+ 17, 2, 2, 30, 30, 30, 30, 38, 38, -3,
571+ -3, -44, -44, -44, 82, 83, 44, 3, -44, 74,
572+ 3, -44, -44, -12, 76, 79, -44, -44, -44, -44,
573+ -44, 80, -44, -44, -44, -44, -44, -10, 36, -44,
574+ -44, -44, -44, 85, -44, -44, -44, 75, -44, -44,
575+ 21, 71, 88, -6, -44, -44, -44, -44, -44, 11,
576+ -44, -44, -44, 37, -44, 77, 37, 81, -44
571577 };
572578
573579 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -575,37 +581,37 @@ static const yytype_int8 yypact[] = · 1 unmodified line
575581 means the default is an error. */
576582 static const yytype_uint8 yydefact[] =
577583 {
578− 0, 0, 0, 3, 1, 0, 0, 0, 3, 34,
579− 35, 0, 0, 6, 0, 2, 4, 0, 0, 0,
580− 68, 0, 37, 38, 40, 42, 44, 46, 48, 50,
581− 53, 60, 63, 67, 0, 13, 7, 0, 0, 0,
582− 0, 69, 70, 71, 36, 0, 0, 0, 0, 0,
584+ 0, 0, 0, 5, 7, 3, 1, 6, 0, 0,
585+ 0, 7, 0, 38, 39, 0, 0, 10, 0, 2,
586+ 8, 4, 0, 0, 0, 72, 0, 41, 42, 44,
587+ 46, 48, 50, 52, 54, 57, 64, 67, 71, 0,
588+ 17, 11, 0, 0, 0, 0, 73, 74, 75, 40,
583589 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
584− 0, 0, 0, 0, 5, 75, 0, 0, 10, 8,
585− 41, 0, 43, 45, 47, 49, 51, 52, 56, 57,
586− 55, 54, 58, 59, 61, 62, 65, 64, 66, 0,
587− 0, 0, 0, 14, 0, 75, 11, 9, 0, 0,
588− 0, 16, 26, 78, 18, 80, 0, 77, 76, 39,
589− 17, 79, 0, 0, 12, 25, 15, 27, 0, 19,
590− 28, 22, 0, 72, 30, 0, 0, 0, 0, 33,
591− 32, 20, 31, 29, 0, 73, 74, 21, 0, 24,
592− 0, 0, 0, 23
590+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
591+ 79, 0, 0, 14, 12, 45, 0, 47, 49, 51,
592+ 53, 55, 56, 60, 61, 59, 58, 62, 63, 65,
593+ 66, 69, 68, 70, 0, 0, 0, 0, 18, 0,
594+ 79, 15, 13, 0, 0, 0, 20, 30, 82, 22,
595+ 84, 0, 81, 80, 43, 21, 83, 0, 0, 16,
596+ 29, 19, 31, 0, 23, 32, 26, 0, 76, 34,
597+ 0, 0, 0, 0, 37, 36, 24, 35, 33, 0,
598+ 77, 78, 25, 0, 28, 0, 0, 0, 27
593599 };
594600
595601 /* YYPGOTO[NTERM-NUM]. */
596602 static const yytype_int8 yypgoto[] =
597603 {
598− -81, -81, 100, 104, -81, -38, -81, -80, -81, -81,
599− -81, -5, 66, 13, -81, 70, 67, 81, 64, 82,
600− 37, 27, 34, 38, -14, -81, 22, 24
604+ -44, -44, -44, 103, 99, 104, -44, -43, -44, -21,
605+ -44, -44, -44, -8, 63, 9, -44, 65, 67, 68,
606+ 69, 62, 26, 4, 22, 23, -19, -44, 20, 28
601607 };
602608
603609 /* YYDEFGOTO[NTERM-NUM]. */
604610 static const yytype_int16 yydefgoto[] =
605611 {
606− -1, 2, 7, 8, 15, 36, 65, 93, 112, 113,
607− 125, 20, 21, 22, 23, 24, 25, 26, 27, 28,
608− 29, 30, 31, 32, 33, 128, 94, 95
612+ -1, 2, 3, 4, 10, 11, 19, 41, 70, 98,
613+ 117, 118, 130, 25, 26, 27, 28, 29, 30, 31,
614+ 32, 33, 34, 35, 36, 37, 38, 133, 99, 100
609615 };
610616
611617 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -613,87 +619,87 @@ static const yytype_int16 yydefgoto[] = · 1 unmodified line
613619 number is the opposite. If YYTABLE_NINF, syntax error. */
614620 static const yytype_uint8 yytable[] =
615621 {
616− 12, 68, 69, 41, 42, 43, 45, 34, 9, 10,
617− 53, 54, 104, 3, 5, 107, 101, 118, 35, 1,
618− 102, 4, 61, 11, 119, 120, 121, 122, 35, 97,
619− 46, 6, 55, 17, 123, 44, 18, 19, 56, 124,
620− 62, 63, 9, 10, 14, 51, 52, 86, 87, 88,
621− 9, 10, 48, 103, 129, 130, 115, 11, 135, 116,
622− 136, 47, 131, 57, 58, 11, 37, 49, 117, 50,
623− 137, 64, 38, 39, 138, 139, 40, 89, 90, 91,
624− 78, 79, 80, 81, 92, 59, 60, 66, 76, 77,
625− 67, 82, 83, 96, 98, 99, 100, 84, 85, 106,
626− 110, 111, 114, 126, 134, 127, 133, 141, 16, 143,
627− 13, 109, 71, 74, 72, 70, 105, 108, 0, 0,
628− 132, 0, 0, 0, 0, 0, 0, 0, 0, 73,
629− 0, 0, 75, 140, 0, 0, 142
622+ 16, 73, 74, 46, 47, 48, 13, 14, 39, 50,
623+ 58, 59, 120, 8, 140, 121, 141, 1, 94, 95,
624+ 96, 15, 12, 66, 122, 97, 142, 56, 57, 102,
625+ 9, 22, 60, 51, 23, 24, 62, 63, 61, 13,
626+ 14, 67, 68, 134, 135, 143, 144, 91, 92, 93,
627+ 123, 136, 5, 108, 15, 13, 14, 124, 125, 126,
628+ 127, 6, 83, 84, 85, 86, 18, 128, 42, 106,
629+ 15, 40, 129, 107, 43, 44, 109, 40, 45, 112,
630+ 64, 65, 81, 82, 87, 88, 49, 89, 90, 21,
631+ 52, 69, 53, 71, 54, 72, 55, 103, 101, 104,
632+ 105, 115, 111, 131, 116, 119, 7, 138, 132, 139,
633+ 20, 146, 114, 17, 76, 75, 148, 80, 0, 77,
634+ 113, 78, 137, 79, 0, 110, 0, 0, 0, 0,
635+ 0, 0, 0, 0, 0, 145, 0, 0, 147
630636 };
631637
632638 static const yytype_int16 yycheck[] =
633639 {
634− 5, 39, 40, 17, 18, 19, 12, 12, 17, 18,
635− 7, 8, 92, 24, 4, 95, 24, 13, 26, 3,
636− 28, 0, 25, 32, 20, 21, 22, 23, 26, 67,
637− 36, 21, 29, 42, 30, 34, 45, 46, 35, 35,
638− 43, 44, 17, 18, 25, 9, 10, 61, 62, 63,
639− 17, 18, 38, 91, 21, 22, 21, 32, 19, 24,
640− 21, 11, 29, 5, 6, 32, 15, 39, 33, 40,
641− 31, 24, 21, 22, 33, 34, 25, 14, 15, 16,
642− 53, 54, 55, 56, 21, 41, 42, 22, 51, 52,
643− 22, 57, 58, 24, 37, 16, 16, 59, 60, 27,
644− 24, 24, 24, 17, 20, 32, 35, 33, 8, 34,
645− 6, 98, 46, 49, 47, 45, 92, 95, -1, -1,
646− 125, -1, -1, -1, -1, -1, -1, -1, -1, 48,
647− -1, -1, 50, 138, -1, -1, 141
640+ 8, 44, 45, 22, 23, 24, 18, 19, 16, 13,
641+ 8, 9, 22, 5, 20, 25, 22, 3, 15, 16,
642+ 17, 33, 4, 26, 34, 22, 32, 10, 11, 72,
643+ 22, 43, 30, 37, 46, 47, 6, 7, 36, 18,
644+ 19, 44, 45, 22, 23, 34, 35, 66, 67, 68,
645+ 14, 30, 25, 96, 33, 18, 19, 21, 22, 23,
646+ 24, 0, 58, 59, 60, 61, 26, 31, 16, 25,
647+ 33, 27, 36, 29, 22, 23, 97, 27, 26, 100,
648+ 42, 43, 56, 57, 62, 63, 35, 64, 65, 25,
649+ 12, 25, 39, 23, 40, 23, 41, 38, 25, 17,
650+ 17, 25, 28, 18, 25, 25, 3, 36, 33, 21,
651+ 11, 34, 103, 9, 51, 50, 35, 55, -1, 52,
652+ 100, 53, 130, 54, -1, 97, -1, -1, -1, -1,
653+ -1, -1, -1, -1, -1, 143, -1, -1, 146
648654 };
649655
650656 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
651657 symbol of state STATE-NUM. */
652658 static const yytype_uint8 yystos[] =
653659 {
654− 0, 3, 48, 24, 0, 4, 21, 49, 50, 17,
655− 18, 32, 58, 50, 25, 51, 49, 42, 45, 46,
656− 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
657− 68, 69, 70, 71, 58, 26, 52, 15, 21, 22,
658− 25, 71, 71, 71, 34, 12, 36, 11, 38, 39,
659− 40, 9, 10, 7, 8, 29, 35, 5, 6, 41,
660− 42, 25, 43, 44, 24, 53, 22, 22, 52, 52,
661− 62, 59, 63, 64, 65, 66, 67, 67, 68, 68,
662− 68, 68, 69, 69, 70, 70, 71, 71, 71, 14,
663− 15, 16, 21, 54, 73, 74, 24, 52, 37, 16,
664− 16, 24, 28, 52, 54, 74, 27, 54, 73, 60,
665− 24, 24, 55, 56, 24, 21, 24, 33, 13, 20,
666− 21, 22, 23, 30, 35, 57, 17, 32, 72, 21,
667− 22, 29, 58, 35, 20, 19, 21, 31, 33, 34,
668− 58, 33, 58, 34
660+ 0, 3, 49, 50, 51, 25, 0, 51, 5, 22,
661+ 52, 53, 4, 18, 19, 33, 61, 53, 26, 54,
662+ 52, 25, 43, 46, 47, 61, 62, 63, 64, 65,
663+ 66, 67, 68, 69, 70, 71, 72, 73, 74, 61,
664+ 27, 55, 16, 22, 23, 26, 74, 74, 74, 35,
665+ 13, 37, 12, 39, 40, 41, 10, 11, 8, 9,
666+ 30, 36, 6, 7, 42, 43, 26, 44, 45, 25,
667+ 56, 23, 23, 55, 55, 65, 62, 66, 67, 68,
668+ 69, 70, 70, 71, 71, 71, 71, 72, 72, 73,
669+ 73, 74, 74, 74, 15, 16, 17, 22, 57, 76,
670+ 77, 25, 55, 38, 17, 17, 25, 29, 55, 57,
671+ 77, 28, 57, 76, 63, 25, 25, 58, 59, 25,
672+ 22, 25, 34, 14, 21, 22, 23, 24, 31, 36,
673+ 60, 18, 33, 75, 22, 23, 30, 61, 36, 21,
674+ 20, 22, 32, 34, 35, 61, 34, 61, 35
669675 };
670676
671677 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
672678 static const yytype_uint8 yyr1[] =
673679 {
674− 0, 47, 48, 49, 49, 50, 50, 51, 51, 51,
675− 51, 51, 52, 53, 53, 54, 54, 54, 54, 55,
676− 55, 55, 55, 55, 55, 55, 56, 56, 56, 57,
677− 57, 57, 57, 57, 58, 58, 58, 59, 60, 60,
678− 61, 61, 62, 62, 63, 63, 64, 64, 65, 65,
679− 66, 66, 66, 67, 67, 67, 67, 67, 68, 68,
680− 68, 69, 69, 69, 70, 70, 70, 70, 71, 71,
681− 71, 71, 72, 72, 72, 73, 73, 73, 74, 74,
682− 74
680+ 0, 48, 49, 50, 50, 51, 51, 52, 52, 53,
681+ 53, 54, 54, 54, 54, 54, 55, 56, 56, 57,
682+ 57, 57, 57, 58, 58, 58, 58, 58, 58, 58,
683+ 59, 59, 59, 60, 60, 60, 60, 60, 61, 61,
684+ 61, 62, 63, 63, 64, 64, 65, 65, 66, 66,
685+ 67, 67, 68, 68, 69, 69, 69, 70, 70, 70,
686+ 70, 70, 71, 71, 71, 72, 72, 72, 73, 73,
687+ 73, 73, 74, 74, 74, 74, 75, 75, 75, 76,
688+ 76, 76, 77, 77, 77
683689 };
684690
685691 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
686692 static const yytype_uint8 yyr2[] =
687693 {
688− 0, 2, 4, 0, 2, 4, 2, 2, 3, 4,
689− 3, 4, 5, 0, 2, 4, 2, 3, 2, 2,
690− 3, 4, 2, 9, 5, 2, 0, 2, 2, 3,
691− 1, 2, 2, 2, 1, 1, 3, 1, 1, 5,
692− 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
693− 1, 3, 3, 1, 3, 3, 3, 3, 3, 3,
694− 1, 3, 3, 1, 3, 3, 3, 1, 1, 2,
695− 2, 2, 0, 2, 2, 0, 2, 2, 2, 3,
696− 2
694+ 0, 2, 3, 2, 4, 1, 2, 0, 2, 4,
695+ 2, 2, 3, 4, 3, 4, 5, 0, 2, 4,
696+ 2, 3, 2, 2, 3, 4, 2, 9, 5, 2,
697+ 0, 2, 2, 3, 1, 2, 2, 2, 1, 1,
698+ 3, 1, 1, 5, 1, 3, 1, 3, 1, 3,
699+ 1, 3, 1, 3, 1, 3, 3, 1, 3, 3,
700+ 3, 3, 3, 3, 1, 3, 3, 1, 3, 3,
701+ 3, 1, 1, 2, 2, 2, 0, 2, 2, 0,
702+ 2, 2, 2, 3, 2
697703 };
698704
699705
@@ -1463,65 +1469,91 @@ yyreduce: · 763 unmodified lines
14631469 switch (yyn)
14641470 {
14651471 case 2:
1466−#line 105 "dtc-parser.y" /* yacc.c:1646 */
1472+#line 110 "dtc-parser.y" /* yacc.c:1646 */
14671473 {
1468− the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node),
1469− guess_boot_cpuid((yyvsp[0].node)));
1474+ parser_output = build_dt_info((yyvsp[-2].flags), (yyvsp[-1].re), (yyvsp[0].node),
1475+ guess_boot_cpuid((yyvsp[0].node)));
14701476 }
1471−#line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */
1477+#line 1478 "dtc-parser.tab.c" /* yacc.c:1646 */
14721478 break;
14731479
14741480 case 3:
1475−#line 113 "dtc-parser.y" /* yacc.c:1646 */
1481+#line 118 "dtc-parser.y" /* yacc.c:1646 */
14761482 {
1477− (yyval.re) = NULL;
1483+ (yyval.flags) = DTSF_V1;
14781484 }
1479−#line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */
1485+#line 1486 "dtc-parser.tab.c" /* yacc.c:1646 */
14801486 break;
14811487
14821488 case 4:
1483−#line 117 "dtc-parser.y" /* yacc.c:1646 */
1489+#line 122 "dtc-parser.y" /* yacc.c:1646 */
1490+ {
1491+ (yyval.flags) = DTSF_V1 | DTSF_PLUGIN;
1492+ }
1493+#line 1494 "dtc-parser.tab.c" /* yacc.c:1646 */
1494+ break;
1495+
1496+ case 6:
1497+#line 130 "dtc-parser.y" /* yacc.c:1646 */
1498+ {
1499+ if ((yyvsp[0].flags) != (yyvsp[-1].flags))
1500+ ERROR(&(yylsp[0]), "Header flags don't match earlier ones");
1501+ (yyval.flags) = (yyvsp[-1].flags);
1502+ }
1503+#line 1504 "dtc-parser.tab.c" /* yacc.c:1646 */
1504+ break;
1505+
1506+ case 7:
1507+#line 139 "dtc-parser.y" /* yacc.c:1646 */
1508+ {
1509+ (yyval.re) = NULL;
1510+ }
1511+#line 1512 "dtc-parser.tab.c" /* yacc.c:1646 */
1512+ break;
1513+
1514+ case 8:
1515+#line 143 "dtc-parser.y" /* yacc.c:1646 */
14841516 {
14851517 (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re));
14861518 }
1487−#line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */
1519+#line 1520 "dtc-parser.tab.c" /* yacc.c:1646 */
14881520 break;
14891521
1490− case 5:
1491−#line 124 "dtc-parser.y" /* yacc.c:1646 */
1522+ case 9:
1523+#line 150 "dtc-parser.y" /* yacc.c:1646 */
14921524 {
14931525 (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer));
14941526 }
1495−#line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */
1527+#line 1528 "dtc-parser.tab.c" /* yacc.c:1646 */
14961528 break;
14971529
1498− case 6:
1499−#line 128 "dtc-parser.y" /* yacc.c:1646 */
1530+ case 10:
1531+#line 154 "dtc-parser.y" /* yacc.c:1646 */
15001532 {
15011533 add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref));
15021534 (yyval.re) = (yyvsp[0].re);
15031535 }
1504−#line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */
1536+#line 1537 "dtc-parser.tab.c" /* yacc.c:1646 */
15051537 break;
15061538
1507− case 7:
1508−#line 136 "dtc-parser.y" /* yacc.c:1646 */
1539+ case 11:
1540+#line 162 "dtc-parser.y" /* yacc.c:1646 */
15091541 {
15101542 (yyval.node) = name_node((yyvsp[0].node), "");
15111543 }
1512−#line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */
1544+#line 1545 "dtc-parser.tab.c" /* yacc.c:1646 */
15131545 break;
15141546
1515− case 8:
1516−#line 140 "dtc-parser.y" /* yacc.c:1646 */
1547+ case 12:
1548+#line 166 "dtc-parser.y" /* yacc.c:1646 */
15171549 {
15181550 (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node));
15191551 }
1520−#line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */
1552+#line 1553 "dtc-parser.tab.c" /* yacc.c:1646 */
15211553 break;
15221554
1523− case 9:
1524−#line 145 "dtc-parser.y" /* yacc.c:1646 */
1555+ case 13:
1556+#line 171 "dtc-parser.y" /* yacc.c:1646 */
15251557 {
15261558 struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));
15271559
@@ -1532,11 +1564,11 @@ yyreduce: · 4 unmodified lines
15321564 ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
15331565 (yyval.node) = (yyvsp[-3].node);
15341566 }
1535−#line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */
1567+#line 1568 "dtc-parser.tab.c" /* yacc.c:1646 */
15361568 break;
15371569
1538− case 10:
1539−#line 156 "dtc-parser.y" /* yacc.c:1646 */
1570+ case 14:
1571+#line 182 "dtc-parser.y" /* yacc.c:1646 */
15401572 {
15411573 struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref));
15421574
@@ -1546,11 +1578,11 @@ yyreduce: · 3 unmodified lines
15461578 ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
15471579 (yyval.node) = (yyvsp[-2].node);
15481580 }
1549−#line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */
1581+#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */
15501582 break;
15511583
1552− case 11:
1553−#line 166 "dtc-parser.y" /* yacc.c:1646 */
1584+ case 15:
1585+#line 192 "dtc-parser.y" /* yacc.c:1646 */
15541586 {
15551587 struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));
15561588
@@ -1562,100 +1594,100 @@ yyreduce: · 5 unmodified lines
15621594
15631595 (yyval.node) = (yyvsp[-3].node);
15641596 }
1565−#line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */
1597+#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */
15661598 break;
15671599
1568− case 12:
1569−#line 181 "dtc-parser.y" /* yacc.c:1646 */
1600+ case 16:
1601+#line 207 "dtc-parser.y" /* yacc.c:1646 */
15701602 {
15711603 (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist));
15721604 }
1573−#line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */
1605+#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */
15741606 break;
15751607
1576− case 13:
1577−#line 188 "dtc-parser.y" /* yacc.c:1646 */
1608+ case 17:
1609+#line 214 "dtc-parser.y" /* yacc.c:1646 */
15781610 {
15791611 (yyval.proplist) = NULL;
15801612 }
1581−#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */
1613+#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */
15821614 break;
15831615
1584− case 14:
1585−#line 192 "dtc-parser.y" /* yacc.c:1646 */
1616+ case 18:
1617+#line 218 "dtc-parser.y" /* yacc.c:1646 */
15861618 {
15871619 (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist));
15881620 }
1589−#line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */
1621+#line 1622 "dtc-parser.tab.c" /* yacc.c:1646 */
15901622 break;
15911623
1592− case 15:
1593−#line 199 "dtc-parser.y" /* yacc.c:1646 */
1624+ case 19:
1625+#line 225 "dtc-parser.y" /* yacc.c:1646 */
15941626 {
15951627 (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data));
15961628 }
1597−#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */
1629+#line 1630 "dtc-parser.tab.c" /* yacc.c:1646 */
15981630 break;
15991631
1600− case 16:
1601−#line 203 "dtc-parser.y" /* yacc.c:1646 */
1632+ case 20:
1633+#line 229 "dtc-parser.y" /* yacc.c:1646 */
16021634 {
16031635 (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data);
16041636 }
1605−#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */
1637+#line 1638 "dtc-parser.tab.c" /* yacc.c:1646 */
16061638 break;
16071639
1608− case 17:
1609−#line 207 "dtc-parser.y" /* yacc.c:1646 */
1640+ case 21:
1641+#line 233 "dtc-parser.y" /* yacc.c:1646 */
16101642 {
16111643 (yyval.prop) = build_property_delete((yyvsp[-1].propnodename));
16121644 }
1613−#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */
1645+#line 1646 "dtc-parser.tab.c" /* yacc.c:1646 */
16141646 break;
16151647
1616− case 18:
1617−#line 211 "dtc-parser.y" /* yacc.c:1646 */
1648+ case 22:
1649+#line 237 "dtc-parser.y" /* yacc.c:1646 */
16181650 {
16191651 add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref));
16201652 (yyval.prop) = (yyvsp[0].prop);
16211653 }
1622−#line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */
1654+#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */
16231655 break;
16241656
1625− case 19:
1626−#line 219 "dtc-parser.y" /* yacc.c:1646 */
1657+ case 23:
1658+#line 245 "dtc-parser.y" /* yacc.c:1646 */
16271659 {
16281660 (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data));
16291661 }
1630−#line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */
1662+#line 1663 "dtc-parser.tab.c" /* yacc.c:1646 */
16311663 break;
16321664
1633− case 20:
1634−#line 223 "dtc-parser.y" /* yacc.c:1646 */
1665+ case 24:
1666+#line 249 "dtc-parser.y" /* yacc.c:1646 */
16351667 {
16361668 (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data);
16371669 }
1638−#line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */
1670+#line 1671 "dtc-parser.tab.c" /* yacc.c:1646 */
16391671 break;
16401672
1641− case 21:
1642−#line 227 "dtc-parser.y" /* yacc.c:1646 */
1673+ case 25:
1674+#line 253 "dtc-parser.y" /* yacc.c:1646 */
16431675 {
16441676 (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data));
16451677 }
1646−#line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */
1678+#line 1679 "dtc-parser.tab.c" /* yacc.c:1646 */
16471679 break;
16481680
1649− case 22:
1650−#line 231 "dtc-parser.y" /* yacc.c:1646 */
1681+ case 26:
1682+#line 257 "dtc-parser.y" /* yacc.c:1646 */
16511683 {
16521684 (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref));
16531685 }
1654−#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */
1686+#line 1687 "dtc-parser.tab.c" /* yacc.c:1646 */
16551687 break;
16561688
1657− case 23:
1658−#line 235 "dtc-parser.y" /* yacc.c:1646 */
1689+ case 27:
1690+#line 261 "dtc-parser.y" /* yacc.c:1646 */
16591691 {
16601692 FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL);
16611693 struct data d;
@@ -1671,11 +1703,11 @@ yyreduce: · 9 unmodified lines
16711703 (yyval.data) = data_merge((yyvsp[-8].data), d);
16721704 fclose(f);
16731705 }
1674−#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */
1706+#line 1707 "dtc-parser.tab.c" /* yacc.c:1646 */
16751707 break;
16761708
1677− case 24:
1678−#line 251 "dtc-parser.y" /* yacc.c:1646 */
1709+ case 28:
1710+#line 277 "dtc-parser.y" /* yacc.c:1646 */
16791711 {
16801712 FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL);
16811713 struct data d = empty_data;
@@ -1685,43 +1717,43 @@ yyreduce: · 3 unmodified lines
16851717 (yyval.data) = data_merge((yyvsp[-4].data), d);
16861718 fclose(f);
16871719 }
1688−#line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */
1720+#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */
16891721 break;
16901722
1691− case 25:
1692−#line 261 "dtc-parser.y" /* yacc.c:1646 */
1723+ case 29:
1724+#line 287 "dtc-parser.y" /* yacc.c:1646 */
16931725 {
16941726 (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
16951727 }
1696−#line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */
1728+#line 1729 "dtc-parser.tab.c" /* yacc.c:1646 */
16971729 break;
16981730
1699− case 26:
1700−#line 268 "dtc-parser.y" /* yacc.c:1646 */
1731+ case 30:
1732+#line 294 "dtc-parser.y" /* yacc.c:1646 */
17011733 {
17021734 (yyval.data) = empty_data;
17031735 }
1704−#line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */
1736+#line 1737 "dtc-parser.tab.c" /* yacc.c:1646 */
17051737 break;
17061738
1707− case 27:
1708−#line 272 "dtc-parser.y" /* yacc.c:1646 */
1739+ case 31:
1740+#line 298 "dtc-parser.y" /* yacc.c:1646 */
17091741 {
17101742 (yyval.data) = (yyvsp[-1].data);
17111743 }
1712−#line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */
1744+#line 1745 "dtc-parser.tab.c" /* yacc.c:1646 */
17131745 break;
17141746
1715− case 28:
1716−#line 276 "dtc-parser.y" /* yacc.c:1646 */
1747+ case 32:
1748+#line 302 "dtc-parser.y" /* yacc.c:1646 */
17171749 {
17181750 (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
17191751 }
1720−#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */
1752+#line 1753 "dtc-parser.tab.c" /* yacc.c:1646 */
17211753 break;
17221754
1723− case 29:
1724−#line 283 "dtc-parser.y" /* yacc.c:1646 */
1755+ case 33:
1756+#line 309 "dtc-parser.y" /* yacc.c:1646 */
17251757 {
17261758 unsigned long long bits;
17271759
@@ -1737,20 +1769,20 @@ yyreduce: · 9 unmodified lines
17371769 (yyval.array).data = empty_data;
17381770 (yyval.array).bits = bits;
17391771 }
1740−#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */
1772+#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */
17411773 break;
17421774
1743− case 30:
1744−#line 299 "dtc-parser.y" /* yacc.c:1646 */
1775+ case 34:
1776+#line 325 "dtc-parser.y" /* yacc.c:1646 */
17451777 {
17461778 (yyval.array).data = empty_data;
17471779 (yyval.array).bits = 32;
17481780 }
1749−#line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */
1781+#line 1782 "dtc-parser.tab.c" /* yacc.c:1646 */
17501782 break;
17511783
1752− case 31:
1753−#line 304 "dtc-parser.y" /* yacc.c:1646 */
1784+ case 35:
1785+#line 330 "dtc-parser.y" /* yacc.c:1646 */
17541786 {
17551787 if ((yyvsp[-1].array).bits < 64) {
17561788 uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1;
@@ -1769,11 +1801,11 @@ yyreduce: · 12 unmodified lines
17691801
17701802 (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits);
17711803 }
1772−#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */
1804+#line 1805 "dtc-parser.tab.c" /* yacc.c:1646 */
17731805 break;
17741806
1775− case 32:
1776−#line 323 "dtc-parser.y" /* yacc.c:1646 */
1807+ case 36:
1808+#line 349 "dtc-parser.y" /* yacc.c:1646 */
17771809 {
17781810 uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits);
17791811
@@ -1787,129 +1819,129 @@ yyreduce: · 7 unmodified lines
17871819
17881820 (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits);
17891821 }
1790−#line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */
1822+#line 1823 "dtc-parser.tab.c" /* yacc.c:1646 */
17911823 break;
17921824
1793− case 33:
1794−#line 337 "dtc-parser.y" /* yacc.c:1646 */
1825+ case 37:
1826+#line 363 "dtc-parser.y" /* yacc.c:1646 */
17951827 {
17961828 (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref));
17971829 }
1798−#line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */
1830+#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */
17991831 break;
18001832
1801− case 36:
1802−#line 346 "dtc-parser.y" /* yacc.c:1646 */
1833+ case 40:
1834+#line 372 "dtc-parser.y" /* yacc.c:1646 */
18031835 {
18041836 (yyval.integer) = (yyvsp[-1].integer);
18051837 }
1806−#line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */
1838+#line 1839 "dtc-parser.tab.c" /* yacc.c:1646 */
18071839 break;
18081840
1809− case 39:
1810−#line 357 "dtc-parser.y" /* yacc.c:1646 */
1841+ case 43:
1842+#line 383 "dtc-parser.y" /* yacc.c:1646 */
18111843 { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); }
1812−#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */
1844+#line 1845 "dtc-parser.tab.c" /* yacc.c:1646 */
18131845 break;
18141846
1815− case 41:
1816−#line 362 "dtc-parser.y" /* yacc.c:1646 */
1847+ case 45:
1848+#line 388 "dtc-parser.y" /* yacc.c:1646 */
18171849 { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); }
1818−#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */
1850+#line 1851 "dtc-parser.tab.c" /* yacc.c:1646 */
18191851 break;
18201852
1821− case 43:
1822−#line 367 "dtc-parser.y" /* yacc.c:1646 */
1853+ case 47:
1854+#line 393 "dtc-parser.y" /* yacc.c:1646 */
18231855 { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); }
1824−#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */
1856+#line 1857 "dtc-parser.tab.c" /* yacc.c:1646 */
18251857 break;
18261858
1827− case 45:
1828−#line 372 "dtc-parser.y" /* yacc.c:1646 */
1859+ case 49:
1860+#line 398 "dtc-parser.y" /* yacc.c:1646 */
18291861 { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); }
1830−#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */
1862+#line 1863 "dtc-parser.tab.c" /* yacc.c:1646 */
18311863 break;
18321864
1833− case 47:
1834−#line 377 "dtc-parser.y" /* yacc.c:1646 */
1865+ case 51:
1866+#line 403 "dtc-parser.y" /* yacc.c:1646 */
18351867 { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); }
1836−#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */
1868+#line 1869 "dtc-parser.tab.c" /* yacc.c:1646 */
18371869 break;
18381870
1839− case 49:
1840−#line 382 "dtc-parser.y" /* yacc.c:1646 */
1871+ case 53:
1872+#line 408 "dtc-parser.y" /* yacc.c:1646 */
18411873 { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); }
1842−#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */
1874+#line 1875 "dtc-parser.tab.c" /* yacc.c:1646 */
18431875 break;
18441876
1845− case 51:
1846−#line 387 "dtc-parser.y" /* yacc.c:1646 */
1877+ case 55:
1878+#line 413 "dtc-parser.y" /* yacc.c:1646 */
18471879 { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); }
1848−#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */
1880+#line 1881 "dtc-parser.tab.c" /* yacc.c:1646 */
18491881 break;
18501882
1851− case 52:
1852−#line 388 "dtc-parser.y" /* yacc.c:1646 */
1883+ case 56:
1884+#line 414 "dtc-parser.y" /* yacc.c:1646 */
18531885 { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); }
1854−#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */
1886+#line 1887 "dtc-parser.tab.c" /* yacc.c:1646 */
18551887 break;
18561888
1857− case 54:
1858−#line 393 "dtc-parser.y" /* yacc.c:1646 */
1889+ case 58:
1890+#line 419 "dtc-parser.y" /* yacc.c:1646 */
18591891 { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); }
1860−#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */
1892+#line 1893 "dtc-parser.tab.c" /* yacc.c:1646 */
18611893 break;
18621894
1863− case 55:
1864−#line 394 "dtc-parser.y" /* yacc.c:1646 */
1895+ case 59:
1896+#line 420 "dtc-parser.y" /* yacc.c:1646 */
18651897 { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); }
1866−#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */
1898+#line 1899 "dtc-parser.tab.c" /* yacc.c:1646 */
18671899 break;
18681900
1869− case 56:
1870−#line 395 "dtc-parser.y" /* yacc.c:1646 */
1901+ case 60:
1902+#line 421 "dtc-parser.y" /* yacc.c:1646 */
18711903 { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); }
1872−#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */
1904+#line 1905 "dtc-parser.tab.c" /* yacc.c:1646 */
18731905 break;
18741906
1875− case 57:
1876−#line 396 "dtc-parser.y" /* yacc.c:1646 */
1907+ case 61:
1908+#line 422 "dtc-parser.y" /* yacc.c:1646 */
18771909 { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); }
1878−#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */
1910+#line 1911 "dtc-parser.tab.c" /* yacc.c:1646 */
18791911 break;
18801912
1881− case 58:
1882−#line 400 "dtc-parser.y" /* yacc.c:1646 */
1913+ case 62:
1914+#line 426 "dtc-parser.y" /* yacc.c:1646 */
18831915 { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); }
1884−#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */
1916+#line 1917 "dtc-parser.tab.c" /* yacc.c:1646 */
18851917 break;
18861918
1887− case 59:
1888−#line 401 "dtc-parser.y" /* yacc.c:1646 */
1919+ case 63:
1920+#line 427 "dtc-parser.y" /* yacc.c:1646 */
18891921 { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); }
1890−#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */
1922+#line 1923 "dtc-parser.tab.c" /* yacc.c:1646 */
18911923 break;
18921924
1893− case 61:
1894−#line 406 "dtc-parser.y" /* yacc.c:1646 */
1925+ case 65:
1926+#line 432 "dtc-parser.y" /* yacc.c:1646 */
18951927 { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); }
1896−#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */
1928+#line 1929 "dtc-parser.tab.c" /* yacc.c:1646 */
18971929 break;
18981930
1899− case 62:
1900−#line 407 "dtc-parser.y" /* yacc.c:1646 */
1931+ case 66:
1932+#line 433 "dtc-parser.y" /* yacc.c:1646 */
19011933 { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); }
1902−#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */
1934+#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */
19031935 break;
19041936
1905− case 64:
1906−#line 412 "dtc-parser.y" /* yacc.c:1646 */
1937+ case 68:
1938+#line 438 "dtc-parser.y" /* yacc.c:1646 */
19071939 { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); }
1908−#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */
1940+#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */
19091941 break;
19101942
1911− case 65:
1912−#line 414 "dtc-parser.y" /* yacc.c:1646 */
1943+ case 69:
1944+#line 440 "dtc-parser.y" /* yacc.c:1646 */
19131945 {
19141946 if ((yyvsp[0].integer) != 0) {
19151947 (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer);
@@ -1918,11 +1950,11 @@ yyreduce: · 2 unmodified lines
19181950 (yyval.integer) = 0;
19191951 }
19201952 }
1921−#line 1922 "dtc-parser.tab.c" /* yacc.c:1646 */
1953+#line 1954 "dtc-parser.tab.c" /* yacc.c:1646 */
19221954 break;
19231955
1924− case 66:
1925−#line 423 "dtc-parser.y" /* yacc.c:1646 */
1956+ case 70:
1957+#line 449 "dtc-parser.y" /* yacc.c:1646 */
19261958 {
19271959 if ((yyvsp[0].integer) != 0) {
19281960 (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer);
@@ -1931,103 +1963,103 @@ yyreduce: · 2 unmodified lines
19311963 (yyval.integer) = 0;
19321964 }
19331965 }
1934−#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */
1966+#line 1967 "dtc-parser.tab.c" /* yacc.c:1646 */
19351967 break;
19361968
1937− case 69:
1938−#line 436 "dtc-parser.y" /* yacc.c:1646 */
1969+ case 73:
1970+#line 462 "dtc-parser.y" /* yacc.c:1646 */
19391971 { (yyval.integer) = -(yyvsp[0].integer); }
1940−#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */
1972+#line 1973 "dtc-parser.tab.c" /* yacc.c:1646 */
19411973 break;
19421974
1943− case 70:
1944−#line 437 "dtc-parser.y" /* yacc.c:1646 */
1975+ case 74:
1976+#line 463 "dtc-parser.y" /* yacc.c:1646 */
19451977 { (yyval.integer) = ~(yyvsp[0].integer); }
1946−#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */
1978+#line 1979 "dtc-parser.tab.c" /* yacc.c:1646 */
19471979 break;
19481980
1949− case 71:
1950−#line 438 "dtc-parser.y" /* yacc.c:1646 */
1981+ case 75:
1982+#line 464 "dtc-parser.y" /* yacc.c:1646 */
19511983 { (yyval.integer) = !(yyvsp[0].integer); }
1952−#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */
1984+#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */
19531985 break;
19541986
1955− case 72:
1956−#line 443 "dtc-parser.y" /* yacc.c:1646 */
1987+ case 76:
1988+#line 469 "dtc-parser.y" /* yacc.c:1646 */
19571989 {
19581990 (yyval.data) = empty_data;
19591991 }
1960−#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */
1992+#line 1993 "dtc-parser.tab.c" /* yacc.c:1646 */
19611993 break;
19621994
1963− case 73:
1964−#line 447 "dtc-parser.y" /* yacc.c:1646 */
1995+ case 77:
1996+#line 473 "dtc-parser.y" /* yacc.c:1646 */
19651997 {
19661998 (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte));
19671999 }
1968−#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */
2000+#line 2001 "dtc-parser.tab.c" /* yacc.c:1646 */
19692001 break;
19702002
1971− case 74:
1972−#line 451 "dtc-parser.y" /* yacc.c:1646 */
2003+ case 78:
2004+#line 477 "dtc-parser.y" /* yacc.c:1646 */
19732005 {
19742006 (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
19752007 }
1976−#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */
2008+#line 2009 "dtc-parser.tab.c" /* yacc.c:1646 */
19772009 break;
19782010
1979− case 75:
1980−#line 458 "dtc-parser.y" /* yacc.c:1646 */
2011+ case 79:
2012+#line 484 "dtc-parser.y" /* yacc.c:1646 */
19812013 {
19822014 (yyval.nodelist) = NULL;
19832015 }
1984−#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */
2016+#line 2017 "dtc-parser.tab.c" /* yacc.c:1646 */
19852017 break;
19862018
1987− case 76:
1988−#line 462 "dtc-parser.y" /* yacc.c:1646 */
2019+ case 80:
2020+#line 488 "dtc-parser.y" /* yacc.c:1646 */
19892021 {
19902022 (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist));
19912023 }
1992−#line 1993 "dtc-parser.tab.c" /* yacc.c:1646 */
2024+#line 2025 "dtc-parser.tab.c" /* yacc.c:1646 */
19932025 break;
19942026
1995− case 77:
1996−#line 466 "dtc-parser.y" /* yacc.c:1646 */
2027+ case 81:
2028+#line 492 "dtc-parser.y" /* yacc.c:1646 */
19972029 {
19982030 ERROR(&(yylsp[0]), "Properties must precede subnodes");
19992031 YYERROR;
20002032 }
2001−#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */
2033+#line 2034 "dtc-parser.tab.c" /* yacc.c:1646 */
20022034 break;
20032035
2004− case 78:
2005−#line 474 "dtc-parser.y" /* yacc.c:1646 */
2036+ case 82:
2037+#line 500 "dtc-parser.y" /* yacc.c:1646 */
20062038 {
20072039 (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename));
20082040 }
2009−#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */
2041+#line 2042 "dtc-parser.tab.c" /* yacc.c:1646 */
20102042 break;
20112043
2012− case 79:
2013−#line 478 "dtc-parser.y" /* yacc.c:1646 */
2044+ case 83:
2045+#line 504 "dtc-parser.y" /* yacc.c:1646 */
20142046 {
20152047 (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename));
20162048 }
2017−#line 2018 "dtc-parser.tab.c" /* yacc.c:1646 */
2049+#line 2050 "dtc-parser.tab.c" /* yacc.c:1646 */
20182050 break;
20192051
2020− case 80:
2021−#line 482 "dtc-parser.y" /* yacc.c:1646 */
2052+ case 84:
2053+#line 508 "dtc-parser.y" /* yacc.c:1646 */
20222054 {
20232055 add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref));
20242056 (yyval.node) = (yyvsp[0].node);
20252057 }
2026−#line 2027 "dtc-parser.tab.c" /* yacc.c:1646 */
2058+#line 2059 "dtc-parser.tab.c" /* yacc.c:1646 */
20272059 break;
20282060
20292061
2030−#line 2031 "dtc-parser.tab.c" /* yacc.c:1646 */
2062+#line 2063 "dtc-parser.tab.c" /* yacc.c:1646 */
20312063 default: break;
20322064 }
20332065 /* User semantic actions sometimes alter yychar, and that requires
@@ -2262,7 +2294,7 @@ yyreturn: · 228 unmodified lines
22622294 #endif
22632295 return yyresult;
22642296 }
2265−#line 488 "dtc-parser.y" /* yacc.c:1906 */
2297+#line 514 "dtc-parser.y" /* yacc.c:1906 */
22662298
22672299
22682300 void yyerror(char const *s)
scripts/dtc/dtc-parser.tab.h_shipped+29−25
@@ -1,8 +1,8 @@
1−/* A Bison parser, made by GNU Bison 3.0.2. */
1+/* A Bison parser, made by GNU Bison 3.0.4. */
22
33 /* Bison interface for Yacc-like parsers in C
44
5− Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
5+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
66
77 This program is free software: you can redistribute it and/or modify
88 it under the terms of the GNU General Public License as published by
@@ -46,35 +46,36 @@ extern int yydebug; · 37 unmodified lines
4646 enum yytokentype
4747 {
4848 DT_V1 = 258,
49− DT_MEMRESERVE = 259,
50− DT_LSHIFT = 260,
51− DT_RSHIFT = 261,
52− DT_LE = 262,
53− DT_GE = 263,
54− DT_EQ = 264,
55− DT_NE = 265,
56− DT_AND = 266,
57− DT_OR = 267,
58− DT_BITS = 268,
59− DT_DEL_PROP = 269,
60− DT_DEL_NODE = 270,
61− DT_PROPNODENAME = 271,
62− DT_LITERAL = 272,
63− DT_CHAR_LITERAL = 273,
64− DT_BYTE = 274,
65− DT_STRING = 275,
66− DT_LABEL = 276,
67− DT_REF = 277,
68− DT_INCBIN = 278
49+ DT_PLUGIN = 259,
50+ DT_MEMRESERVE = 260,
51+ DT_LSHIFT = 261,
52+ DT_RSHIFT = 262,
53+ DT_LE = 263,
54+ DT_GE = 264,
55+ DT_EQ = 265,
56+ DT_NE = 266,
57+ DT_AND = 267,
58+ DT_OR = 268,
59+ DT_BITS = 269,
60+ DT_DEL_PROP = 270,
61+ DT_DEL_NODE = 271,
62+ DT_PROPNODENAME = 272,
63+ DT_LITERAL = 273,
64+ DT_CHAR_LITERAL = 274,
65+ DT_BYTE = 275,
66+ DT_STRING = 276,
67+ DT_LABEL = 277,
68+ DT_REF = 278,
69+ DT_INCBIN = 279
6970 };
7071 #endif
7172
7273 /* Value type. */
7374 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
74−typedef union YYSTYPE YYSTYPE;
75+
7576 union YYSTYPE
7677 {
77−#line 38 "dtc-parser.y" /* yacc.c:1909 */
78+#line 39 "dtc-parser.y" /* yacc.c:1909 */
7879
7980 char *propnodename;
8081 char *labelref;
@@ -92,9 +93,12 @@ union YYSTYPE · 11 unmodified lines
9293 struct node *nodelist;
9394 struct reserve_info *re;
9495 uint64_t integer;
96+ unsigned int flags;
9597
96−#line 97 "dtc-parser.tab.h" /* yacc.c:1909 */
98+#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */
9799 };
100+
101+typedef union YYSTYPE YYSTYPE;
98102 # define YYSTYPE_IS_TRIVIAL 1
99103 # define YYSTYPE_IS_DECLARED 1
100104 #endif
scripts/dtc/dtc-parser.y+30−4
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 */
2020 %{
2121 #include <stdio.h>
22+#include <inttypes.h>
2223
2324 #include "dtc.h"
2425 #include "srcpos.h"
@@ -31,7 +32,7 @@ extern void yyerror(char const *s); · 6 unmodified lines
3132 treesource_error = true; \
3233 } while (0)
3334
34−extern struct boot_info *the_boot_info;
35+extern struct dt_info *parser_output;
3536 extern bool treesource_error;
3637 %}
3738
@@ -52,9 +53,11 @@ extern bool treesource_error; · 14 unmodified lines
5253 struct node *nodelist;
5354 struct reserve_info *re;
5455 uint64_t integer;
56+ unsigned int flags;
5557 }
5658
5759 %token DT_V1
60+%token DT_PLUGIN
5861 %token DT_MEMRESERVE
5962 %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR
6063 %token DT_BITS
@@ -71,6 +74,8 @@ extern bool treesource_error; · 10 unmodified lines
7174
7275 %type <data> propdata
7376 %type <data> propdataprefix
77+%type <flags> header
78+%type <flags> headers
7479 %type <re> memreserve
7580 %type <re> memreserves
7681 %type <array> arrayprefix
@@ -101,10 +106,31 @@ extern bool treesource_error; · 24 unmodified lines
101106 %%
102107
103108 sourcefile:
104− DT_V1 ';' memreserves devicetree
109+ headers memreserves devicetree
105110 {
106− the_boot_info = build_boot_info($3, $4,
107− guess_boot_cpuid($4));
111+ parser_output = build_dt_info($1, $2, $3,
112+ guess_boot_cpuid($3));
113+ }
114+ ;
115+
116+header:
117+ DT_V1 ';'
118+ {
119+ $$ = DTSF_V1;
120+ }
121+ | DT_V1 ';' DT_PLUGIN ';'
122+ {
123+ $$ = DTSF_V1 | DTSF_PLUGIN;
124+ }
125+ ;
126+
127+headers:
128+ header
129+ | header headers
130+ {
131+ if ($2 != $1)
132+ ERROR(&@2, "Header flags don't match earlier ones");
133+ $$ = $1;
108134 }
109135 ;
110136
scripts/dtc/dtc.c+57−12
@@ -30,7 +30,16 @@ int quiet; /* Level of quietness */ · 29 unmodified lines
3030 int reservenum; /* Number of memory reservation slots */
3131 int minsize; /* Minimum blob size */
3232 int padsize; /* Additional padding to blob */
33+int alignsize; /* Additional padding to blob accroding to the alignsize */
3334 int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */
35+int generate_symbols; /* enable symbols & fixup support */
36+int generate_fixups; /* suppress generation of fixups on symbol support */
37+int auto_label_aliases; /* auto generate labels -> aliases */
38+
39+static int is_power_of_2(int x)
40+{
41+ return (x > 0) && ((x & (x - 1)) == 0);
42+}
3443
3544 static void fill_fullpaths(struct node *tree, const char *prefix)
3645 {
@@ -53,7 +62,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix) · 16 unmodified lines
5362 #define FDT_VERSION(version) _FDT_VERSION(version)
5463 #define _FDT_VERSION(version) #version
5564 static const char usage_synopsis[] = "dtc [options] <input file>";
56−static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
65+static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:a:fb:i:H:sW:E:@Ahv";
5766 static struct option const usage_long_opts[] = {
5867 {"quiet", no_argument, NULL, 'q'},
5968 {"in-format", a_argument, NULL, 'I'},
@@ -64,6 +73,7 @@ static struct option const usage_long_opts[] = { · 4 unmodified lines
6473 {"reserve", a_argument, NULL, 'R'},
6574 {"space", a_argument, NULL, 'S'},
6675 {"pad", a_argument, NULL, 'p'},
76+ {"align", a_argument, NULL, 'a'},
6777 {"boot-cpu", a_argument, NULL, 'b'},
6878 {"force", no_argument, NULL, 'f'},
6979 {"include", a_argument, NULL, 'i'},
@@ -71,6 +81,8 @@ static struct option const usage_long_opts[] = { · 1 unmodified line
7181 {"phandle", a_argument, NULL, 'H'},
7282 {"warning", a_argument, NULL, 'W'},
7383 {"error", a_argument, NULL, 'E'},
84+ {"symbols", no_argument, NULL, '@'},
85+ {"auto-alias", no_argument, NULL, 'A'},
7486 {"help", no_argument, NULL, 'h'},
7587 {"version", no_argument, NULL, 'v'},
7688 {NULL, no_argument, NULL, 0x0},
@@ -91,6 +103,7 @@ static const char * const usage_opts_help[] = { · 14 unmodified lines
91103 "\n\tMake space for <number> reserve map entries (for dtb and asm output)",
92104 "\n\tMake the blob at least <bytes> long (extra space)",
93105 "\n\tAdd padding to the blob of <bytes> long (extra space)",
106+ "\n\tMake the blob align to the <bytes> (extra space)",
94107 "\n\tSet the physical boot cpu",
95108 "\n\tTry to produce output even if the input tree has errors",
96109 "\n\tAdd a path to search for include files",
@@ -101,6 +114,8 @@ static const char * const usage_opts_help[] = { · 4 unmodified lines
101114 "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties",
102115 "\n\tEnable/disable warnings (prefix with \"no-\")",
103116 "\n\tEnable/disable errors (prefix with \"no-\")",
117+ "\n\tEnable generation of symbols",
118+ "\n\tEnable auto-alias of labels",
104119 "\n\tPrint this help and exit",
105120 "\n\tPrint version and exit",
106121 NULL,
@@ -153,7 +168,7 @@ static const char *guess_input_format(const char *fname, const char *fallback) · 46 unmodified lines
153168
154169 int main(int argc, char *argv[])
155170 {
156− struct boot_info *bi;
171+ struct dt_info *dti;
157172 const char *inform = NULL;
158173 const char *outform = NULL;
159174 const char *outname = "-";
@@ -169,6 +184,7 @@ int main(int argc, char *argv[]) · 9 unmodified lines
169184 reservenum = 0;
170185 minsize = 0;
171186 padsize = 0;
187+ alignsize = 0;
172188
173189 while ((opt = util_getopt_long()) != EOF) {
174190 switch (opt) {
@@ -196,6 +212,12 @@ int main(int argc, char *argv[]) · 21 unmodified lines
196212 case 'p':
197213 padsize = strtol(optarg, NULL, 0);
198214 break;
215+ case 'a':
216+ alignsize = strtol(optarg, NULL, 0);
217+ if (!is_power_of_2(alignsize))
218+ die("Invalid argument \"%d\" to -a option\n",
219+ optarg);
220+ break;
199221 case 'f':
200222 force = true;
201223 break;
@@ -234,6 +256,13 @@ int main(int argc, char *argv[]) · 32 unmodified lines
234256 parse_checks_option(false, true, optarg);
235257 break;
236258
259+ case '@':
260+ generate_symbols = 1;
261+ break;
262+ case 'A':
263+ auto_label_aliases = 1;
264+ break;
265+
237266 case 'h':
238267 usage(NULL);
239268 default:
@@ -272,11 +301,11 @@ int main(int argc, char *argv[]) · 32 unmodified lines
272301 }
273302 }
274303 if (streq(inform, "dts"))
275− bi = dt_from_source(arg);
304+ dti = dt_from_source(arg);
276305 else if (streq(inform, "fs"))
277− bi = dt_from_fs(arg);
306+ dti = dt_from_fs(arg);
278307 else if(streq(inform, "dtb"))
279− bi = dt_from_blob(arg);
308+ dti = dt_from_blob(arg);
280309 else
281310 die("Unknown input format \"%s\"\n", inform);
282311
@@ -286,13 +315,29 @@ int main(int argc, char *argv[]) · 3 unmodified lines
286315 }
287316
288317 if (cmdline_boot_cpuid != -1)
289− bi->boot_cpuid_phys = cmdline_boot_cpuid;
318+ dti->boot_cpuid_phys = cmdline_boot_cpuid;
319+
320+ fill_fullpaths(dti->dt, "");
321+ process_checks(force, dti);
322+
323+ /* on a plugin, generate by default */
324+ if (dti->dtsflags & DTSF_PLUGIN) {
325+ generate_fixups = 1;
326+ }
290327
291− fill_fullpaths(bi->dt, "");
292− process_checks(force, bi);
328+ if (auto_label_aliases)
329+ generate_label_tree(dti, "aliases", false);
330+
331+ if (generate_symbols)
332+ generate_label_tree(dti, "__symbols__", true);
333+
334+ if (generate_fixups) {
335+ generate_fixups_tree(dti, "__fixups__");
336+ generate_local_fixups_tree(dti, "__local_fixups__");
337+ }
293338
294339 if (sort)
295− sort_tree(bi);
340+ sort_tree(dti);
296341
297342 if (streq(outname, "-")) {
298343 outf = stdout;
@@ -304,11 +349,11 @@ int main(int argc, char *argv[]) · 5 unmodified lines
304349 }
305350
306351 if (streq(outform, "dts")) {
307− dt_to_source(outf, bi);
352+ dt_to_source(outf, dti);
308353 } else if (streq(outform, "dtb")) {
309− dt_to_blob(outf, bi, outversion);
354+ dt_to_blob(outf, dti, outversion);
310355 } else if (streq(outform, "asm")) {
311− dt_to_asm(outf, bi, outversion);
356+ dt_to_asm(outf, dti, outversion);
312357 } else if (streq(outform, "null")) {
313358 /* do nothing */
314359 } else {
scripts/dtc/dtc.h+27−12
@@ -53,7 +53,11 @@ extern int quiet; /* Level of quietness */ · 52 unmodified lines
5353 extern int reservenum; /* Number of memory reservation slots */
5454 extern int minsize; /* Minimum blob size */
5555 extern int padsize; /* Additional padding to blob */
56+extern int alignsize; /* Additional padding to blob accroding to the alignsize */
5657 extern int phandle_format; /* Use linux,phandle or phandle properties */
58+extern int generate_symbols; /* generate symbols for nodes with labels */
59+extern int generate_fixups; /* generate fixups */
60+extern int auto_label_aliases; /* auto generate labels -> aliases */
5761
5862 #define PHANDLE_LEGACY 0x1
5963 #define PHANDLE_EPAPR 0x2
@@ -201,6 +205,8 @@ void delete_property(struct property *prop); · 141 unmodified lines
201205 void add_child(struct node *parent, struct node *child);
202206 void delete_node_by_name(struct node *parent, char *name);
203207 void delete_node(struct node *node);
208+void append_to_property(struct node *node,
209+ char *name, const void *data, int len);
204210
205211 const char *get_unitname(struct node *node);
206212 struct property *get_property(struct node *node, const char *propname);
@@ -235,35 +241,44 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list, · 28 unmodified lines
235241 struct reserve_info *new);
236242
237243
238−struct boot_info {
244+struct dt_info {
245+ unsigned int dtsflags;
239246 struct reserve_info *reservelist;
240− struct node *dt; /* the device tree */
241247 uint32_t boot_cpuid_phys;
248+ struct node *dt; /* the device tree */
242249 };
243250
244−struct boot_info *build_boot_info(struct reserve_info *reservelist,
245− struct node *tree, uint32_t boot_cpuid_phys);
246−void sort_tree(struct boot_info *bi);
251+/* DTS version flags definitions */
252+#define DTSF_V1 0x0001 /* /dts-v1/ */
253+#define DTSF_PLUGIN 0x0002 /* /plugin/ */
254+
255+struct dt_info *build_dt_info(unsigned int dtsflags,
256+ struct reserve_info *reservelist,
257+ struct node *tree, uint32_t boot_cpuid_phys);
258+void sort_tree(struct dt_info *dti);
259+void generate_label_tree(struct dt_info *dti, char *name, bool allocph);
260+void generate_fixups_tree(struct dt_info *dti, char *name);
261+void generate_local_fixups_tree(struct dt_info *dti, char *name);
247262
248263 /* Checks */
249264
250265 void parse_checks_option(bool warn, bool error, const char *arg);
251−void process_checks(bool force, struct boot_info *bi);
266+void process_checks(bool force, struct dt_info *dti);
252267
253268 /* Flattened trees */
254269
255−void dt_to_blob(FILE *f, struct boot_info *bi, int version);
256−void dt_to_asm(FILE *f, struct boot_info *bi, int version);
270+void dt_to_blob(FILE *f, struct dt_info *dti, int version);
271+void dt_to_asm(FILE *f, struct dt_info *dti, int version);
257272
258−struct boot_info *dt_from_blob(const char *fname);
273+struct dt_info *dt_from_blob(const char *fname);
259274
260275 /* Tree source */
261276
262−void dt_to_source(FILE *f, struct boot_info *bi);
263−struct boot_info *dt_from_source(const char *f);
277+void dt_to_source(FILE *f, struct dt_info *dti);
278+struct dt_info *dt_from_source(const char *f);
264279
265280 /* FS trees */
266281
267−struct boot_info *dt_from_fs(const char *dirname);
282+struct dt_info *dt_from_fs(const char *dirname);
268283
269284 #endif /* _DTC_H */
scripts/dtc/flattree.c+27−14
@@ -366,7 +366,7 @@ static void make_fdt_header(struct fdt_header *fdt, · 365 unmodified lines
366366 fdt->size_dt_struct = cpu_to_fdt32(dtsize);
367367 }
368368
369−void dt_to_blob(FILE *f, struct boot_info *bi, int version)
369+void dt_to_blob(FILE *f, struct dt_info *dti, int version)
370370 {
371371 struct version_info *vi = NULL;
372372 int i;
@@ -384,29 +384,36 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version) · 11 unmodified lines
384384 if (!vi)
385385 die("Unknown device tree blob version %d\n", version);
386386
387− flatten_tree(bi->dt, &bin_emitter, &dtbuf, &strbuf, vi);
387+ flatten_tree(dti->dt, &bin_emitter, &dtbuf, &strbuf, vi);
388388 bin_emit_cell(&dtbuf, FDT_END);
389389
390− reservebuf = flatten_reserve_list(bi->reservelist, vi);
390+ reservebuf = flatten_reserve_list(dti->reservelist, vi);
391391
392392 /* Make header */
393393 make_fdt_header(&fdt, vi, reservebuf.len, dtbuf.len, strbuf.len,
394− bi->boot_cpuid_phys);
394+ dti->boot_cpuid_phys);
395395
396396 /*
397397 * If the user asked for more space than is used, adjust the totalsize.
398398 */
399399 if (minsize > 0) {
400400 padlen = minsize - fdt32_to_cpu(fdt.totalsize);
401− if ((padlen < 0) && (quiet < 1))
402− fprintf(stderr,
403− "Warning: blob size %d >= minimum size %d\n",
404− fdt32_to_cpu(fdt.totalsize), minsize);
401+ if (padlen < 0) {
402+ padlen = 0;
403+ if (quiet < 1)
404+ fprintf(stderr,
405+ "Warning: blob size %d >= minimum size %d\n",
406+ fdt32_to_cpu(fdt.totalsize), minsize);
407+ }
405408 }
406409
407410 if (padsize > 0)
408411 padlen = padsize;
409412
413+ if (alignsize > 0)
414+ padlen = ALIGN(fdt32_to_cpu(fdt.totalsize) + padlen, alignsize)
415+ - fdt32_to_cpu(fdt.totalsize);
416+
410417 if (padlen > 0) {
411418 int tsize = fdt32_to_cpu(fdt.totalsize);
412419 tsize += padlen;
@@ -460,7 +467,7 @@ static void dump_stringtable_asm(FILE *f, struct data strbuf) · 47 unmodified lines
460467 }
461468 }
462469
463−void dt_to_asm(FILE *f, struct boot_info *bi, int version)
470+void dt_to_asm(FILE *f, struct dt_info *dti, int version)
464471 {
465472 struct version_info *vi = NULL;
466473 int i;
@@ -500,7 +507,7 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version) · 33 unmodified lines
500507
501508 if (vi->flags & FTF_BOOTCPUID) {
502509 fprintf(f, "\t/* boot_cpuid_phys */\n");
503− asm_emit_cell(f, bi->boot_cpuid_phys);
510+ asm_emit_cell(f, dti->boot_cpuid_phys);
504511 }
505512
506513 if (vi->flags & FTF_STRTABSIZE) {
@@ -530,7 +537,7 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version) · 23 unmodified lines
530537 * Use .long on high and low halfs of u64s to avoid .quad
531538 * as it appears .quad isn't available in some assemblers.
532539 */
533− for (re = bi->reservelist; re; re = re->next) {
540+ for (re = dti->reservelist; re; re = re->next) {
534541 struct label *l;
535542
536543 for_each_label(re->labels, l) {
@@ -550,7 +557,7 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version) · 13 unmodified lines
550557 fprintf(f, "\t.long\t0, 0\n\t.long\t0, 0\n");
551558
552559 emit_label(f, symprefix, "struct_start");
553− flatten_tree(bi->dt, &asm_emitter, f, &strbuf, vi);
560+ flatten_tree(dti->dt, &asm_emitter, f, &strbuf, vi);
554561
555562 fprintf(f, "\t/* FDT_END */\n");
556563 asm_emit_cell(f, FDT_END);
@@ -572,6 +579,8 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version) · 15 unmodified lines
572579 if (padsize > 0) {
573580 fprintf(f, "\t.space\t%d, 0\n", padsize);
574581 }
582+ if (alignsize > 0)
583+ asm_emit_align(f, alignsize);
575584 emit_label(f, symprefix, "blob_abs_end");
576585
577586 data_free(strbuf);
@@ -797,11 +806,15 @@ static struct node *unflatten_tree(struct inbuf *dtbuf, · 219 unmodified lines
797806 }
798807 } while (val != FDT_END_NODE);
799808
809+ if (node->name != flatname) {
810+ free(flatname);
811+ }
812+
800813 return node;
801814 }
802815
803816
804−struct boot_info *dt_from_blob(const char *fname)
817+struct dt_info *dt_from_blob(const char *fname)
805818 {
806819 FILE *f;
807820 uint32_t magic, totalsize, version, size_dt, boot_cpuid_phys;
@@ -929,5 +942,5 @@ struct boot_info *dt_from_blob(const char *fname) · 121 unmodified lines
929942
930943 fclose(f);
931944
932− return build_boot_info(reservelist, tree, boot_cpuid_phys);
945+ return build_dt_info(DTSF_V1, reservelist, tree, boot_cpuid_phys);
933946 }
scripts/dtc/fstree.c+2−3
@@ -79,13 +79,12 @@ static struct node *read_fstree(const char *dirname) · 78 unmodified lines
7979 return tree;
8080 }
8181
82−struct boot_info *dt_from_fs(const char *dirname)
82+struct dt_info *dt_from_fs(const char *dirname)
8383 {
8484 struct node *tree;
8585
8686 tree = read_fstree(dirname);
8787 tree = name_node(tree, "");
8888
89− return build_boot_info(NULL, tree, guess_boot_cpuid(tree));
89+ return build_dt_info(DTSF_V1, NULL, tree, guess_boot_cpuid(tree));
9090 }
91−
scripts/dtc/libfdt/Makefile.libfdt+1−1
@@ -7,5 +7,5 @@ LIBFDT_soname = libfdt.$(SHAREDLIB_EXT).1 · 6 unmodified lines
77 LIBFDT_INCLUDES = fdt.h libfdt.h libfdt_env.h
88 LIBFDT_VERSION = version.lds
99 LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c fdt_empty_tree.c \
10− fdt_addresses.c
10+ fdt_addresses.c fdt_overlay.c
1111 LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o)
scripts/dtc/libfdt/fdt_ro.c+28−2
@@ -88,6 +88,32 @@ static int _fdt_string_eq(const void *fdt, int stroffset, · 87 unmodified lines
8888 return (strlen(p) == len) && (memcmp(p, s, len) == 0);
8989 }
9090
91+uint32_t fdt_get_max_phandle(const void *fdt)
92+{
93+ uint32_t max_phandle = 0;
94+ int offset;
95+
96+ for (offset = fdt_next_node(fdt, -1, NULL);;
97+ offset = fdt_next_node(fdt, offset, NULL)) {
98+ uint32_t phandle;
99+
100+ if (offset == -FDT_ERR_NOTFOUND)
101+ return max_phandle;
102+
103+ if (offset < 0)
104+ return (uint32_t)-1;
105+
106+ phandle = fdt_get_phandle(fdt, offset);
107+ if (phandle == (uint32_t)-1)
108+ continue;
109+
110+ if (phandle > max_phandle)
111+ max_phandle = phandle;
112+ }
113+
114+ return 0;
115+}
116+
91117 int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
92118 {
93119 FDT_CHECK_HEADER(fdt);
@@ -545,7 +571,7 @@ int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property) · 451 unmodified lines
545571
546572 list = fdt_getprop(fdt, nodeoffset, property, &length);
547573 if (!list)
548− return -length;
574+ return length;
549575
550576 end = list + length;
551577
@@ -571,7 +597,7 @@ int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property, · 19 unmodified lines
571597
572598 list = fdt_getprop(fdt, nodeoffset, property, &length);
573599 if (!list)
574− return -length;
600+ return length;
575601
576602 len = strlen(string) + 1;
577603 end = list + length;
scripts/dtc/libfdt/fdt_rw.c+1−5
@@ -191,17 +191,13 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size) · 190 unmodified lines
191191 int fdt_del_mem_rsv(void *fdt, int n)
192192 {
193193 struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n);
194− int err;
195194
196195 FDT_RW_CHECK_HEADER(fdt);
197196
198197 if (n >= fdt_num_mem_rsv(fdt))
199198 return -FDT_ERR_NOTFOUND;
200199
201− err = _fdt_splice_mem_rsv(fdt, re, 1, 0);
202− if (err)
203− return err;
204− return 0;
200+ return _fdt_splice_mem_rsv(fdt, re, 1, 0);
205201 }
206202
207203 static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
scripts/dtc/libfdt/fdt_strerror.c+6−0
@@ -69,6 +69,7 @@ static struct fdt_errtabent fdt_errtable[] = { · 68 unmodified lines
6969
7070 FDT_ERRTABENT(FDT_ERR_BADOFFSET),
7171 FDT_ERRTABENT(FDT_ERR_BADPATH),
72+ FDT_ERRTABENT(FDT_ERR_BADPHANDLE),
7273 FDT_ERRTABENT(FDT_ERR_BADSTATE),
7374
7475 FDT_ERRTABENT(FDT_ERR_TRUNCATED),
@@ -76,6 +77,11 @@ static struct fdt_errtabent fdt_errtable[] = { · 1 unmodified line
7677 FDT_ERRTABENT(FDT_ERR_BADVERSION),
7778 FDT_ERRTABENT(FDT_ERR_BADSTRUCTURE),
7879 FDT_ERRTABENT(FDT_ERR_BADLAYOUT),
80+ FDT_ERRTABENT(FDT_ERR_INTERNAL),
81+ FDT_ERRTABENT(FDT_ERR_BADNCELLS),
82+ FDT_ERRTABENT(FDT_ERR_BADVALUE),
83+ FDT_ERRTABENT(FDT_ERR_BADOVERLAY),
84+ FDT_ERRTABENT(FDT_ERR_NOPHANDLES),
7985 };
8086 #define FDT_ERRTABSIZE (sizeof(fdt_errtable) / sizeof(fdt_errtable[0]))
8187
scripts/dtc/libfdt/fdt_wip.c+25−4
@@ -55,21 +55,42 @@ · 54 unmodified lines
5555
5656 #include "libfdt_internal.h"
5757
58+int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
59+ const char *name, int namelen,
60+ uint32_t idx, const void *val,
61+ int len)
62+{
63+ void *propval;
64+ int proplen;
65+
66+ propval = fdt_getprop_namelen_w(fdt, nodeoffset, name, namelen,
67+ &proplen);
68+ if (!propval)
69+ return proplen;
70+
71+ if (proplen < (len + idx))
72+ return -FDT_ERR_NOSPACE;
73+
74+ memcpy((char *)propval + idx, val, len);
75+ return 0;
76+}
77+
5878 int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
5979 const void *val, int len)
6080 {
61− void *propval;
81+ const void *propval;
6282 int proplen;
6383
64− propval = fdt_getprop_w(fdt, nodeoffset, name, &proplen);
84+ propval = fdt_getprop(fdt, nodeoffset, name, &proplen);
6585 if (! propval)
6686 return proplen;
6787
6888 if (proplen != len)
6989 return -FDT_ERR_NOSPACE;
7090
71− memcpy(propval, val, len);
72− return 0;
91+ return fdt_setprop_inplace_namelen_partial(fdt, nodeoffset, name,
92+ strlen(name), 0,
93+ val, len);
7394 }
7495
7596 static void _fdt_nop_region(void *start, int len)
scripts/dtc/libfdt/libfdt.h+180−30
@@ -61,7 +61,7 @@ · 60 unmodified lines
6161 #define FDT_ERR_NOTFOUND 1
6262 /* FDT_ERR_NOTFOUND: The requested node or property does not exist */
6363 #define FDT_ERR_EXISTS 2
64− /* FDT_ERR_EXISTS: Attemped to create a node or property which
64+ /* FDT_ERR_EXISTS: Attempted to create a node or property which
6565 * already exists */
6666 #define FDT_ERR_NOSPACE 3
6767 /* FDT_ERR_NOSPACE: Operation needed to expand the device
@@ -79,8 +79,10 @@ · 11 unmodified lines
7979 * (e.g. missing a leading / for a function which requires an
8080 * absolute path) */
8181 #define FDT_ERR_BADPHANDLE 6
82− /* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle
83− * value. phandle values of 0 and -1 are not permitted. */
82+ /* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle.
83+ * This can be caused either by an invalid phandle property
84+ * length, or the phandle value was either 0 or -1, which are
85+ * not permitted. */
8486 #define FDT_ERR_BADSTATE 7
8587 /* FDT_ERR_BADSTATE: Function was passed an incomplete device
8688 * tree created by the sequential-write functions, which is
@@ -126,7 +128,16 @@ · 39 unmodified lines
126128 * value. For example: a property expected to contain a string list
127129 * is not NUL-terminated within the length of its value. */
128130
129−#define FDT_ERR_MAX 15
131+#define FDT_ERR_BADOVERLAY 16
132+ /* FDT_ERR_BADOVERLAY: The device tree overlay, while
133+ * correctly structured, cannot be applied due to some
134+ * unexpected or missing value, property or node. */
135+
136+#define FDT_ERR_NOPHANDLES 17
137+ /* FDT_ERR_NOPHANDLES: The device tree doesn't have any
138+ * phandle available anymore without causing an overflow */
139+
140+#define FDT_ERR_MAX 17
130141
131142 /**********************************************************************/
132143 /* Low-level functions (you probably don't need these) */
@@ -168,27 +179,55 @@ int fdt_first_subnode(const void *fdt, int offset); · 35 unmodified lines
168179 */
169180 int fdt_next_subnode(const void *fdt, int offset);
170181
182+/**
183+ * fdt_for_each_subnode - iterate over all subnodes of a parent
184+ *
185+ * @node: child node (int, lvalue)
186+ * @fdt: FDT blob (const void *)
187+ * @parent: parent node (int)
188+ *
189+ * This is actually a wrapper around a for loop and would be used like so:
190+ *
191+ * fdt_for_each_subnode(node, fdt, parent) {
192+ * Use node
193+ * ...
194+ * }
195+ *
196+ * if ((node < 0) && (node != -FDT_ERR_NOT_FOUND)) {
197+ * Error handling
198+ * }
199+ *
200+ * Note that this is implemented as a macro and @node is used as
201+ * iterator in the loop. The parent variable be constant or even a
202+ * literal.
203+ *
204+ */
205+#define fdt_for_each_subnode(node, fdt, parent) \
206+ for (node = fdt_first_subnode(fdt, parent); \
207+ node >= 0; \
208+ node = fdt_next_subnode(fdt, node))
209+
171210 /**********************************************************************/
172211 /* General functions */
173212 /**********************************************************************/
174213
175214 #define fdt_get_header(fdt, field) \
176215 (fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
177−#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
216+#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
178217 #define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize))
179218 #define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct))
180219 #define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings))
181220 #define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap))
182221 #define fdt_version(fdt) (fdt_get_header(fdt, version))
183−#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
184−#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
185−#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
222+#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
223+#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
224+#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
186225 #define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct))
187226
188227 #define __fdt_set_hdr(name) \
189228 static inline void fdt_set_##name(void *fdt, uint32_t val) \
190229 { \
191− struct fdt_header *fdth = (struct fdt_header*)fdt; \
230+ struct fdt_header *fdth = (struct fdt_header *)fdt; \
192231 fdth->name = cpu_to_fdt32(val); \
193232 }
194233 __fdt_set_hdr(magic);
@@ -258,6 +297,21 @@ int fdt_move(const void *fdt, void *buf, int bufsize); · 63 unmodified lines
258297 */
259298 const char *fdt_string(const void *fdt, int stroffset);
260299
300+/**
301+ * fdt_get_max_phandle - retrieves the highest phandle in a tree
302+ * @fdt: pointer to the device tree blob
303+ *
304+ * fdt_get_max_phandle retrieves the highest phandle in the given
305+ * device tree. This will ignore badly formatted phandles, or phandles
306+ * with a value of 0 or -1.
307+ *
308+ * returns:
309+ * the highest phandle on success
310+ * 0, if no phandle was found in the device tree
311+ * -1, if an error occurred
312+ */
313+uint32_t fdt_get_max_phandle(const void *fdt);
314+
261315 /**
262316 * fdt_num_mem_rsv - retrieve the number of memory reserve map entries
263317 * @fdt: pointer to the device tree blob
@@ -318,8 +372,9 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, · 54 unmodified lines
318372 * returns:
319373 * structure block offset of the requested subnode (>=0), on success
320374 * -FDT_ERR_NOTFOUND, if the requested subnode does not exist
321− * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
322− * -FDT_ERR_BADMAGIC,
375+ * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
376+ * tag
377+ * -FDT_ERR_BADMAGIC,
323378 * -FDT_ERR_BADVERSION,
324379 * -FDT_ERR_BADSTATE,
325380 * -FDT_ERR_BADSTRUCTURE,
@@ -351,7 +406,8 @@ int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen); · 25 unmodified lines
351406 * address).
352407 *
353408 * returns:
354− * structure block offset of the node with the requested path (>=0), on success
409+ * structure block offset of the node with the requested path (>=0), on
410+ * success
355411 * -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid
356412 * -FDT_ERR_NOTFOUND, if the requested node does not exist
357413 * -FDT_ERR_BADMAGIC,
@@ -375,10 +431,12 @@ int fdt_path_offset(const void *fdt, const char *path); · 17 unmodified lines
375431 *
376432 * returns:
377433 * pointer to the node's name, on success
378− * If lenp is non-NULL, *lenp contains the length of that name (>=0)
434+ * If lenp is non-NULL, *lenp contains the length of that name
435+ * (>=0)
379436 * NULL, on error
380437 * if lenp is non-NULL *lenp contains an error code (<0):
381− * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
438+ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
439+ * tag
382440 * -FDT_ERR_BADMAGIC,
383441 * -FDT_ERR_BADVERSION,
384442 * -FDT_ERR_BADSTATE, standard meanings
@@ -426,6 +484,33 @@ int fdt_first_property_offset(const void *fdt, int nodeoffset); · 41 unmodified lines
426484 */
427485 int fdt_next_property_offset(const void *fdt, int offset);
428486
487+/**
488+ * fdt_for_each_property_offset - iterate over all properties of a node
489+ *
490+ * @property_offset: property offset (int, lvalue)
491+ * @fdt: FDT blob (const void *)
492+ * @node: node offset (int)
493+ *
494+ * This is actually a wrapper around a for loop and would be used like so:
495+ *
496+ * fdt_for_each_property_offset(property, fdt, node) {
497+ * Use property
498+ * ...
499+ * }
500+ *
501+ * if ((property < 0) && (property != -FDT_ERR_NOT_FOUND)) {
502+ * Error handling
503+ * }
504+ *
505+ * Note that this is implemented as a macro and property is used as
506+ * iterator in the loop. The node variable can be constant or even a
507+ * literal.
508+ */
509+#define fdt_for_each_property_offset(property, fdt, node) \
510+ for (property = fdt_first_property_offset(fdt, node); \
511+ property >= 0; \
512+ property = fdt_next_property_offset(fdt, property))
513+
429514 /**
430515 * fdt_get_property_by_offset - retrieve the property at a given offset
431516 * @fdt: pointer to the device tree blob
@@ -490,7 +575,8 @@ const struct fdt_property *fdt_get_property_namelen(const void *fdt, · 58 unmodified lines
490575 * NULL, on error
491576 * if lenp is non-NULL, *lenp contains an error code (<0):
492577 * -FDT_ERR_NOTFOUND, node does not have named property
493− * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
578+ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
579+ * tag
494580 * -FDT_ERR_BADMAGIC,
495581 * -FDT_ERR_BADVERSION,
496582 * -FDT_ERR_BADSTATE,
@@ -554,6 +640,13 @@ const void *fdt_getprop_by_offset(const void *fdt, int offset, · 57 unmodified lines
554640 */
555641 const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
556642 const char *name, int namelen, int *lenp);
643+static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
644+ const char *name, int namelen,
645+ int *lenp)
646+{
647+ return (void *)(uintptr_t)fdt_getprop_namelen(fdt, nodeoffset, name,
648+ namelen, lenp);
649+}
557650
558651 /**
559652 * fdt_getprop - retrieve the value of a given property
@@ -575,7 +668,8 @@ const void *fdt_getprop_namelen(const void *fdt, int nodeoffset, · 15 unmodified lines
575668 * NULL, on error
576669 * if lenp is non-NULL, *lenp contains an error code (<0):
577670 * -FDT_ERR_NOTFOUND, node does not have named property
578− * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
671+ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
672+ * tag
579673 * -FDT_ERR_BADMAGIC,
580674 * -FDT_ERR_BADVERSION,
581675 * -FDT_ERR_BADSTATE,
@@ -617,7 +711,7 @@ const char *fdt_get_alias_namelen(const void *fdt, · 35 unmodified lines
617711 const char *name, int namelen);
618712
619713 /**
620− * fdt_get_alias - retreive the path referenced by a given alias
714+ * fdt_get_alias - retrieve the path referenced by a given alias
621715 * @fdt: pointer to the device tree blob
622716 * @name: name of the alias th look up
623717 *
@@ -647,7 +741,7 @@ const char *fdt_get_alias(const void *fdt, const char *name); · 23 unmodified lines
647741 * 0, on success
648742 * buf contains the absolute path of the node at
649743 * nodeoffset, as a NUL-terminated string.
650− * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
744+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
651745 * -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1)
652746 * characters and will not fit in the given buffer.
653747 * -FDT_ERR_BADMAGIC,
@@ -677,11 +771,11 @@ int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen); · 23 unmodified lines
677771 * structure from the start to nodeoffset.
678772 *
679773 * returns:
680−
681774 * structure block offset of the node at node offset's ancestor
682775 * of depth supernodedepth (>=0), on success
683− * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
684−* -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of nodeoffset
776+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
777+ * -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of
778+ * nodeoffset
685779 * -FDT_ERR_BADMAGIC,
686780 * -FDT_ERR_BADVERSION,
687781 * -FDT_ERR_BADSTATE,
@@ -703,7 +797,7 @@ int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, · 15 unmodified lines
703797 *
704798 * returns:
705799 * depth of the node at nodeoffset (>=0), on success
706− * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
800+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
707801 * -FDT_ERR_BADMAGIC,
708802 * -FDT_ERR_BADVERSION,
709803 * -FDT_ERR_BADSTATE,
@@ -726,7 +820,7 @@ int fdt_node_depth(const void *fdt, int nodeoffset); · 16 unmodified lines
726820 * returns:
727821 * structure block offset of the parent of the node at nodeoffset
728822 * (>=0), on success
729− * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
823+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
730824 * -FDT_ERR_BADMAGIC,
731825 * -FDT_ERR_BADVERSION,
732826 * -FDT_ERR_BADSTATE,
@@ -766,7 +860,7 @@ int fdt_parent_offset(const void *fdt, int nodeoffset); · 33 unmodified lines
766860 * on success
767861 * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
768862 * tree after startoffset
769− * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
863+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
770864 * -FDT_ERR_BADMAGIC,
771865 * -FDT_ERR_BADVERSION,
772866 * -FDT_ERR_BADSTATE,
@@ -813,7 +907,7 @@ int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle); · 40 unmodified lines
813907 * 1, if the node has a 'compatible' property, but it does not list
814908 * the given string
815909 * -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property
816− * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
910+ * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
817911 * -FDT_ERR_BADMAGIC,
818912 * -FDT_ERR_BADVERSION,
819913 * -FDT_ERR_BADSTATE,
@@ -850,7 +944,7 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset, · 30 unmodified lines
850944 * on success
851945 * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
852946 * tree after startoffset
853− * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
947+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
854948 * -FDT_ERR_BADMAGIC,
855949 * -FDT_ERR_BADVERSION,
856950 * -FDT_ERR_BADSTATE,
@@ -960,7 +1054,8 @@ const char *fdt_stringlist_get(const void *fdt, int nodeoffset, · 103 unmodified lines
9601054 * returns:
9611055 * 0 <= n < FDT_MAX_NCELLS, on success
9621056 * 2, if the node has no #address-cells property
963− * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid #address-cells property
1057+ * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1058+ * #address-cells property
9641059 * -FDT_ERR_BADMAGIC,
9651060 * -FDT_ERR_BADVERSION,
9661061 * -FDT_ERR_BADSTATE,
@@ -980,7 +1075,8 @@ int fdt_address_cells(const void *fdt, int nodeoffset); · 13 unmodified lines
9801075 * returns:
9811076 * 0 <= n < FDT_MAX_NCELLS, on success
9821077 * 2, if the node has no #address-cells property
983− * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid #size-cells property
1078+ * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1079+ * #size-cells property
9841080 * -FDT_ERR_BADMAGIC,
9851081 * -FDT_ERR_BADVERSION,
9861082 * -FDT_ERR_BADSTATE,
@@ -994,6 +1090,27 @@ int fdt_size_cells(const void *fdt, int nodeoffset); · 7 unmodified lines
9941090 /* Write-in-place functions */
9951091 /**********************************************************************/
9961092
1093+/**
1094+ * fdt_setprop_inplace_namelen_partial - change a property's value,
1095+ * but not its size
1096+ * @fdt: pointer to the device tree blob
1097+ * @nodeoffset: offset of the node whose property to change
1098+ * @name: name of the property to change
1099+ * @namelen: number of characters of name to consider
1100+ * @idx: index of the property to change in the array
1101+ * @val: pointer to data to replace the property value with
1102+ * @len: length of the property value
1103+ *
1104+ * Identical to fdt_setprop_inplace(), but modifies the given property
1105+ * starting from the given index, and using only the first characters
1106+ * of the name. It is useful when you want to manipulate only one value of
1107+ * an array and you have a string that doesn't end with \0.
1108+ */
1109+int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
1110+ const char *name, int namelen,
1111+ uint32_t idx, const void *val,
1112+ int len);
1113+
9971114 /**
9981115 * fdt_setprop_inplace - change a property's value, but not its size
9991116 * @fdt: pointer to the device tree blob
@@ -1604,9 +1721,11 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset, · 604 unmodified lines
16041721 * change the offsets of some existing nodes.
16051722
16061723 * returns:
1607− * structure block offset of the created nodeequested subnode (>=0), on success
1724+ * structure block offset of the created nodeequested subnode (>=0), on
1725+ * success
16081726 * -FDT_ERR_NOTFOUND, if the requested subnode does not exist
1609− * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
1727+ * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
1728+ * tag
16101729 * -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
16111730 * the given name
16121731 * -FDT_ERR_NOSPACE, if there is insufficient free space in the
@@ -1644,6 +1763,37 @@ int fdt_add_subnode(void *fdt, int parentoffset, const char *name); · 31 unmodified lines
16441763 */
16451764 int fdt_del_node(void *fdt, int nodeoffset);
16461765
1766+/**
1767+ * fdt_overlay_apply - Applies a DT overlay on a base DT
1768+ * @fdt: pointer to the base device tree blob
1769+ * @fdto: pointer to the device tree overlay blob
1770+ *
1771+ * fdt_overlay_apply() will apply the given device tree overlay on the
1772+ * given base device tree.
1773+ *
1774+ * Expect the base device tree to be modified, even if the function
1775+ * returns an error.
1776+ *
1777+ * returns:
1778+ * 0, on success
1779+ * -FDT_ERR_NOSPACE, there's not enough space in the base device tree
1780+ * -FDT_ERR_NOTFOUND, the overlay points to some inexistant nodes or
1781+ * properties in the base DT
1782+ * -FDT_ERR_BADPHANDLE,
1783+ * -FDT_ERR_BADOVERLAY,
1784+ * -FDT_ERR_NOPHANDLES,
1785+ * -FDT_ERR_INTERNAL,
1786+ * -FDT_ERR_BADLAYOUT,
1787+ * -FDT_ERR_BADMAGIC,
1788+ * -FDT_ERR_BADOFFSET,
1789+ * -FDT_ERR_BADPATH,
1790+ * -FDT_ERR_BADVERSION,
1791+ * -FDT_ERR_BADSTRUCTURE,
1792+ * -FDT_ERR_BADSTATE,
1793+ * -FDT_ERR_TRUNCATED, standard meanings
1794+ */
1795+int fdt_overlay_apply(void *fdt, void *fdto);
1796+
16471797 /**********************************************************************/
16481798 /* Debugging / informational functions */
16491799 /**********************************************************************/
scripts/dtc/libfdt/libfdt_env.h+1−0
@@ -54,6 +54,7 @@ · 53 unmodified lines
5454
5555 #include <stddef.h>
5656 #include <stdint.h>
57+#include <stdlib.h>
5758 #include <string.h>
5859
5960 #ifdef __CHECKER__
scripts/dtc/livetree.c+283−16
@@ -204,7 +204,7 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node) · 203 unmodified lines
204204 }
205205 }
206206
207− /* if no collision occured, add child to the old node. */
207+ /* if no collision occurred, add child to the old node. */
208208 if (new_child)
209209 add_child(old_node, new_child);
210210 }
@@ -296,6 +296,23 @@ void delete_node(struct node *node) · 85 unmodified lines
296296 delete_labels(&node->labels);
297297 }
298298
299+void append_to_property(struct node *node,
300+ char *name, const void *data, int len)
301+{
302+ struct data d;
303+ struct property *p;
304+
305+ p = get_property(node, name);
306+ if (p) {
307+ d = data_append_data(p->val, data, len);
308+ p->val = d;
309+ } else {
310+ d = data_append_data(empty_data, data, len);
311+ p = build_property(name, d);
312+ add_property(node, p);
313+ }
314+}
315+
299316 struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size)
300317 {
301318 struct reserve_info *new = xmalloc(sizeof(*new));
@@ -335,17 +352,19 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list, · 33 unmodified lines
335352 return list;
336353 }
337354
338−struct boot_info *build_boot_info(struct reserve_info *reservelist,
339− struct node *tree, uint32_t boot_cpuid_phys)
355+struct dt_info *build_dt_info(unsigned int dtsflags,
356+ struct reserve_info *reservelist,
357+ struct node *tree, uint32_t boot_cpuid_phys)
340358 {
341− struct boot_info *bi;
359+ struct dt_info *dti;
342360
343− bi = xmalloc(sizeof(*bi));
344− bi->reservelist = reservelist;
345− bi->dt = tree;
346− bi->boot_cpuid_phys = boot_cpuid_phys;
361+ dti = xmalloc(sizeof(*dti));
362+ dti->dtsflags = dtsflags;
363+ dti->reservelist = reservelist;
364+ dti->dt = tree;
365+ dti->boot_cpuid_phys = boot_cpuid_phys;
347366
348− return bi;
367+ return dti;
349368 }
350369
351370 /*
@@ -592,12 +611,12 @@ static int cmp_reserve_info(const void *ax, const void *bx) · 240 unmodified lines
592611 return 0;
593612 }
594613
595−static void sort_reserve_entries(struct boot_info *bi)
614+static void sort_reserve_entries(struct dt_info *dti)
596615 {
597616 struct reserve_info *ri, **tbl;
598617 int n = 0, i = 0;
599618
600− for (ri = bi->reservelist;
619+ for (ri = dti->reservelist;
601620 ri;
602621 ri = ri->next)
603622 n++;
@@ -607,14 +626,14 @@ static void sort_reserve_entries(struct boot_info *bi) · 3 unmodified lines
607626
608627 tbl = xmalloc(n * sizeof(*tbl));
609628
610− for (ri = bi->reservelist;
629+ for (ri = dti->reservelist;
611630 ri;
612631 ri = ri->next)
613632 tbl[i++] = ri;
614633
615634 qsort(tbl, n, sizeof(*tbl), cmp_reserve_info);
616635
617− bi->reservelist = tbl[0];
636+ dti->reservelist = tbl[0];
618637 for (i = 0; i < (n-1); i++)
619638 tbl[i]->next = tbl[i+1];
620639 tbl[n-1]->next = NULL;
@@ -704,8 +723,256 @@ static void sort_node(struct node *node) · 83 unmodified lines
704723 sort_node(c);
705724 }
706725
707−void sort_tree(struct boot_info *bi)
726+void sort_tree(struct dt_info *dti)
727+{
728+ sort_reserve_entries(dti);
729+ sort_node(dti->dt);
730+}
731+
732+/* utility helper to avoid code duplication */
733+static struct node *build_and_name_child_node(struct node *parent, char *name)
734+{
735+ struct node *node;
736+
737+ node = build_node(NULL, NULL);
738+ name_node(node, xstrdup(name));
739+ add_child(parent, node);
740+
741+ return node;
742+}
743+
744+static struct node *build_root_node(struct node *dt, char *name)
745+{
746+ struct node *an;
747+
748+ an = get_subnode(dt, name);
749+ if (!an)
750+ an = build_and_name_child_node(dt, name);
751+
752+ if (!an)
753+ die("Could not build root node /%s\n", name);
754+
755+ return an;
756+}
757+
758+static bool any_label_tree(struct dt_info *dti, struct node *node)
759+{
760+ struct node *c;
761+
762+ if (node->labels)
763+ return true;
764+
765+ for_each_child(node, c)
766+ if (any_label_tree(dti, c))
767+ return true;
768+
769+ return false;
770+}
771+
772+static void generate_label_tree_internal(struct dt_info *dti,
773+ struct node *an, struct node *node,
774+ bool allocph)
775+{
776+ struct node *dt = dti->dt;
777+ struct node *c;
778+ struct property *p;
779+ struct label *l;
780+
781+ /* if there are labels */
782+ if (node->labels) {
783+
784+ /* now add the label in the node */
785+ for_each_label(node->labels, l) {
786+
787+ /* check whether the label already exists */
788+ p = get_property(an, l->label);
789+ if (p) {
790+ fprintf(stderr, "WARNING: label %s already"
791+ " exists in /%s", l->label,
792+ an->name);
793+ continue;
794+ }
795+
796+ /* insert it */
797+ p = build_property(l->label,
798+ data_copy_mem(node->fullpath,
799+ strlen(node->fullpath) + 1));
800+ add_property(an, p);
801+ }
802+
803+ /* force allocation of a phandle for this node */
804+ if (allocph)
805+ (void)get_node_phandle(dt, node);
806+ }
807+
808+ for_each_child(node, c)
809+ generate_label_tree_internal(dti, an, c, allocph);
810+}
811+
812+static bool any_fixup_tree(struct dt_info *dti, struct node *node)
813+{
814+ struct node *c;
815+ struct property *prop;
816+ struct marker *m;
817+
818+ for_each_property(node, prop) {
819+ m = prop->val.markers;
820+ for_each_marker_of_type(m, REF_PHANDLE) {
821+ if (!get_node_by_ref(dti->dt, m->ref))
822+ return true;
823+ }
824+ }
825+
826+ for_each_child(node, c) {
827+ if (any_fixup_tree(dti, c))
828+ return true;
829+ }
830+
831+ return false;
832+}
833+
834+static void add_fixup_entry(struct dt_info *dti, struct node *fn,
835+ struct node *node, struct property *prop,
836+ struct marker *m)
708837 {
709− sort_reserve_entries(bi);
710− sort_node(bi->dt);
838+ char *entry;
839+
840+ /* m->ref can only be a REF_PHANDLE, but check anyway */
841+ assert(m->type == REF_PHANDLE);
842+
843+ /* there shouldn't be any ':' in the arguments */
844+ if (strchr(node->fullpath, ':') || strchr(prop->name, ':'))
845+ die("arguments should not contain ':'\n");
846+
847+ xasprintf(&entry, "%s:%s:%u",
848+ node->fullpath, prop->name, m->offset);
849+ append_to_property(fn, m->ref, entry, strlen(entry) + 1);
850+}
851+
852+static void generate_fixups_tree_internal(struct dt_info *dti,
853+ struct node *fn,
854+ struct node *node)
855+{
856+ struct node *dt = dti->dt;
857+ struct node *c;
858+ struct property *prop;
859+ struct marker *m;
860+ struct node *refnode;
861+
862+ for_each_property(node, prop) {
863+ m = prop->val.markers;
864+ for_each_marker_of_type(m, REF_PHANDLE) {
865+ refnode = get_node_by_ref(dt, m->ref);
866+ if (!refnode)
867+ add_fixup_entry(dti, fn, node, prop, m);
868+ }
869+ }
870+
871+ for_each_child(node, c)
872+ generate_fixups_tree_internal(dti, fn, c);
873+}
874+
875+static bool any_local_fixup_tree(struct dt_info *dti, struct node *node)
876+{
877+ struct node *c;
878+ struct property *prop;
879+ struct marker *m;
880+
881+ for_each_property(node, prop) {
882+ m = prop->val.markers;
883+ for_each_marker_of_type(m, REF_PHANDLE) {
884+ if (get_node_by_ref(dti->dt, m->ref))
885+ return true;
886+ }
887+ }
888+
889+ for_each_child(node, c) {
890+ if (any_local_fixup_tree(dti, c))
891+ return true;
892+ }
893+
894+ return false;
895+}
896+
897+static void add_local_fixup_entry(struct dt_info *dti,
898+ struct node *lfn, struct node *node,
899+ struct property *prop, struct marker *m,
900+ struct node *refnode)
901+{
902+ struct node *wn, *nwn; /* local fixup node, walk node, new */
903+ uint32_t value_32;
904+ char **compp;
905+ int i, depth;
906+
907+ /* walk back retreiving depth */
908+ depth = 0;
909+ for (wn = node; wn; wn = wn->parent)
910+ depth++;
911+
912+ /* allocate name array */
913+ compp = xmalloc(sizeof(*compp) * depth);
914+
915+ /* store names in the array */
916+ for (wn = node, i = depth - 1; wn; wn = wn->parent, i--)
917+ compp[i] = wn->name;
918+
919+ /* walk the path components creating nodes if they don't exist */
920+ for (wn = lfn, i = 1; i < depth; i++, wn = nwn) {
921+ /* if no node exists, create it */
922+ nwn = get_subnode(wn, compp[i]);
923+ if (!nwn)
924+ nwn = build_and_name_child_node(wn, compp[i]);
925+ }
926+
927+ free(compp);
928+
929+ value_32 = cpu_to_fdt32(m->offset);
930+ append_to_property(wn, prop->name, &value_32, sizeof(value_32));
931+}
932+
933+static void generate_local_fixups_tree_internal(struct dt_info *dti,
934+ struct node *lfn,
935+ struct node *node)
936+{
937+ struct node *dt = dti->dt;
938+ struct node *c;
939+ struct property *prop;
940+ struct marker *m;
941+ struct node *refnode;
942+
943+ for_each_property(node, prop) {
944+ m = prop->val.markers;
945+ for_each_marker_of_type(m, REF_PHANDLE) {
946+ refnode = get_node_by_ref(dt, m->ref);
947+ if (refnode)
948+ add_local_fixup_entry(dti, lfn, node, prop, m, refnode);
949+ }
950+ }
951+
952+ for_each_child(node, c)
953+ generate_local_fixups_tree_internal(dti, lfn, c);
954+}
955+
956+void generate_label_tree(struct dt_info *dti, char *name, bool allocph)
957+{
958+ if (!any_label_tree(dti, dti->dt))
959+ return;
960+ generate_label_tree_internal(dti, build_root_node(dti->dt, name),
961+ dti->dt, allocph);
962+}
963+
964+void generate_fixups_tree(struct dt_info *dti, char *name)
965+{
966+ if (!any_fixup_tree(dti, dti->dt))
967+ return;
968+ generate_fixups_tree_internal(dti, build_root_node(dti->dt, name),
969+ dti->dt);
970+}
971+
972+void generate_local_fixups_tree(struct dt_info *dti, char *name)
973+{
974+ if (!any_local_fixup_tree(dti, dti->dt))
975+ return;
976+ generate_local_fixups_tree_internal(dti, build_root_node(dti->dt, name),
977+ dti->dt);
711978 }
scripts/dtc/srcpos.c+8−27
@@ -246,46 +246,27 @@ srcpos_copy(struct srcpos *pos) · 245 unmodified lines
246246 return pos_new;
247247 }
248248
249−
250−
251−void
252−srcpos_dump(struct srcpos *pos)
253−{
254− printf("file : \"%s\"\n",
255− pos->file ? (char *) pos->file : "<no file>");
256− printf("first_line : %d\n", pos->first_line);
257− printf("first_column: %d\n", pos->first_column);
258− printf("last_line : %d\n", pos->last_line);
259− printf("last_column : %d\n", pos->last_column);
260− printf("file : %s\n", pos->file->name);
261−}
262−
263−
264249 char *
265250 srcpos_string(struct srcpos *pos)
266251 {
267252 const char *fname = "<no-file>";
268253 char *pos_str;
269− int rc;
270254
271255 if (pos)
272256 fname = pos->file->name;
273257
274258
275259 if (pos->first_line != pos->last_line)
276− rc = asprintf(&pos_str, "%s:%d.%d-%d.%d", fname,
277− pos->first_line, pos->first_column,
278− pos->last_line, pos->last_column);
260+ xasprintf(&pos_str, "%s:%d.%d-%d.%d", fname,
261+ pos->first_line, pos->first_column,
262+ pos->last_line, pos->last_column);
279263 else if (pos->first_column != pos->last_column)
280− rc = asprintf(&pos_str, "%s:%d.%d-%d", fname,
281− pos->first_line, pos->first_column,
282− pos->last_column);
264+ xasprintf(&pos_str, "%s:%d.%d-%d", fname,
265+ pos->first_line, pos->first_column,
266+ pos->last_column);
283267 else
284− rc = asprintf(&pos_str, "%s:%d.%d", fname,
285− pos->first_line, pos->first_column);
286−
287− if (rc == -1)
288− die("Couldn't allocate in srcpos string");
268+ xasprintf(&pos_str, "%s:%d.%d", fname,
269+ pos->first_line, pos->first_column);
289270
290271 return pos_str;
291272 }
scripts/dtc/srcpos.h+0−1
@@ -105,7 +105,6 @@ extern struct srcpos srcpos_empty; · 104 unmodified lines
105105 extern void srcpos_update(struct srcpos *pos, const char *text, int len);
106106 extern struct srcpos *srcpos_copy(struct srcpos *pos);
107107 extern char *srcpos_string(struct srcpos *pos);
108−extern void srcpos_dump(struct srcpos *pos);
109108
110109 extern void srcpos_verror(struct srcpos *pos, const char *prefix,
111110 const char *fmt, va_list va)
scripts/dtc/treesource.c+7−7
@@ -25,12 +25,12 @@ extern FILE *yyin; · 24 unmodified lines
2525 extern int yyparse(void);
2626 extern YYLTYPE yylloc;
2727
28−struct boot_info *the_boot_info;
28+struct dt_info *parser_output;
2929 bool treesource_error;
3030
31−struct boot_info *dt_from_source(const char *fname)
31+struct dt_info *dt_from_source(const char *fname)
3232 {
33− the_boot_info = NULL;
33+ parser_output = NULL;
3434 treesource_error = false;
3535
3636 srcfile_push(fname);
@@ -43,7 +43,7 @@ struct boot_info *dt_from_source(const char *fname) · 6 unmodified lines
4343 if (treesource_error)
4444 die("Syntax error parsing input tree\n");
4545
46− return the_boot_info;
46+ return parser_output;
4747 }
4848
4949 static void write_prefix(FILE *f, int level)
@@ -263,13 +263,13 @@ static void write_tree_source_node(FILE *f, struct node *tree, int level) · 213 unmodified lines
263263 }
264264
265265
266−void dt_to_source(FILE *f, struct boot_info *bi)
266+void dt_to_source(FILE *f, struct dt_info *dti)
267267 {
268268 struct reserve_info *re;
269269
270270 fprintf(f, "/dts-v1/;\n\n");
271271
272− for (re = bi->reservelist; re; re = re->next) {
272+ for (re = dti->reservelist; re; re = re->next) {
273273 struct label *l;
274274
275275 for_each_label(re->labels, l)
@@ -279,6 +279,6 @@ void dt_to_source(FILE *f, struct boot_info *bi) · 3 unmodified lines
279279 (unsigned long long)re->re.size);
280280 }
281281
282− write_tree_source_node(f, bi->dt, 0);
282+ write_tree_source_node(f, dti->dt, 0);
283283 }
284284
scripts/dtc/util.c+30−0
@@ -46,6 +46,36 @@ char *xstrdup(const char *s) · 45 unmodified lines
4646 return d;
4747 }
4848
49+/* based in part from (3) vsnprintf */
50+int xasprintf(char **strp, const char *fmt, ...)
51+{
52+ int n, size = 128; /* start with 128 bytes */
53+ char *p;
54+ va_list ap;
55+
56+ /* initial pointer is NULL making the fist realloc to be malloc */
57+ p = NULL;
58+ while (1) {
59+ p = xrealloc(p, size);
60+
61+ /* Try to print in the allocated space. */
62+ va_start(ap, fmt);
63+ n = vsnprintf(p, size, fmt, ap);
64+ va_end(ap);
65+
66+ /* If that worked, return the string. */
67+ if (n > -1 && n < size)
68+ break;
69+ /* Else try again with more space. */
70+ if (n > -1) /* glibc 2.1 */
71+ size = n + 1; /* precisely what is needed */
72+ else /* glibc 2.0 */
73+ size *= 2; /* twice the old size */
74+ }
75+ *strp = p;
76+ return strlen(p);
77+}
78+
4979 char *join_path(const char *path, const char *name)
5080 {
5181 int lenp = strlen(path);
scripts/dtc/util.h+1−0
@@ -59,6 +59,7 @@ static inline void *xrealloc(void *p, size_t len) · 58 unmodified lines
5959 }
6060
6161 extern char *xstrdup(const char *s);
62+extern int xasprintf(char **strp, const char *fmt, ...);
6263 extern char *join_path(const char *path, const char *name);
6364
6465 /**
scripts/dtc/version_gen.h+1−1
@@ -1 +1 @@
1−#define DTC_VERSION "DTC 1.4.1-g53bf130b"
1+#define DTC_VERSION "DTC 1.4.2-g0931cea3"