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
Unified · Split
| @@ -40,16 +40,11 @@ enum checkstatus { · 39 unmodified lines | ||
| 40 | 40 | |
| 41 | 41 | struct check; |
| 42 | 42 | |
| 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); | |
| 47 | 44 | |
| 48 | 45 | struct check { |
| 49 | 46 | 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; | |
| 53 | 48 | void *data; |
| 54 | 49 | bool warn, error; |
| 55 | 50 | enum checkstatus status; |
| @@ -58,45 +53,24 @@ struct check { · 2 unmodified lines | ||
| 58 | 53 | struct check **prereq; |
| 59 | 54 | }; |
| 60 | 55 | |
| 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), \ | |
| 71 | 64 | .status = UNCHECKED, \ |
| 72 | − .num_prereqs = ARRAY_SIZE(nm##_prereqs), \ | |
| 73 | − .prereq = nm##_prereqs, \ | |
| 65 | + .num_prereqs = ARRAY_SIZE(_nm##_prereqs), \ | |
| 66 | + .prereq = _nm##_prereqs, \ | |
| 74 | 67 | }; |
| 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__) | |
| 100 | 74 | |
| 101 | 75 | #ifdef __GNUC__ |
| 102 | 76 | 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 | ||
| 123 | 97 | check_msg((c), __VA_ARGS__); \ |
| 124 | 98 | } while (0) |
| 125 | 99 | |
| 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) | |
| 127 | 101 | { |
| 128 | 102 | struct node *child; |
| 129 | − struct property *prop; | |
| 130 | 103 | |
| 131 | 104 | 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); | |
| 140 | 107 | |
| 141 | 108 | for_each_child(node, child) |
| 142 | − check_nodes_props(c, dt, child); | |
| 109 | + check_nodes_props(c, dti, child); | |
| 143 | 110 | } |
| 144 | 111 | |
| 145 | −static bool run_check(struct check *c, struct node *dt) | |
| 112 | +static bool run_check(struct check *c, struct dt_info *dti) | |
| 146 | 113 | { |
| 114 | + struct node *dt = dti->dt; | |
| 147 | 115 | bool error = false; |
| 148 | 116 | int i; |
| 149 | 117 | |
| @@ -156,7 +124,7 @@ static bool run_check(struct check *c, struct node *dt) · 6 unmodified lines | ||
| 156 | 124 | |
| 157 | 125 | for (i = 0; i < c->num_prereqs; i++) { |
| 158 | 126 | struct check *prq = c->prereq[i]; |
| 159 | − error = error || run_check(prq, dt); | |
| 127 | + error = error || run_check(prq, dti); | |
| 160 | 128 | if (prq->status != PASSED) { |
| 161 | 129 | c->status = PREREQ; |
| 162 | 130 | check_msg(c, "Failed prerequisite '%s'", |
| @@ -167,11 +135,8 @@ static bool run_check(struct check *c, struct node *dt) · 4 unmodified lines | ||
| 167 | 135 | if (c->status != UNCHECKED) |
| 168 | 136 | goto out; |
| 169 | 137 | |
| 170 | − if (c->node_fn || c->prop_fn) | |
| 171 | − check_nodes_props(c, dt, dt); | |
| 138 | + check_nodes_props(c, dti, dt); | |
| 172 | 139 | |
| 173 | − if (c->tree_fn) | |
| 174 | − c->tree_fn(c, dt); | |
| 175 | 140 | if (c->status == UNCHECKED) |
| 176 | 141 | c->status = PASSED; |
| 177 | 142 | |
| @@ -189,13 +154,14 @@ out: · 11 unmodified lines | ||
| 189 | 154 | */ |
| 190 | 155 | |
| 191 | 156 | /* 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) | |
| 193 | 159 | { |
| 194 | 160 | FAIL(c, "always_fail check"); |
| 195 | 161 | } |
| 196 | −TREE_CHECK(always_fail, NULL); | |
| 162 | +CHECK(always_fail, check_always_fail, NULL); | |
| 197 | 163 | |
| 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, | |
| 199 | 165 | struct node *node) |
| 200 | 166 | { |
| 201 | 167 | struct property *prop; |
| @@ -210,11 +176,11 @@ static void check_is_string(struct check *c, struct node *root, · 8 unmodified lines | ||
| 210 | 176 | propname, node->fullpath); |
| 211 | 177 | } |
| 212 | 178 | #define WARNING_IF_NOT_STRING(nm, propname) \ |
| 213 | − WARNING(nm, NULL, check_is_string, NULL, (propname)) | |
| 179 | + WARNING(nm, check_is_string, (propname)) | |
| 214 | 180 | #define ERROR_IF_NOT_STRING(nm, propname) \ |
| 215 | − ERROR(nm, NULL, check_is_string, NULL, (propname)) | |
| 181 | + ERROR(nm, check_is_string, (propname)) | |
| 216 | 182 | |
| 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, | |
| 218 | 184 | struct node *node) |
| 219 | 185 | { |
| 220 | 186 | struct property *prop; |
| @@ -229,15 +195,15 @@ static void check_is_cell(struct check *c, struct node *root, · 8 unmodified lines | ||
| 229 | 195 | propname, node->fullpath); |
| 230 | 196 | } |
| 231 | 197 | #define WARNING_IF_NOT_CELL(nm, propname) \ |
| 232 | − WARNING(nm, NULL, check_is_cell, NULL, (propname)) | |
| 198 | + WARNING(nm, check_is_cell, (propname)) | |
| 233 | 199 | #define ERROR_IF_NOT_CELL(nm, propname) \ |
| 234 | − ERROR(nm, NULL, check_is_cell, NULL, (propname)) | |
| 200 | + ERROR(nm, check_is_cell, (propname)) | |
| 235 | 201 | |
| 236 | 202 | /* |
| 237 | 203 | * Structural check functions |
| 238 | 204 | */ |
| 239 | 205 | |
| 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, | |
| 241 | 207 | struct node *node) |
| 242 | 208 | { |
| 243 | 209 | struct node *child, *child2; |
| @@ -250,9 +216,9 @@ static void check_duplicate_node_names(struct check *c, struct node *dt, · 6 unmodified lines | ||
| 250 | 216 | FAIL(c, "Duplicate node name %s", |
| 251 | 217 | child->fullpath); |
| 252 | 218 | } |
| 253 | −NODE_ERROR(duplicate_node_names, NULL); | |
| 219 | +ERROR(duplicate_node_names, check_duplicate_node_names, NULL); | |
| 254 | 220 | |
| 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, | |
| 256 | 222 | struct node *node) |
| 257 | 223 | { |
| 258 | 224 | struct property *prop, *prop2; |
| @@ -267,14 +233,14 @@ static void check_duplicate_property_names(struct check *c, struct node *dt, · 8 unmodified lines | ||
| 267 | 233 | } |
| 268 | 234 | } |
| 269 | 235 | } |
| 270 | −NODE_ERROR(duplicate_property_names, NULL); | |
| 236 | +ERROR(duplicate_property_names, check_duplicate_property_names, NULL); | |
| 271 | 237 | |
| 272 | 238 | #define LOWERCASE "abcdefghijklmnopqrstuvwxyz" |
| 273 | 239 | #define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 274 | 240 | #define DIGITS "0123456789" |
| 275 | 241 | #define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-" |
| 276 | 242 | |
| 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, | |
| 278 | 244 | struct node *node) |
| 279 | 245 | { |
| 280 | 246 | 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 | ||
| 283 | 249 | FAIL(c, "Bad character '%c' in node %s", |
| 284 | 250 | node->name[n], node->fullpath); |
| 285 | 251 | } |
| 286 | −NODE_ERROR(node_name_chars, PROPNODECHARS "@"); | |
| 252 | +ERROR(node_name_chars, check_node_name_chars, PROPNODECHARS "@"); | |
| 287 | 253 | |
| 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, | |
| 289 | 255 | struct node *node) |
| 290 | 256 | { |
| 291 | 257 | if (strchr(get_unitname(node), '@')) |
| 292 | 258 | FAIL(c, "Node %s has multiple '@' characters in name", |
| 293 | 259 | node->fullpath); |
| 294 | 260 | } |
| 295 | −NODE_ERROR(node_name_format, NULL, &node_name_chars); | |
| 261 | +ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars); | |
| 296 | 262 | |
| 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) | |
| 299 | 265 | { |
| 300 | 266 | const char *unitname = get_unitname(node); |
| 301 | 267 | 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 | ||
| 316 | 282 | node->fullpath); |
| 317 | 283 | } |
| 318 | 284 | } |
| 319 | −NODE_WARNING(unit_address_vs_reg, NULL); | |
| 285 | +WARNING(unit_address_vs_reg, check_unit_address_vs_reg, NULL); | |
| 320 | 286 | |
| 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) | |
| 323 | 289 | { |
| 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); | |
| 325 | 294 | |
| 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 | + } | |
| 329 | 299 | } |
| 330 | −PROP_ERROR(property_name_chars, PROPNODECHARS); | |
| 300 | +ERROR(property_name_chars, check_property_name_chars, PROPNODECHARS); | |
| 331 | 301 | |
| 332 | 302 | #define DESCLABEL_FMT "%s%s%s%s%s" |
| 333 | 303 | #define DESCLABEL_ARGS(node,prop,mark) \ |
| @@ -336,10 +306,11 @@ PROP_ERROR(property_name_chars, PROPNODECHARS); · 2 unmodified lines | ||
| 336 | 306 | ((prop) ? (prop)->name : ""), \ |
| 337 | 307 | ((prop) ? "' in " : ""), (node)->fullpath |
| 338 | 308 | |
| 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, | |
| 340 | 310 | const char *label, struct node *node, |
| 341 | 311 | struct property *prop, struct marker *mark) |
| 342 | 312 | { |
| 313 | + struct node *dt = dti->dt; | |
| 343 | 314 | struct node *othernode = NULL; |
| 344 | 315 | struct property *otherprop = NULL; |
| 345 | 316 | struct marker *othermark = NULL; |
| @@ -362,44 +333,43 @@ static void check_duplicate_label(struct check *c, struct node *dt, · 16 unmodified lines | ||
| 362 | 333 | DESCLABEL_ARGS(othernode, otherprop, othermark)); |
| 363 | 334 | } |
| 364 | 335 | |
| 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, | |
| 366 | 337 | struct node *node) |
| 367 | 338 | { |
| 368 | 339 | struct label *l; |
| 340 | + struct property *prop; | |
| 369 | 341 | |
| 370 | 342 | 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; | |
| 378 | 347 | |
| 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); | |
| 381 | 350 | |
| 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 | + } | |
| 384 | 354 | } |
| 385 | −ERROR(duplicate_label, NULL, check_duplicate_label_node, | |
| 386 | − check_duplicate_label_prop, NULL); | |
| 355 | +ERROR(duplicate_label, check_duplicate_label_node, NULL); | |
| 387 | 356 | |
| 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) | |
| 390 | 359 | { |
| 360 | + struct node *root = dti->dt; | |
| 361 | + struct property *prop; | |
| 391 | 362 | struct marker *m; |
| 392 | − struct node *other; | |
| 393 | 363 | cell_t phandle; |
| 394 | 364 | |
| 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; | |
| 398 | 368 | |
| 399 | 369 | if (prop->val.len != sizeof(cell_t)) { |
| 400 | 370 | FAIL(c, "%s has bad length (%d) %s property", |
| 401 | 371 | node->fullpath, prop->val.len, prop->name); |
| 402 | − return; | |
| 372 | + return 0; | |
| 403 | 373 | } |
| 404 | 374 | |
| 405 | 375 | m = prop->val.markers; |
| @@ -411,14 +381,13 @@ static void check_explicit_phandles(struct check *c, struct node *root, · 5 unmodified lines | ||
| 411 | 381 | * by construction. */ { |
| 412 | 382 | FAIL(c, "%s in %s is a reference to another node", |
| 413 | 383 | prop->name, node->fullpath); |
| 414 | − return; | |
| 415 | 384 | } |
| 416 | 385 | /* But setting this node's phandle equal to its own |
| 417 | 386 | * phandle is allowed - that means allocate a unique |
| 418 | 387 | * phandle for this node, even if it's not otherwise |
| 419 | 388 | * 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; | |
| 422 | 391 | } |
| 423 | 392 | |
| 424 | 393 | phandle = propval_cell(prop); |
| @@ -426,12 +395,36 @@ static void check_explicit_phandles(struct check *c, struct node *root, · 1 unmodified line | ||
| 426 | 395 | if ((phandle == 0) || (phandle == -1)) { |
| 427 | 396 | FAIL(c, "%s has bad value (0x%x) in %s property", |
| 428 | 397 | node->fullpath, phandle, prop->name); |
| 429 | − return; | |
| 398 | + return 0; | |
| 430 | 399 | } |
| 431 | 400 | |
| 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; | |
| 435 | 428 | |
| 436 | 429 | other = get_node_by_phandle(root, phandle); |
| 437 | 430 | if (other && (other != node)) { |
| @@ -442,9 +435,9 @@ static void check_explicit_phandles(struct check *c, struct node *root, · 4 unmodified lines | ||
| 442 | 435 | |
| 443 | 436 | node->phandle = phandle; |
| 444 | 437 | } |
| 445 | −PROP_ERROR(explicit_phandles, NULL); | |
| 438 | +ERROR(explicit_phandles, check_explicit_phandles, NULL); | |
| 446 | 439 | |
| 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, | |
| 448 | 441 | struct node *node) |
| 449 | 442 | { |
| 450 | 443 | struct property **pp, *prop = NULL; |
| @@ -472,60 +465,73 @@ static void check_name_properties(struct check *c, struct node *root, · 21 unmodified lines | ||
| 472 | 465 | } |
| 473 | 466 | } |
| 474 | 467 | 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); | |
| 476 | 469 | |
| 477 | 470 | /* |
| 478 | 471 | * Reference fixup functions |
| 479 | 472 | */ |
| 480 | 473 | |
| 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) | |
| 483 | 476 | { |
| 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; | |
| 487 | 479 | |
| 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 | + } | |
| 490 | 498 | |
| 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); | |
| 496 | 501 | } |
| 497 | − | |
| 498 | − phandle = get_node_phandle(dt, refnode); | |
| 499 | − *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); | |
| 500 | 502 | } |
| 501 | 503 | } |
| 502 | −ERROR(phandle_references, NULL, NULL, fixup_phandle_references, NULL, | |
| 504 | +ERROR(phandle_references, fixup_phandle_references, NULL, | |
| 503 | 505 | &duplicate_node_names, &explicit_phandles); |
| 504 | 506 | |
| 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) | |
| 507 | 509 | { |
| 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); | |
| 521 | 520 | |
| 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 | + } | |
| 525 | 532 | } |
| 526 | 533 | } |
| 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); | |
| 529 | 535 | |
| 530 | 536 | /* |
| 531 | 537 | * Semantic checks |
| @@ -538,7 +544,7 @@ WARNING_IF_NOT_STRING(device_type_is_string, "device_type"); · 6 unmodified lines | ||
| 538 | 544 | WARNING_IF_NOT_STRING(model_is_string, "model"); |
| 539 | 545 | WARNING_IF_NOT_STRING(status_is_string, "status"); |
| 540 | 546 | |
| 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, | |
| 542 | 548 | struct node *node) |
| 543 | 549 | { |
| 544 | 550 | struct property *prop; |
| @@ -554,7 +560,7 @@ static void fixup_addr_size_cells(struct check *c, struct node *dt, · 9 unmodified lines | ||
| 554 | 560 | if (prop) |
| 555 | 561 | node->size_cells = propval_cell(prop); |
| 556 | 562 | } |
| 557 | −WARNING(addr_size_cells, NULL, fixup_addr_size_cells, NULL, NULL, | |
| 563 | +WARNING(addr_size_cells, fixup_addr_size_cells, NULL, | |
| 558 | 564 | &address_cells_is_cell, &size_cells_is_cell); |
| 559 | 565 | |
| 560 | 566 | #define node_addr_cells(n) \ |
| @@ -562,7 +568,7 @@ WARNING(addr_size_cells, NULL, fixup_addr_size_cells, NULL, NULL, · 1 unmodified line | ||
| 562 | 568 | #define node_size_cells(n) \ |
| 563 | 569 | (((n)->size_cells == -1) ? 1 : (n)->size_cells) |
| 564 | 570 | |
| 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, | |
| 566 | 572 | struct node *node) |
| 567 | 573 | { |
| 568 | 574 | struct property *prop; |
| @@ -589,9 +595,9 @@ static void check_reg_format(struct check *c, struct node *dt, · 20 unmodified lines | ||
| 589 | 595 | "(#address-cells == %d, #size-cells == %d)", |
| 590 | 596 | node->fullpath, prop->val.len, addr_cells, size_cells); |
| 591 | 597 | } |
| 592 | −NODE_WARNING(reg_format, NULL, &addr_size_cells); | |
| 598 | +WARNING(reg_format, check_reg_format, NULL, &addr_size_cells); | |
| 593 | 599 | |
| 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, | |
| 595 | 601 | struct node *node) |
| 596 | 602 | { |
| 597 | 603 | struct property *prop; |
| @@ -630,12 +636,12 @@ static void check_ranges_format(struct check *c, struct node *dt, · 32 unmodified lines | ||
| 630 | 636 | p_addr_cells, c_addr_cells, c_size_cells); |
| 631 | 637 | } |
| 632 | 638 | } |
| 633 | −NODE_WARNING(ranges_format, NULL, &addr_size_cells); | |
| 639 | +WARNING(ranges_format, check_ranges_format, NULL, &addr_size_cells); | |
| 634 | 640 | |
| 635 | 641 | /* |
| 636 | 642 | * Style checks |
| 637 | 643 | */ |
| 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, | |
| 639 | 645 | struct node *node) |
| 640 | 646 | { |
| 641 | 647 | struct property *reg, *ranges; |
| @@ -657,14 +663,21 @@ static void check_avoid_default_addr_size(struct check *c, struct node *dt, · 15 unmodified lines | ||
| 657 | 663 | FAIL(c, "Relying on default #size-cells value for %s", |
| 658 | 664 | node->fullpath); |
| 659 | 665 | } |
| 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); | |
| 661 | 668 | |
| 662 | 669 | static void check_obsolete_chosen_interrupt_controller(struct check *c, |
| 663 | − struct node *dt) | |
| 670 | + struct dt_info *dti, | |
| 671 | + struct node *node) | |
| 664 | 672 | { |
| 673 | + struct node *dt = dti->dt; | |
| 665 | 674 | struct node *chosen; |
| 666 | 675 | struct property *prop; |
| 667 | 676 | |
| 677 | + if (node != dt) | |
| 678 | + return; | |
| 679 | + | |
| 680 | + | |
| 668 | 681 | chosen = get_node_by_path(dt, "/chosen"); |
| 669 | 682 | if (!chosen) |
| 670 | 683 | return; |
| @@ -674,7 +687,8 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, · 3 unmodified lines | ||
| 674 | 687 | FAIL(c, "/chosen has obsolete \"interrupt-controller\" " |
| 675 | 688 | "property"); |
| 676 | 689 | } |
| 677 | −TREE_WARNING(obsolete_chosen_interrupt_controller, NULL); | |
| 690 | +WARNING(obsolete_chosen_interrupt_controller, | |
| 691 | + check_obsolete_chosen_interrupt_controller, NULL); | |
| 678 | 692 | |
| 679 | 693 | static struct check *check_table[] = { |
| 680 | 694 | &duplicate_node_names, &duplicate_property_names, |
| @@ -760,9 +774,8 @@ void parse_checks_option(bool warn, bool error, const char *arg) · 79 unmodified lines | ||
| 760 | 774 | die("Unrecognized check name \"%s\"\n", name); |
| 761 | 775 | } |
| 762 | 776 | |
| 763 | −void process_checks(bool force, struct boot_info *bi) | |
| 777 | +void process_checks(bool force, struct dt_info *dti) | |
| 764 | 778 | { |
| 765 | − struct node *dt = bi->dt; | |
| 766 | 779 | int i; |
| 767 | 780 | int error = 0; |
| 768 | 781 | |
| @@ -770,7 +783,7 @@ void process_checks(bool force, struct boot_info *bi) · 1 unmodified line | ||
| 770 | 783 | struct check *c = check_table[i]; |
| 771 | 784 | |
| 772 | 785 | if (c->warn || c->error) |
| 773 | − error = error || run_check(c, dt); | |
| 786 | + error = error || run_check(c, dti); | |
| 774 | 787 | } |
| 775 | 788 | |
| 776 | 789 | if (error) { |
| @@ -121,6 +121,11 @@ static void lexical_error(const char *fmt, ...); · 120 unmodified lines | ||
| 121 | 121 | return DT_V1; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | +<*>"/plugin/" { | |
| 125 | + DPRINT("Keyword: /plugin/\n"); | |
| 126 | + return DT_PLUGIN; | |
| 127 | + } | |
| 128 | + | |
| 124 | 129 | <*>"/memreserve/" { |
| 125 | 130 | DPRINT("Keyword: /memreserve/\n"); |
| 126 | 131 | BEGIN_DEFAULT(); |
| @@ -184,16 +189,16 @@ static void lexical_error(const char *fmt, ...); · 57 unmodified lines | ||
| 184 | 189 | if (d.len == 1) { |
| 185 | 190 | lexical_error("Empty character literal"); |
| 186 | 191 | yylval.integer = 0; |
| 187 | − return DT_CHAR_LITERAL; | |
| 188 | − } | |
| 192 | + } else { | |
| 193 | + yylval.integer = (unsigned char)d.val[0]; | |
| 189 | 194 | |
| 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 | + } | |
| 196 | 200 | |
| 201 | + data_free(d); | |
| 197 | 202 | return DT_CHAR_LITERAL; |
| 198 | 203 | } |
| 199 | 204 | |
| @@ -8,8 +8,8 @@ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | #define FLEX_SCANNER |
| 10 | 10 | #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 | |
| 13 | 13 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
| 14 | 14 | #define FLEX_BETA |
| 15 | 15 | #endif |
| @@ -88,25 +88,13 @@ typedef unsigned int flex_uint32_t; · 72 unmodified lines | ||
| 88 | 88 | |
| 89 | 89 | #endif /* ! FLEXINT_H */ |
| 90 | 90 | |
| 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 */ | |
| 107 | 92 | #define yyconst const |
| 93 | + | |
| 94 | +#if defined(__GNUC__) && __GNUC__ >= 3 | |
| 95 | +#define yynoreturn __attribute__((__noreturn__)) | |
| 108 | 96 | #else |
| 109 | −#define yyconst | |
| 97 | +#define yynoreturn | |
| 110 | 98 | #endif |
| 111 | 99 | |
| 112 | 100 | /* Returned upon end-of-file. */ |
| @@ -167,7 +155,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; · 54 unmodified lines | ||
| 167 | 155 | typedef size_t yy_size_t; |
| 168 | 156 | #endif |
| 169 | 157 | |
| 170 | −extern yy_size_t yyleng; | |
| 158 | +extern int yyleng; | |
| 171 | 159 | |
| 172 | 160 | extern FILE *yyin, *yyout; |
| 173 | 161 | |
| @@ -206,12 +194,12 @@ struct yy_buffer_state · 32 unmodified lines | ||
| 206 | 194 | /* Size of input buffer in bytes, not including room for EOB |
| 207 | 195 | * characters. |
| 208 | 196 | */ |
| 209 | − yy_size_t yy_buf_size; | |
| 197 | + int yy_buf_size; | |
| 210 | 198 | |
| 211 | 199 | /* Number of characters read into yy_ch_buf, not including EOB |
| 212 | 200 | * characters. |
| 213 | 201 | */ |
| 214 | − yy_size_t yy_n_chars; | |
| 202 | + int yy_n_chars; | |
| 215 | 203 | |
| 216 | 204 | /* Whether we "own" the buffer - i.e., we know we created it, |
| 217 | 205 | * and can realloc() it to grow it, and should free() it to |
| @@ -234,7 +222,7 @@ struct yy_buffer_state · 16 unmodified lines | ||
| 234 | 222 | |
| 235 | 223 | int yy_bs_lineno; /**< The line count. */ |
| 236 | 224 | int yy_bs_column; /**< The column count. */ |
| 237 | − | |
| 225 | + | |
| 238 | 226 | /* Whether to try to fill the input buffer when we reach the |
| 239 | 227 | * end of it. |
| 240 | 228 | */ |
| @@ -262,7 +250,7 @@ struct yy_buffer_state · 21 unmodified lines | ||
| 262 | 250 | /* Stack of input buffers. */ |
| 263 | 251 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ |
| 264 | 252 | 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. */ | |
| 266 | 254 | |
| 267 | 255 | /* We provide macros for accessing buffer states in case in the |
| 268 | 256 | * 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 | ||
| 281 | 269 | |
| 282 | 270 | /* yy_hold_char holds the character lost when yytext is formed. */ |
| 283 | 271 | 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; | |
| 286 | 274 | |
| 287 | 275 | /* Points to current character in buffer. */ |
| 288 | −static char *yy_c_buf_p = (char *) 0; | |
| 276 | +static char *yy_c_buf_p = NULL; | |
| 289 | 277 | static int yy_init = 0; /* whether we need to initialize */ |
| 290 | 278 | static int yy_start = 0; /* start state number */ |
| 291 | 279 | |
| @@ -310,7 +298,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); · 18 unmodified lines | ||
| 310 | 298 | |
| 311 | 299 | YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); |
| 312 | 300 | 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 ); | |
| 314 | 302 | |
| 315 | 303 | void *yyalloc (yy_size_t ); |
| 316 | 304 | void *yyrealloc (void *,yy_size_t ); |
| @@ -342,12 +330,12 @@ void yyfree (void * ); · 25 unmodified lines | ||
| 342 | 330 | |
| 343 | 331 | /* Begin user sect3 */ |
| 344 | 332 | |
| 345 | −#define yywrap() 1 | |
| 333 | +#define yywrap() (/*CONSTCOND*/1) | |
| 346 | 334 | #define YY_SKIP_YYWRAP |
| 347 | 335 | |
| 348 | 336 | typedef unsigned char YY_CHAR; |
| 349 | 337 | |
| 350 | −FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; | |
| 338 | +FILE *yyin = NULL, *yyout = NULL; | |
| 351 | 339 | |
| 352 | 340 | typedef int yy_state_type; |
| 353 | 341 | |
| @@ -356,25 +344,28 @@ extern int yylineno; · 2 unmodified lines | ||
| 356 | 344 | int yylineno = 1; |
| 357 | 345 | |
| 358 | 346 | extern char *yytext; |
| 347 | +#ifdef yytext_ptr | |
| 348 | +#undef yytext_ptr | |
| 349 | +#endif | |
| 359 | 350 | #define yytext_ptr yytext |
| 360 | 351 | |
| 361 | 352 | static yy_state_type yy_get_previous_state (void ); |
| 362 | 353 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); |
| 363 | 354 | 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 ); | |
| 365 | 356 | |
| 366 | 357 | /* Done after the current pattern has been matched and before the |
| 367 | 358 | * corresponding action - sets up yytext. |
| 368 | 359 | */ |
| 369 | 360 | #define YY_DO_BEFORE_ACTION \ |
| 370 | 361 | (yytext_ptr) = yy_bp; \ |
| 371 | − yyleng = (size_t) (yy_cp - yy_bp); \ | |
| 362 | + yyleng = (int) (yy_cp - yy_bp); \ | |
| 372 | 363 | (yy_hold_char) = *yy_cp; \ |
| 373 | 364 | *yy_cp = '\0'; \ |
| 374 | 365 | (yy_c_buf_p) = yy_cp; |
| 375 | 366 | |
| 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 | |
| 378 | 369 | /* This struct is not used in this scanner, |
| 379 | 370 | but its presence is necessary. */ |
| 380 | 371 | struct yy_trans_info |
| @@ -382,28 +373,29 @@ struct yy_trans_info · 1 unmodified line | ||
| 382 | 373 | flex_int32_t yy_verify; |
| 383 | 374 | flex_int32_t yy_nxt; |
| 384 | 375 | }; |
| 385 | −static yyconst flex_int16_t yy_accept[159] = | |
| 376 | +static yyconst flex_int16_t yy_accept[166] = | |
| 386 | 377 | { 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 | |
| 404 | 396 | } ; |
| 405 | 397 | |
| 406 | −static yyconst flex_int32_t yy_ec[256] = | |
| 398 | +static yyconst YY_CHAR yy_ec[256] = | |
| 407 | 399 | { 0, |
| 408 | 400 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
| 409 | 401 | 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 | ||
| 416 | 408 | 22, 22, 22, 22, 24, 22, 22, 25, 22, 22, |
| 417 | 409 | 1, 26, 27, 1, 22, 1, 21, 28, 29, 30, |
| 418 | 410 | |
| 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, | |
| 422 | 414 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 423 | 415 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 424 | 416 | 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 | ||
| 435 | 427 | 1, 1, 1, 1, 1 |
| 436 | 428 | } ; |
| 437 | 429 | |
| 438 | −static yyconst flex_int32_t yy_meta[47] = | |
| 430 | +static yyconst YY_CHAR yy_meta[48] = | |
| 439 | 431 | { 0, |
| 440 | 432 | 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, |
| 441 | 433 | 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, |
| 442 | 434 | 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, |
| 443 | 435 | 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 | |
| 445 | 437 | } ; |
| 446 | 438 | |
| 447 | −static yyconst flex_int16_t yy_base[173] = | |
| 439 | +static yyconst flex_uint16_t yy_base[180] = | |
| 448 | 440 | { 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 | |
| 468 | 460 | } ; |
| 469 | 461 | |
| 470 | −static yyconst flex_int16_t yy_def[173] = | |
| 462 | +static yyconst flex_int16_t yy_def[180] = | |
| 471 | 463 | { 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 | |
| 491 | 483 | } ; |
| 492 | 484 | |
| 493 | −static yyconst flex_int16_t yy_nxt[438] = | |
| 485 | +static yyconst flex_uint16_t yy_nxt[449] = | |
| 494 | 486 | { 0, |
| 495 | 487 | 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, |
| 496 | 488 | 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, |
| 497 | 489 | 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, |
| 498 | 490 | 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 | |
| 543 | 536 | } ; |
| 544 | 537 | |
| 545 | −static yyconst flex_int16_t yy_chk[438] = | |
| 538 | +static yyconst flex_int16_t yy_chk[449] = | |
| 546 | 539 | { 0, |
| 547 | 540 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 548 | 541 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 549 | 542 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 550 | 543 | 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, | |
| 554 | 547 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| 555 | 548 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| 556 | 549 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
| 557 | 550 | |
| 558 | 551 | 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, | |
| 588 | 582 | 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, |
| 589 | − 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, | |
| 590 | 583 | |
| 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 | |
| 595 | 589 | } ; |
| 596 | 590 | |
| 597 | 591 | static yy_state_type yy_last_accepting_state; |
| @@ -662,7 +656,7 @@ static int dts_version = 1; · 64 unmodified lines | ||
| 662 | 656 | static void push_input_file(const char *filename); |
| 663 | 657 | static bool pop_input_file(void); |
| 664 | 658 | static void lexical_error(const char *fmt, ...); |
| 665 | −#line 666 "dtc-lexer.lex.c" | |
| 659 | +#line 660 "dtc-lexer.lex.c" | |
| 666 | 660 | |
| 667 | 661 | #define INITIAL 0 |
| 668 | 662 | #define BYTESTRING 1 |
| @@ -698,19 +692,19 @@ void yyset_extra (YY_EXTRA_TYPE user_defined ); · 29 unmodified lines | ||
| 698 | 692 | |
| 699 | 693 | FILE *yyget_in (void ); |
| 700 | 694 | |
| 701 | −void yyset_in (FILE * in_str ); | |
| 695 | +void yyset_in (FILE * _in_str ); | |
| 702 | 696 | |
| 703 | 697 | FILE *yyget_out (void ); |
| 704 | 698 | |
| 705 | −void yyset_out (FILE * out_str ); | |
| 699 | +void yyset_out (FILE * _out_str ); | |
| 706 | 700 | |
| 707 | −yy_size_t yyget_leng (void ); | |
| 701 | + int yyget_leng (void ); | |
| 708 | 702 | |
| 709 | 703 | char *yyget_text (void ); |
| 710 | 704 | |
| 711 | 705 | int yyget_lineno (void ); |
| 712 | 706 | |
| 713 | −void yyset_lineno (int line_number ); | |
| 707 | +void yyset_lineno (int _line_number ); | |
| 714 | 708 | |
| 715 | 709 | /* Macros after this point can all be overridden by user definitions in |
| 716 | 710 | * section 1. |
| @@ -724,6 +718,10 @@ extern int yywrap (void ); · 7 unmodified lines | ||
| 724 | 718 | #endif |
| 725 | 719 | #endif |
| 726 | 720 | |
| 721 | +#ifndef YY_NO_UNPUT | |
| 722 | + | |
| 723 | +#endif | |
| 724 | + | |
| 727 | 725 | #ifndef yytext_ptr |
| 728 | 726 | static void yy_flex_strncpy (char *,yyconst char *,int ); |
| 729 | 727 | #endif |
| @@ -757,7 +755,7 @@ static int input (void ); · 27 unmodified lines | ||
| 757 | 755 | /* This used to be an fputs(), but since the string might contain NUL's, |
| 758 | 756 | * we now use fwrite(). |
| 759 | 757 | */ |
| 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) | |
| 761 | 759 | #endif |
| 762 | 760 | |
| 763 | 761 | /* 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 | ||
| 781 | 779 | else \ |
| 782 | 780 | { \ |
| 783 | 781 | 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)) \ | |
| 785 | 783 | { \ |
| 786 | 784 | if( errno != EINTR) \ |
| 787 | 785 | { \ |
| @@ -836,7 +834,7 @@ extern int yylex (void); · 48 unmodified lines | ||
| 836 | 834 | |
| 837 | 835 | /* Code executed at the end of each rule. */ |
| 838 | 836 | #ifndef YY_BREAK |
| 839 | −#define YY_BREAK break; | |
| 837 | +#define YY_BREAK /*LINTED*/break; | |
| 840 | 838 | #endif |
| 841 | 839 | |
| 842 | 840 | #define YY_RULE_SETUP \ |
| @@ -849,9 +847,9 @@ extern int yylex (void); · 6 unmodified lines | ||
| 849 | 847 | */ |
| 850 | 848 | YY_DECL |
| 851 | 849 | { |
| 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; | |
| 855 | 853 | |
| 856 | 854 | if ( !(yy_init) ) |
| 857 | 855 | { |
| @@ -882,9 +880,9 @@ YY_DECL · 24 unmodified lines | ||
| 882 | 880 | { |
| 883 | 881 | #line 68 "dtc-lexer.l" |
| 884 | 882 | |
| 885 | −#line 886 "dtc-lexer.lex.c" | |
| 883 | +#line 884 "dtc-lexer.lex.c" | |
| 886 | 884 | |
| 887 | − while ( 1 ) /* loops until end-of-file is reached */ | |
| 885 | + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ | |
| 888 | 886 | { |
| 889 | 887 | yy_cp = (yy_c_buf_p); |
| 890 | 888 | |
| @@ -901,7 +899,7 @@ YY_DECL · 10 unmodified lines | ||
| 901 | 899 | yy_match: |
| 902 | 900 | do |
| 903 | 901 | { |
| 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)] ; | |
| 905 | 903 | if ( yy_accept[yy_current_state] ) |
| 906 | 904 | { |
| 907 | 905 | (yy_last_accepting_state) = yy_current_state; |
| @@ -910,13 +908,13 @@ yy_match: · 2 unmodified lines | ||
| 910 | 908 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
| 911 | 909 | { |
| 912 | 910 | yy_current_state = (int) yy_def[yy_current_state]; |
| 913 | − if ( yy_current_state >= 159 ) | |
| 911 | + if ( yy_current_state >= 166 ) | |
| 914 | 912 | yy_c = yy_meta[(unsigned int) yy_c]; |
| 915 | 913 | } |
| 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]; | |
| 917 | 915 | ++yy_cp; |
| 918 | 916 | } |
| 919 | − while ( yy_current_state != 158 ); | |
| 917 | + while ( yy_current_state != 165 ); | |
| 920 | 918 | yy_cp = (yy_last_accepting_cpos); |
| 921 | 919 | yy_current_state = (yy_last_accepting_state); |
| 922 | 920 | |
| @@ -1014,24 +1012,32 @@ YY_RULE_SETUP · 91 unmodified lines | ||
| 1014 | 1012 | case 5: |
| 1015 | 1013 | YY_RULE_SETUP |
| 1016 | 1014 | #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" | |
| 1017 | 1023 | { |
| 1018 | 1024 | DPRINT("Keyword: /memreserve/\n"); |
| 1019 | 1025 | BEGIN_DEFAULT(); |
| 1020 | 1026 | return DT_MEMRESERVE; |
| 1021 | 1027 | } |
| 1022 | 1028 | YY_BREAK |
| 1023 | −case 6: | |
| 1029 | +case 7: | |
| 1024 | 1030 | YY_RULE_SETUP |
| 1025 | −#line 130 "dtc-lexer.l" | |
| 1031 | +#line 135 "dtc-lexer.l" | |
| 1026 | 1032 | { |
| 1027 | 1033 | DPRINT("Keyword: /bits/\n"); |
| 1028 | 1034 | BEGIN_DEFAULT(); |
| 1029 | 1035 | return DT_BITS; |
| 1030 | 1036 | } |
| 1031 | 1037 | YY_BREAK |
| 1032 | −case 7: | |
| 1038 | +case 8: | |
| 1033 | 1039 | YY_RULE_SETUP |
| 1034 | −#line 136 "dtc-lexer.l" | |
| 1040 | +#line 141 "dtc-lexer.l" | |
| 1035 | 1041 | { |
| 1036 | 1042 | DPRINT("Keyword: /delete-property/\n"); |
| 1037 | 1043 | DPRINT("<PROPNODENAME>\n"); |
| @@ -1039,9 +1045,9 @@ YY_RULE_SETUP · 1 unmodified line | ||
| 1039 | 1045 | return DT_DEL_PROP; |
| 1040 | 1046 | } |
| 1041 | 1047 | YY_BREAK |
| 1042 | −case 8: | |
| 1048 | +case 9: | |
| 1043 | 1049 | YY_RULE_SETUP |
| 1044 | −#line 143 "dtc-lexer.l" | |
| 1050 | +#line 148 "dtc-lexer.l" | |
| 1045 | 1051 | { |
| 1046 | 1052 | DPRINT("Keyword: /delete-node/\n"); |
| 1047 | 1053 | DPRINT("<PROPNODENAME>\n"); |
| @@ -1049,9 +1055,9 @@ YY_RULE_SETUP · 1 unmodified line | ||
| 1049 | 1055 | return DT_DEL_NODE; |
| 1050 | 1056 | } |
| 1051 | 1057 | YY_BREAK |
| 1052 | −case 9: | |
| 1058 | +case 10: | |
| 1053 | 1059 | YY_RULE_SETUP |
| 1054 | −#line 150 "dtc-lexer.l" | |
| 1060 | +#line 155 "dtc-lexer.l" | |
| 1055 | 1061 | { |
| 1056 | 1062 | DPRINT("Label: %s\n", yytext); |
| 1057 | 1063 | yylval.labelref = xstrdup(yytext); |
| @@ -1059,9 +1065,9 @@ YY_RULE_SETUP · 1 unmodified line | ||
| 1059 | 1065 | return DT_LABEL; |
| 1060 | 1066 | } |
| 1061 | 1067 | YY_BREAK |
| 1062 | −case 10: | |
| 1068 | +case 11: | |
| 1063 | 1069 | YY_RULE_SETUP |
| 1064 | −#line 157 "dtc-lexer.l" | |
| 1070 | +#line 162 "dtc-lexer.l" | |
| 1065 | 1071 | { |
| 1066 | 1072 | char *e; |
| 1067 | 1073 | DPRINT("Integer Literal: '%s'\n", yytext); |
| @@ -1084,10 +1090,10 @@ YY_RULE_SETUP · 16 unmodified lines | ||
| 1084 | 1090 | return DT_LITERAL; |
| 1085 | 1091 | } |
| 1086 | 1092 | YY_BREAK |
| 1087 | −case 11: | |
| 1088 | −/* rule 11 can match eol */ | |
| 1093 | +case 12: | |
| 1094 | +/* rule 12 can match eol */ | |
| 1089 | 1095 | YY_RULE_SETUP |
| 1090 | −#line 179 "dtc-lexer.l" | |
| 1096 | +#line 184 "dtc-lexer.l" | |
| 1091 | 1097 | { |
| 1092 | 1098 | struct data d; |
| 1093 | 1099 | DPRINT("Character literal: %s\n", yytext); |
| @@ -1096,31 +1102,31 @@ YY_RULE_SETUP · 2 unmodified lines | ||
| 1096 | 1102 | if (d.len == 1) { |
| 1097 | 1103 | lexical_error("Empty character literal"); |
| 1098 | 1104 | 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]; | |
| 1103 | 1107 | |
| 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 | + } | |
| 1108 | 1113 | |
| 1114 | + data_free(d); | |
| 1109 | 1115 | return DT_CHAR_LITERAL; |
| 1110 | 1116 | } |
| 1111 | 1117 | YY_BREAK |
| 1112 | −case 12: | |
| 1118 | +case 13: | |
| 1113 | 1119 | YY_RULE_SETUP |
| 1114 | −#line 200 "dtc-lexer.l" | |
| 1120 | +#line 205 "dtc-lexer.l" | |
| 1115 | 1121 | { /* label reference */ |
| 1116 | 1122 | DPRINT("Ref: %s\n", yytext+1); |
| 1117 | 1123 | yylval.labelref = xstrdup(yytext+1); |
| 1118 | 1124 | return DT_REF; |
| 1119 | 1125 | } |
| 1120 | 1126 | YY_BREAK |
| 1121 | −case 13: | |
| 1127 | +case 14: | |
| 1122 | 1128 | YY_RULE_SETUP |
| 1123 | −#line 206 "dtc-lexer.l" | |
| 1129 | +#line 211 "dtc-lexer.l" | |
| 1124 | 1130 | { /* new-style path reference */ |
| 1125 | 1131 | yytext[yyleng-1] = '\0'; |
| 1126 | 1132 | DPRINT("Ref: %s\n", yytext+2); |
| @@ -1128,27 +1134,27 @@ YY_RULE_SETUP · 1 unmodified line | ||
| 1128 | 1134 | return DT_REF; |
| 1129 | 1135 | } |
| 1130 | 1136 | YY_BREAK |
| 1131 | −case 14: | |
| 1137 | +case 15: | |
| 1132 | 1138 | YY_RULE_SETUP |
| 1133 | −#line 213 "dtc-lexer.l" | |
| 1139 | +#line 218 "dtc-lexer.l" | |
| 1134 | 1140 | { |
| 1135 | 1141 | yylval.byte = strtol(yytext, NULL, 16); |
| 1136 | 1142 | DPRINT("Byte: %02x\n", (int)yylval.byte); |
| 1137 | 1143 | return DT_BYTE; |
| 1138 | 1144 | } |
| 1139 | 1145 | YY_BREAK |
| 1140 | −case 15: | |
| 1146 | +case 16: | |
| 1141 | 1147 | YY_RULE_SETUP |
| 1142 | −#line 219 "dtc-lexer.l" | |
| 1148 | +#line 224 "dtc-lexer.l" | |
| 1143 | 1149 | { |
| 1144 | 1150 | DPRINT("/BYTESTRING\n"); |
| 1145 | 1151 | BEGIN_DEFAULT(); |
| 1146 | 1152 | return ']'; |
| 1147 | 1153 | } |
| 1148 | 1154 | YY_BREAK |
| 1149 | −case 16: | |
| 1155 | +case 17: | |
| 1150 | 1156 | YY_RULE_SETUP |
| 1151 | −#line 225 "dtc-lexer.l" | |
| 1157 | +#line 230 "dtc-lexer.l" | |
| 1152 | 1158 | { |
| 1153 | 1159 | DPRINT("PropNodeName: %s\n", yytext); |
| 1154 | 1160 | yylval.propnodename = xstrdup((yytext[0] == '\\') ? |
| @@ -1157,75 +1163,75 @@ YY_RULE_SETUP · 2 unmodified lines | ||
| 1157 | 1163 | return DT_PROPNODENAME; |
| 1158 | 1164 | } |
| 1159 | 1165 | YY_BREAK |
| 1160 | −case 17: | |
| 1166 | +case 18: | |
| 1161 | 1167 | YY_RULE_SETUP |
| 1162 | −#line 233 "dtc-lexer.l" | |
| 1168 | +#line 238 "dtc-lexer.l" | |
| 1163 | 1169 | { |
| 1164 | 1170 | DPRINT("Binary Include\n"); |
| 1165 | 1171 | return DT_INCBIN; |
| 1166 | 1172 | } |
| 1167 | 1173 | 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 | |
| 1174 | 1174 | case 19: |
| 1175 | 1175 | /* rule 19 can match eol */ |
| 1176 | 1176 | YY_RULE_SETUP |
| 1177 | −#line 239 "dtc-lexer.l" | |
| 1178 | −/* eat C-style comments */ | |
| 1177 | +#line 243 "dtc-lexer.l" | |
| 1178 | +/* eat whitespace */ | |
| 1179 | 1179 | YY_BREAK |
| 1180 | 1180 | case 20: |
| 1181 | 1181 | /* rule 20 can match eol */ |
| 1182 | 1182 | 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 */ | |
| 1185 | 1185 | YY_BREAK |
| 1186 | 1186 | case 21: |
| 1187 | +/* rule 21 can match eol */ | |
| 1187 | 1188 | YY_RULE_SETUP |
| 1188 | −#line 242 "dtc-lexer.l" | |
| 1189 | −{ return DT_LSHIFT; }; | |
| 1189 | +#line 245 "dtc-lexer.l" | |
| 1190 | +/* eat C++-style comments */ | |
| 1190 | 1191 | YY_BREAK |
| 1191 | 1192 | case 22: |
| 1192 | 1193 | YY_RULE_SETUP |
| 1193 | −#line 243 "dtc-lexer.l" | |
| 1194 | −{ return DT_RSHIFT; }; | |
| 1194 | +#line 247 "dtc-lexer.l" | |
| 1195 | +{ return DT_LSHIFT; }; | |
| 1195 | 1196 | YY_BREAK |
| 1196 | 1197 | case 23: |
| 1197 | 1198 | YY_RULE_SETUP |
| 1198 | −#line 244 "dtc-lexer.l" | |
| 1199 | −{ return DT_LE; }; | |
| 1199 | +#line 248 "dtc-lexer.l" | |
| 1200 | +{ return DT_RSHIFT; }; | |
| 1200 | 1201 | YY_BREAK |
| 1201 | 1202 | case 24: |
| 1202 | 1203 | YY_RULE_SETUP |
| 1203 | −#line 245 "dtc-lexer.l" | |
| 1204 | −{ return DT_GE; }; | |
| 1204 | +#line 249 "dtc-lexer.l" | |
| 1205 | +{ return DT_LE; }; | |
| 1205 | 1206 | YY_BREAK |
| 1206 | 1207 | case 25: |
| 1207 | 1208 | YY_RULE_SETUP |
| 1208 | −#line 246 "dtc-lexer.l" | |
| 1209 | −{ return DT_EQ; }; | |
| 1209 | +#line 250 "dtc-lexer.l" | |
| 1210 | +{ return DT_GE; }; | |
| 1210 | 1211 | YY_BREAK |
| 1211 | 1212 | case 26: |
| 1212 | 1213 | YY_RULE_SETUP |
| 1213 | −#line 247 "dtc-lexer.l" | |
| 1214 | −{ return DT_NE; }; | |
| 1214 | +#line 251 "dtc-lexer.l" | |
| 1215 | +{ return DT_EQ; }; | |
| 1215 | 1216 | YY_BREAK |
| 1216 | 1217 | case 27: |
| 1217 | 1218 | YY_RULE_SETUP |
| 1218 | −#line 248 "dtc-lexer.l" | |
| 1219 | −{ return DT_AND; }; | |
| 1219 | +#line 252 "dtc-lexer.l" | |
| 1220 | +{ return DT_NE; }; | |
| 1220 | 1221 | YY_BREAK |
| 1221 | 1222 | case 28: |
| 1222 | 1223 | YY_RULE_SETUP |
| 1223 | −#line 249 "dtc-lexer.l" | |
| 1224 | −{ return DT_OR; }; | |
| 1224 | +#line 253 "dtc-lexer.l" | |
| 1225 | +{ return DT_AND; }; | |
| 1225 | 1226 | YY_BREAK |
| 1226 | 1227 | case 29: |
| 1227 | 1228 | 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" | |
| 1229 | 1235 | { |
| 1230 | 1236 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], |
| 1231 | 1237 | (unsigned)yytext[0]); |
| @@ -1241,12 +1247,12 @@ YY_RULE_SETUP · 9 unmodified lines | ||
| 1241 | 1247 | return yytext[0]; |
| 1242 | 1248 | } |
| 1243 | 1249 | YY_BREAK |
| 1244 | −case 30: | |
| 1250 | +case 31: | |
| 1245 | 1251 | YY_RULE_SETUP |
| 1246 | −#line 266 "dtc-lexer.l" | |
| 1252 | +#line 271 "dtc-lexer.l" | |
| 1247 | 1253 | ECHO; |
| 1248 | 1254 | YY_BREAK |
| 1249 | −#line 1250 "dtc-lexer.lex.c" | |
| 1255 | +#line 1256 "dtc-lexer.lex.c" | |
| 1250 | 1256 | |
| 1251 | 1257 | case YY_END_OF_BUFFER: |
| 1252 | 1258 | { |
| @@ -1388,9 +1394,9 @@ ECHO; · 135 unmodified lines | ||
| 1388 | 1394 | */ |
| 1389 | 1395 | static int yy_get_next_buffer (void) |
| 1390 | 1396 | { |
| 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; | |
| 1394 | 1400 | int ret_val; |
| 1395 | 1401 | |
| 1396 | 1402 | 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 | ||
| 1419 | 1425 | /* Try to read more data. */ |
| 1420 | 1426 | |
| 1421 | 1427 | /* 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; | |
| 1423 | 1429 | |
| 1424 | 1430 | for ( i = 0; i < number_to_move; ++i ) |
| 1425 | 1431 | *(dest++) = *(source++); |
| @@ -1432,7 +1438,7 @@ static int yy_get_next_buffer (void) · 6 unmodified lines | ||
| 1432 | 1438 | |
| 1433 | 1439 | else |
| 1434 | 1440 | { |
| 1435 | − yy_size_t num_to_read = | |
| 1441 | + int num_to_read = | |
| 1436 | 1442 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
| 1437 | 1443 | |
| 1438 | 1444 | while ( num_to_read <= 0 ) |
| @@ -1446,7 +1452,7 @@ static int yy_get_next_buffer (void) · 7 unmodified lines | ||
| 1446 | 1452 | |
| 1447 | 1453 | if ( b->yy_is_our_buffer ) |
| 1448 | 1454 | { |
| 1449 | − yy_size_t new_size = b->yy_buf_size * 2; | |
| 1455 | + int new_size = b->yy_buf_size * 2; | |
| 1450 | 1456 | |
| 1451 | 1457 | if ( new_size <= 0 ) |
| 1452 | 1458 | b->yy_buf_size += b->yy_buf_size / 8; |
| @@ -1459,7 +1465,7 @@ static int yy_get_next_buffer (void) · 6 unmodified lines | ||
| 1459 | 1465 | } |
| 1460 | 1466 | else |
| 1461 | 1467 | /* Can't grow it, we don't own it. */ |
| 1462 | − b->yy_ch_buf = 0; | |
| 1468 | + b->yy_ch_buf = NULL; | |
| 1463 | 1469 | |
| 1464 | 1470 | if ( ! b->yy_ch_buf ) |
| 1465 | 1471 | YY_FATAL_ERROR( |
| @@ -1501,9 +1507,9 @@ static int yy_get_next_buffer (void) · 35 unmodified lines | ||
| 1501 | 1507 | else |
| 1502 | 1508 | ret_val = EOB_ACT_CONTINUE_SCAN; |
| 1503 | 1509 | |
| 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) { | |
| 1505 | 1511 | /* 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); | |
| 1507 | 1513 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); |
| 1508 | 1514 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) |
| 1509 | 1515 | 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 | ||
| 1522 | 1528 | |
| 1523 | 1529 | static yy_state_type yy_get_previous_state (void) |
| 1524 | 1530 | { |
| 1525 | − register yy_state_type yy_current_state; | |
| 1526 | − register char *yy_cp; | |
| 1531 | + yy_state_type yy_current_state; | |
| 1532 | + char *yy_cp; | |
| 1527 | 1533 | |
| 1528 | 1534 | yy_current_state = (yy_start); |
| 1529 | 1535 | yy_current_state += YY_AT_BOL(); |
| 1530 | 1536 | |
| 1531 | 1537 | for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) |
| 1532 | 1538 | { |
| 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); | |
| 1534 | 1540 | if ( yy_accept[yy_current_state] ) |
| 1535 | 1541 | { |
| 1536 | 1542 | (yy_last_accepting_state) = yy_current_state; |
| @@ -1539,10 +1545,10 @@ static int yy_get_next_buffer (void) · 2 unmodified lines | ||
| 1539 | 1545 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
| 1540 | 1546 | { |
| 1541 | 1547 | yy_current_state = (int) yy_def[yy_current_state]; |
| 1542 | − if ( yy_current_state >= 159 ) | |
| 1548 | + if ( yy_current_state >= 166 ) | |
| 1543 | 1549 | yy_c = yy_meta[(unsigned int) yy_c]; |
| 1544 | 1550 | } |
| 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]; | |
| 1546 | 1552 | } |
| 1547 | 1553 | |
| 1548 | 1554 | return yy_current_state; |
| @@ -1555,10 +1561,10 @@ static int yy_get_next_buffer (void) · 6 unmodified lines | ||
| 1555 | 1561 | */ |
| 1556 | 1562 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) |
| 1557 | 1563 | { |
| 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); | |
| 1560 | 1566 | |
| 1561 | − register YY_CHAR yy_c = 1; | |
| 1567 | + YY_CHAR yy_c = 1; | |
| 1562 | 1568 | if ( yy_accept[yy_current_state] ) |
| 1563 | 1569 | { |
| 1564 | 1570 | (yy_last_accepting_state) = yy_current_state; |
| @@ -1567,15 +1573,19 @@ static int yy_get_next_buffer (void) · 2 unmodified lines | ||
| 1567 | 1573 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
| 1568 | 1574 | { |
| 1569 | 1575 | yy_current_state = (int) yy_def[yy_current_state]; |
| 1570 | − if ( yy_current_state >= 159 ) | |
| 1576 | + if ( yy_current_state >= 166 ) | |
| 1571 | 1577 | yy_c = yy_meta[(unsigned int) yy_c]; |
| 1572 | 1578 | } |
| 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); | |
| 1575 | 1581 | |
| 1576 | 1582 | return yy_is_jam ? 0 : yy_current_state; |
| 1577 | 1583 | } |
| 1578 | 1584 | |
| 1585 | +#ifndef YY_NO_UNPUT | |
| 1586 | + | |
| 1587 | +#endif | |
| 1588 | + | |
| 1579 | 1589 | #ifndef YY_NO_INPUT |
| 1580 | 1590 | #ifdef __cplusplus |
| 1581 | 1591 | static int yyinput (void) |
| @@ -1600,7 +1610,7 @@ static int yy_get_next_buffer (void) · 18 unmodified lines | ||
| 1600 | 1610 | |
| 1601 | 1611 | else |
| 1602 | 1612 | { /* need more input */ |
| 1603 | − yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); | |
| 1613 | + int offset = (yy_c_buf_p) - (yytext_ptr); | |
| 1604 | 1614 | ++(yy_c_buf_p); |
| 1605 | 1615 | |
| 1606 | 1616 | switch ( yy_get_next_buffer( ) ) |
| @@ -1624,7 +1634,7 @@ static int yy_get_next_buffer (void) · 17 unmodified lines | ||
| 1624 | 1634 | case EOB_ACT_END_OF_FILE: |
| 1625 | 1635 | { |
| 1626 | 1636 | if ( yywrap( ) ) |
| 1627 | − return EOF; | |
| 1637 | + return 0; | |
| 1628 | 1638 | |
| 1629 | 1639 | if ( ! (yy_did_buffer_switch_on_eof) ) |
| 1630 | 1640 | YY_NEW_FILE; |
| @@ -1727,7 +1737,7 @@ static void yy_load_buffer_state (void) · 96 unmodified lines | ||
| 1727 | 1737 | if ( ! b ) |
| 1728 | 1738 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 1729 | 1739 | |
| 1730 | − b->yy_buf_size = size; | |
| 1740 | + b->yy_buf_size = (yy_size_t)size; | |
| 1731 | 1741 | |
| 1732 | 1742 | /* yy_ch_buf has to be 2 characters longer than the size given because |
| 1733 | 1743 | * we need to put in 2 end-of-buffer characters. |
| @@ -1874,7 +1884,7 @@ void yypop_buffer_state (void) · 140 unmodified lines | ||
| 1874 | 1884 | */ |
| 1875 | 1885 | static void yyensure_buffer_stack (void) |
| 1876 | 1886 | { |
| 1877 | − yy_size_t num_to_alloc; | |
| 1887 | + int num_to_alloc; | |
| 1878 | 1888 | |
| 1879 | 1889 | if (!(yy_buffer_stack)) { |
| 1880 | 1890 | |
| @@ -1882,15 +1892,15 @@ static void yyensure_buffer_stack (void) · 1 unmodified line | ||
| 1882 | 1892 | * scanner will even need a stack. We use 2 instead of 1 to avoid an |
| 1883 | 1893 | * immediate realloc on the next call. |
| 1884 | 1894 | */ |
| 1885 | − num_to_alloc = 1; | |
| 1895 | + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ | |
| 1886 | 1896 | (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc |
| 1887 | 1897 | (num_to_alloc * sizeof(struct yy_buffer_state*) |
| 1888 | 1898 | ); |
| 1889 | 1899 | if ( ! (yy_buffer_stack) ) |
| 1890 | 1900 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
| 1891 | − | |
| 1901 | + | |
| 1892 | 1902 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); |
| 1893 | − | |
| 1903 | + | |
| 1894 | 1904 | (yy_buffer_stack_max) = num_to_alloc; |
| 1895 | 1905 | (yy_buffer_stack_top) = 0; |
| 1896 | 1906 | return; |
| @@ -1899,7 +1909,7 @@ static void yyensure_buffer_stack (void) · 2 unmodified lines | ||
| 1899 | 1909 | if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ |
| 1900 | 1910 | |
| 1901 | 1911 | /* 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 */; | |
| 1903 | 1913 | |
| 1904 | 1914 | num_to_alloc = (yy_buffer_stack_max) + grow_size; |
| 1905 | 1915 | (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc |
| @@ -1919,7 +1929,7 @@ static void yyensure_buffer_stack (void) · 13 unmodified lines | ||
| 1919 | 1929 | * @param base the character buffer |
| 1920 | 1930 | * @param size the size in bytes of the character buffer |
| 1921 | 1931 | * |
| 1922 | − * @return the newly allocated buffer state object. | |
| 1932 | + * @return the newly allocated buffer state object. | |
| 1923 | 1933 | */ |
| 1924 | 1934 | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) |
| 1925 | 1935 | { |
| @@ -1929,7 +1939,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) · 3 unmodified lines | ||
| 1929 | 1939 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
| 1930 | 1940 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
| 1931 | 1941 | /* They forgot to leave room for the EOB's. */ |
| 1932 | − return 0; | |
| 1942 | + return NULL; | |
| 1933 | 1943 | |
| 1934 | 1944 | b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); |
| 1935 | 1945 | if ( ! b ) |
| @@ -1938,7 +1948,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) · 2 unmodified lines | ||
| 1938 | 1948 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ |
| 1939 | 1949 | b->yy_buf_pos = b->yy_ch_buf = base; |
| 1940 | 1950 | b->yy_is_our_buffer = 0; |
| 1941 | − b->yy_input_file = 0; | |
| 1951 | + b->yy_input_file = NULL; | |
| 1942 | 1952 | b->yy_n_chars = b->yy_buf_size; |
| 1943 | 1953 | b->yy_is_interactive = 0; |
| 1944 | 1954 | b->yy_at_bol = 1; |
| @@ -1961,7 +1971,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) · 16 unmodified lines | ||
| 1961 | 1971 | YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) |
| 1962 | 1972 | { |
| 1963 | 1973 | |
| 1964 | − return yy_scan_bytes(yystr,strlen(yystr) ); | |
| 1974 | + return yy_scan_bytes(yystr,(int) strlen(yystr) ); | |
| 1965 | 1975 | } |
| 1966 | 1976 | |
| 1967 | 1977 | /** 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 | ||
| 1971 | 1981 | * |
| 1972 | 1982 | * @return the newly allocated buffer state object. |
| 1973 | 1983 | */ |
| 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 ) | |
| 1975 | 1985 | { |
| 1976 | 1986 | YY_BUFFER_STATE b; |
| 1977 | 1987 | char *buf; |
| @@ -1979,7 +1989,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len · 1 unmodified line | ||
| 1979 | 1989 | yy_size_t i; |
| 1980 | 1990 | |
| 1981 | 1991 | /* Get memory for full buffer, including space for trailing EOB's. */ |
| 1982 | − n = _yybytes_len + 2; | |
| 1992 | + n = (yy_size_t) _yybytes_len + 2; | |
| 1983 | 1993 | buf = (char *) yyalloc(n ); |
| 1984 | 1994 | if ( ! buf ) |
| 1985 | 1995 | 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 | ||
| 2005 | 2015 | #define YY_EXIT_FAILURE 2 |
| 2006 | 2016 | #endif |
| 2007 | 2017 | |
| 2008 | −static void yy_fatal_error (yyconst char* msg ) | |
| 2018 | +static void yynoreturn yy_fatal_error (yyconst char* msg ) | |
| 2009 | 2019 | { |
| 2010 | − (void) fprintf( stderr, "%s\n", msg ); | |
| 2020 | + (void) fprintf( stderr, "%s\n", msg ); | |
| 2011 | 2021 | exit( YY_EXIT_FAILURE ); |
| 2012 | 2022 | } |
| 2013 | 2023 | |
| @@ -2035,7 +2045,7 @@ static void yy_fatal_error (yyconst char* msg ) · 21 unmodified lines | ||
| 2035 | 2045 | */ |
| 2036 | 2046 | int yyget_lineno (void) |
| 2037 | 2047 | { |
| 2038 | − | |
| 2048 | + | |
| 2039 | 2049 | return yylineno; |
| 2040 | 2050 | } |
| 2041 | 2051 | |
| @@ -2058,7 +2068,7 @@ FILE *yyget_out (void) · 16 unmodified lines | ||
| 2058 | 2068 | /** Get the length of the current token. |
| 2059 | 2069 | * |
| 2060 | 2070 | */ |
| 2061 | −yy_size_t yyget_leng (void) | |
| 2071 | +int yyget_leng (void) | |
| 2062 | 2072 | { |
| 2063 | 2073 | return yyleng; |
| 2064 | 2074 | } |
| @@ -2073,29 +2083,29 @@ char *yyget_text (void) · 8 unmodified lines | ||
| 2073 | 2083 | } |
| 2074 | 2084 | |
| 2075 | 2085 | /** Set the current line number. |
| 2076 | − * @param line_number | |
| 2086 | + * @param _line_number line number | |
| 2077 | 2087 | * |
| 2078 | 2088 | */ |
| 2079 | −void yyset_lineno (int line_number ) | |
| 2089 | +void yyset_lineno (int _line_number ) | |
| 2080 | 2090 | { |
| 2081 | 2091 | |
| 2082 | − yylineno = line_number; | |
| 2092 | + yylineno = _line_number; | |
| 2083 | 2093 | } |
| 2084 | 2094 | |
| 2085 | 2095 | /** Set the input stream. This does not discard the current |
| 2086 | 2096 | * input buffer. |
| 2087 | − * @param in_str A readable stream. | |
| 2097 | + * @param _in_str A readable stream. | |
| 2088 | 2098 | * |
| 2089 | 2099 | * @see yy_switch_to_buffer |
| 2090 | 2100 | */ |
| 2091 | −void yyset_in (FILE * in_str ) | |
| 2101 | +void yyset_in (FILE * _in_str ) | |
| 2092 | 2102 | { |
| 2093 | − yyin = in_str ; | |
| 2103 | + yyin = _in_str ; | |
| 2094 | 2104 | } |
| 2095 | 2105 | |
| 2096 | −void yyset_out (FILE * out_str ) | |
| 2106 | +void yyset_out (FILE * _out_str ) | |
| 2097 | 2107 | { |
| 2098 | − yyout = out_str ; | |
| 2108 | + yyout = _out_str ; | |
| 2099 | 2109 | } |
| 2100 | 2110 | |
| 2101 | 2111 | int yyget_debug (void) |
| @@ -2103,9 +2113,9 @@ int yyget_debug (void) · 1 unmodified line | ||
| 2103 | 2113 | return yy_flex_debug; |
| 2104 | 2114 | } |
| 2105 | 2115 | |
| 2106 | −void yyset_debug (int bdebug ) | |
| 2116 | +void yyset_debug (int _bdebug ) | |
| 2107 | 2117 | { |
| 2108 | − yy_flex_debug = bdebug ; | |
| 2118 | + yy_flex_debug = _bdebug ; | |
| 2109 | 2119 | } |
| 2110 | 2120 | |
| 2111 | 2121 | static int yy_init_globals (void) |
| @@ -2114,10 +2124,10 @@ static int yy_init_globals (void) · 2 unmodified lines | ||
| 2114 | 2124 | * This function is called from yylex_destroy(), so don't allocate here. |
| 2115 | 2125 | */ |
| 2116 | 2126 | |
| 2117 | − (yy_buffer_stack) = 0; | |
| 2127 | + (yy_buffer_stack) = NULL; | |
| 2118 | 2128 | (yy_buffer_stack_top) = 0; |
| 2119 | 2129 | (yy_buffer_stack_max) = 0; |
| 2120 | − (yy_c_buf_p) = (char *) 0; | |
| 2130 | + (yy_c_buf_p) = NULL; | |
| 2121 | 2131 | (yy_init) = 0; |
| 2122 | 2132 | (yy_start) = 0; |
| 2123 | 2133 | |
| @@ -2126,8 +2136,8 @@ static int yy_init_globals (void) · 2 unmodified lines | ||
| 2126 | 2136 | yyin = stdin; |
| 2127 | 2137 | yyout = stdout; |
| 2128 | 2138 | #else |
| 2129 | − yyin = (FILE *) 0; | |
| 2130 | − yyout = (FILE *) 0; | |
| 2139 | + yyin = NULL; | |
| 2140 | + yyout = NULL; | |
| 2131 | 2141 | #endif |
| 2132 | 2142 | |
| 2133 | 2143 | /* For future reference: Set errno on error, since we are called by |
| @@ -2165,7 +2175,8 @@ int yylex_destroy (void) · 31 unmodified lines | ||
| 2165 | 2175 | #ifndef yytext_ptr |
| 2166 | 2176 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) |
| 2167 | 2177 | { |
| 2168 | − register int i; | |
| 2178 | + | |
| 2179 | + int i; | |
| 2169 | 2180 | for ( i = 0; i < n; ++i ) |
| 2170 | 2181 | s1[i] = s2[i]; |
| 2171 | 2182 | } |
| @@ -2174,7 +2185,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) · 2 unmodified lines | ||
| 2174 | 2185 | #ifdef YY_NEED_STRLEN |
| 2175 | 2186 | static int yy_flex_strlen (yyconst char * s ) |
| 2176 | 2187 | { |
| 2177 | − register int n; | |
| 2188 | + int n; | |
| 2178 | 2189 | for ( n = 0; s[n]; ++n ) |
| 2179 | 2190 | ; |
| 2180 | 2191 | |
| @@ -2184,11 +2195,12 @@ static int yy_flex_strlen (yyconst char * s ) · 3 unmodified lines | ||
| 2184 | 2195 | |
| 2185 | 2196 | void *yyalloc (yy_size_t size ) |
| 2186 | 2197 | { |
| 2187 | − return (void *) malloc( size ); | |
| 2198 | + return malloc(size); | |
| 2188 | 2199 | } |
| 2189 | 2200 | |
| 2190 | 2201 | void *yyrealloc (void * ptr, yy_size_t size ) |
| 2191 | 2202 | { |
| 2203 | + | |
| 2192 | 2204 | /* The cast to (char *) in the following accommodates both |
| 2193 | 2205 | * implementations that use char* generic pointers, and those |
| 2194 | 2206 | * 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 | ||
| 2196 | 2208 | * any pointer type to void*, and deal with argument conversions |
| 2197 | 2209 | * as though doing an assignment. |
| 2198 | 2210 | */ |
| 2199 | − return (void *) realloc( (char *) ptr, size ); | |
| 2211 | + return realloc(ptr, size); | |
| 2200 | 2212 | } |
| 2201 | 2213 | |
| 2202 | 2214 | void yyfree (void * ptr ) |
| 2203 | 2215 | { |
| 2204 | − free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ | |
| 2216 | + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ | |
| 2205 | 2217 | } |
| 2206 | 2218 | |
| 2207 | 2219 | #define YYTABLES_NAME "yytables" |
| 2208 | 2220 | |
| 2209 | −#line 265 "dtc-lexer.l" | |
| 2221 | +#line 271 "dtc-lexer.l" | |
| 2210 | 2222 | |
| 2211 | 2223 | |
| 2212 | 2224 | |
| @@ -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. */ | |
| 2 | 2 | |
| 3 | 3 | /* Bison implementation for Yacc-like parsers in C |
| 4 | 4 | |
| 5 | − Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. | |
| 5 | + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. | |
| 6 | 6 | |
| 7 | 7 | This program is free software: you can redistribute it and/or modify |
| 8 | 8 | it under the terms of the GNU General Public License as published by |
| @@ -44,7 +44,7 @@ · 35 unmodified lines | ||
| 44 | 44 | #define YYBISON 1 |
| 45 | 45 | |
| 46 | 46 | /* Bison version. */ |
| 47 | −#define YYBISON_VERSION "3.0.2" | |
| 47 | +#define YYBISON_VERSION "3.0.4" | |
| 48 | 48 | |
| 49 | 49 | /* Skeleton name. */ |
| 50 | 50 | #define YYSKELETON_NAME "yacc.c" |
| @@ -65,6 +65,7 @@ · 14 unmodified lines | ||
| 65 | 65 | #line 20 "dtc-parser.y" /* yacc.c:339 */ |
| 66 | 66 | |
| 67 | 67 | #include <stdio.h> |
| 68 | +#include <inttypes.h> | |
| 68 | 69 | |
| 69 | 70 | #include "dtc.h" |
| 70 | 71 | #include "srcpos.h" |
| @@ -77,10 +78,10 @@ extern void yyerror(char const *s); · 6 unmodified lines | ||
| 77 | 78 | treesource_error = true; \ |
| 78 | 79 | } while (0) |
| 79 | 80 | |
| 80 | −extern struct boot_info *the_boot_info; | |
| 81 | +extern struct dt_info *parser_output; | |
| 81 | 82 | extern bool treesource_error; |
| 82 | 83 | |
| 83 | −#line 84 "dtc-parser.tab.c" /* yacc.c:339 */ | |
| 84 | +#line 85 "dtc-parser.tab.c" /* yacc.c:339 */ | |
| 84 | 85 | |
| 85 | 86 | # ifndef YY_NULLPTR |
| 86 | 87 | # if defined __cplusplus && 201103L <= __cplusplus |
| @@ -116,35 +117,36 @@ extern int yydebug; · 29 unmodified lines | ||
| 116 | 117 | enum yytokentype |
| 117 | 118 | { |
| 118 | 119 | 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 | |
| 139 | 141 | }; |
| 140 | 142 | #endif |
| 141 | 143 | |
| 142 | 144 | /* Value type. */ |
| 143 | 145 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| 144 | −typedef union YYSTYPE YYSTYPE; | |
| 146 | + | |
| 145 | 147 | union YYSTYPE |
| 146 | 148 | { |
| 147 | −#line 38 "dtc-parser.y" /* yacc.c:355 */ | |
| 149 | +#line 39 "dtc-parser.y" /* yacc.c:355 */ | |
| 148 | 150 | |
| 149 | 151 | char *propnodename; |
| 150 | 152 | char *labelref; |
| @@ -162,9 +164,12 @@ union YYSTYPE · 11 unmodified lines | ||
| 162 | 164 | struct node *nodelist; |
| 163 | 165 | struct reserve_info *re; |
| 164 | 166 | uint64_t integer; |
| 167 | + unsigned int flags; | |
| 165 | 168 | |
| 166 | −#line 167 "dtc-parser.tab.c" /* yacc.c:355 */ | |
| 169 | +#line 170 "dtc-parser.tab.c" /* yacc.c:355 */ | |
| 167 | 170 | }; |
| 171 | + | |
| 172 | +typedef union YYSTYPE YYSTYPE; | |
| 168 | 173 | # define YYSTYPE_IS_TRIVIAL 1 |
| 169 | 174 | # define YYSTYPE_IS_DECLARED 1 |
| 170 | 175 | #endif |
| @@ -192,7 +197,7 @@ int yyparse (void); · 21 unmodified lines | ||
| 192 | 197 | |
| 193 | 198 | /* Copy the second part of user declarations. */ |
| 194 | 199 | |
| 195 | −#line 196 "dtc-parser.tab.c" /* yacc.c:358 */ | |
| 200 | +#line 201 "dtc-parser.tab.c" /* yacc.c:358 */ | |
| 196 | 201 | |
| 197 | 202 | #ifdef short |
| 198 | 203 | # undef short |
| @@ -434,23 +439,23 @@ union yyalloc · 235 unmodified lines | ||
| 434 | 439 | #endif /* !YYCOPY_NEEDED */ |
| 435 | 440 | |
| 436 | 441 | /* YYFINAL -- State number of the termination state. */ |
| 437 | −#define YYFINAL 4 | |
| 442 | +#define YYFINAL 6 | |
| 438 | 443 | /* YYLAST -- Last index in YYTABLE. */ |
| 439 | −#define YYLAST 136 | |
| 444 | +#define YYLAST 138 | |
| 440 | 445 | |
| 441 | 446 | /* YYNTOKENS -- Number of terminals. */ |
| 442 | −#define YYNTOKENS 47 | |
| 447 | +#define YYNTOKENS 48 | |
| 443 | 448 | /* YYNNTS -- Number of nonterminals. */ |
| 444 | −#define YYNNTS 28 | |
| 449 | +#define YYNNTS 30 | |
| 445 | 450 | /* YYNRULES -- Number of rules. */ |
| 446 | −#define YYNRULES 80 | |
| 451 | +#define YYNRULES 84 | |
| 447 | 452 | /* YYNSTATES -- Number of states. */ |
| 448 | −#define YYNSTATES 144 | |
| 453 | +#define YYNSTATES 149 | |
| 449 | 454 | |
| 450 | 455 | /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned |
| 451 | 456 | by yylex, with out-of-bounds checking. */ |
| 452 | 457 | #define YYUNDEFTOK 2 |
| 453 | −#define YYMAXUTOK 278 | |
| 458 | +#define YYMAXUTOK 279 | |
| 454 | 459 | |
| 455 | 460 | #define YYTRANSLATE(YYX) \ |
| 456 | 461 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| @@ -462,16 +467,16 @@ static const yytype_uint8 yytranslate[] = · 5 unmodified lines | ||
| 462 | 467 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 463 | 468 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 464 | 469 | 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, | |
| 469 | 474 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 470 | 475 | 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, | |
| 472 | 477 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 473 | 478 | 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, | |
| 475 | 480 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 476 | 481 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 477 | 482 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| @@ -486,22 +491,22 @@ static const yytype_uint8 yytranslate[] = · 8 unmodified lines | ||
| 486 | 491 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 487 | 492 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 488 | 493 | 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 | |
| 490 | 495 | }; |
| 491 | 496 | |
| 492 | 497 | #if YYDEBUG |
| 493 | 498 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
| 494 | 499 | static const yytype_uint16 yyrline[] = |
| 495 | 500 | { |
| 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 | |
| 505 | 510 | }; |
| 506 | 511 | #endif |
| 507 | 512 | |
| @@ -510,19 +515,20 @@ static const yytype_uint16 yyrline[] = · 2 unmodified lines | ||
| 510 | 515 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 511 | 516 | static const char *const yytname[] = |
| 512 | 517 | { |
| 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 | |
| 526 | 532 | }; |
| 527 | 533 | #endif |
| 528 | 534 | |
| @@ -533,16 +539,16 @@ static const yytype_uint16 yytoknum[] = · 4 unmodified lines | ||
| 533 | 539 | { |
| 534 | 540 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 535 | 541 | 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 | |
| 539 | 545 | }; |
| 540 | 546 | # endif |
| 541 | 547 | |
| 542 | −#define YYPACT_NINF -81 | |
| 548 | +#define YYPACT_NINF -44 | |
| 543 | 549 | |
| 544 | 550 | #define yypact_value_is_default(Yystate) \ |
| 545 | − (!!((Yystate) == (-81))) | |
| 551 | + (!!((Yystate) == (-44))) | |
| 546 | 552 | |
| 547 | 553 | #define YYTABLE_NINF -1 |
| 548 | 554 | |
| @@ -553,21 +559,21 @@ static const yytype_uint16 yytoknum[] = · 4 unmodified lines | ||
| 553 | 559 | STATE-NUM. */ |
| 554 | 560 | static const yytype_int8 yypact[] = |
| 555 | 561 | { |
| 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 | |
| 571 | 577 | }; |
| 572 | 578 | |
| 573 | 579 | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
| @@ -575,37 +581,37 @@ static const yytype_int8 yypact[] = · 1 unmodified line | ||
| 575 | 581 | means the default is an error. */ |
| 576 | 582 | static const yytype_uint8 yydefact[] = |
| 577 | 583 | { |
| 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, | |
| 583 | 589 | 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 | |
| 593 | 599 | }; |
| 594 | 600 | |
| 595 | 601 | /* YYPGOTO[NTERM-NUM]. */ |
| 596 | 602 | static const yytype_int8 yypgoto[] = |
| 597 | 603 | { |
| 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 | |
| 601 | 607 | }; |
| 602 | 608 | |
| 603 | 609 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 604 | 610 | static const yytype_int16 yydefgoto[] = |
| 605 | 611 | { |
| 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 | |
| 609 | 615 | }; |
| 610 | 616 | |
| 611 | 617 | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
| @@ -613,87 +619,87 @@ static const yytype_int16 yydefgoto[] = · 1 unmodified line | ||
| 613 | 619 | number is the opposite. If YYTABLE_NINF, syntax error. */ |
| 614 | 620 | static const yytype_uint8 yytable[] = |
| 615 | 621 | { |
| 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 | |
| 630 | 636 | }; |
| 631 | 637 | |
| 632 | 638 | static const yytype_int16 yycheck[] = |
| 633 | 639 | { |
| 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 | |
| 648 | 654 | }; |
| 649 | 655 | |
| 650 | 656 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 651 | 657 | symbol of state STATE-NUM. */ |
| 652 | 658 | static const yytype_uint8 yystos[] = |
| 653 | 659 | { |
| 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 | |
| 669 | 675 | }; |
| 670 | 676 | |
| 671 | 677 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 672 | 678 | static const yytype_uint8 yyr1[] = |
| 673 | 679 | { |
| 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 | |
| 683 | 689 | }; |
| 684 | 690 | |
| 685 | 691 | /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ |
| 686 | 692 | static const yytype_uint8 yyr2[] = |
| 687 | 693 | { |
| 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 | |
| 697 | 703 | }; |
| 698 | 704 | |
| 699 | 705 | |
| @@ -1463,65 +1469,91 @@ yyreduce: · 763 unmodified lines | ||
| 1463 | 1469 | switch (yyn) |
| 1464 | 1470 | { |
| 1465 | 1471 | case 2: |
| 1466 | −#line 105 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1472 | +#line 110 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1467 | 1473 | { |
| 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))); | |
| 1470 | 1476 | } |
| 1471 | −#line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1477 | +#line 1478 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1472 | 1478 | break; |
| 1473 | 1479 | |
| 1474 | 1480 | case 3: |
| 1475 | −#line 113 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1481 | +#line 118 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1476 | 1482 | { |
| 1477 | − (yyval.re) = NULL; | |
| 1483 | + (yyval.flags) = DTSF_V1; | |
| 1478 | 1484 | } |
| 1479 | −#line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1485 | +#line 1486 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1480 | 1486 | break; |
| 1481 | 1487 | |
| 1482 | 1488 | 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 */ | |
| 1484 | 1516 | { |
| 1485 | 1517 | (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); |
| 1486 | 1518 | } |
| 1487 | −#line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1519 | +#line 1520 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1488 | 1520 | break; |
| 1489 | 1521 | |
| 1490 | − case 5: | |
| 1491 | −#line 124 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1522 | + case 9: | |
| 1523 | +#line 150 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1492 | 1524 | { |
| 1493 | 1525 | (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); |
| 1494 | 1526 | } |
| 1495 | −#line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1527 | +#line 1528 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1496 | 1528 | break; |
| 1497 | 1529 | |
| 1498 | − case 6: | |
| 1499 | −#line 128 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1530 | + case 10: | |
| 1531 | +#line 154 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1500 | 1532 | { |
| 1501 | 1533 | add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); |
| 1502 | 1534 | (yyval.re) = (yyvsp[0].re); |
| 1503 | 1535 | } |
| 1504 | −#line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1536 | +#line 1537 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1505 | 1537 | break; |
| 1506 | 1538 | |
| 1507 | − case 7: | |
| 1508 | −#line 136 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1539 | + case 11: | |
| 1540 | +#line 162 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1509 | 1541 | { |
| 1510 | 1542 | (yyval.node) = name_node((yyvsp[0].node), ""); |
| 1511 | 1543 | } |
| 1512 | −#line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1544 | +#line 1545 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1513 | 1545 | break; |
| 1514 | 1546 | |
| 1515 | − case 8: | |
| 1516 | −#line 140 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1547 | + case 12: | |
| 1548 | +#line 166 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1517 | 1549 | { |
| 1518 | 1550 | (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); |
| 1519 | 1551 | } |
| 1520 | −#line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1552 | +#line 1553 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1521 | 1553 | break; |
| 1522 | 1554 | |
| 1523 | − case 9: | |
| 1524 | −#line 145 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1555 | + case 13: | |
| 1556 | +#line 171 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1525 | 1557 | { |
| 1526 | 1558 | struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); |
| 1527 | 1559 | |
| @@ -1532,11 +1564,11 @@ yyreduce: · 4 unmodified lines | ||
| 1532 | 1564 | ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); |
| 1533 | 1565 | (yyval.node) = (yyvsp[-3].node); |
| 1534 | 1566 | } |
| 1535 | −#line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1567 | +#line 1568 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1536 | 1568 | break; |
| 1537 | 1569 | |
| 1538 | − case 10: | |
| 1539 | −#line 156 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1570 | + case 14: | |
| 1571 | +#line 182 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1540 | 1572 | { |
| 1541 | 1573 | struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); |
| 1542 | 1574 | |
| @@ -1546,11 +1578,11 @@ yyreduce: · 3 unmodified lines | ||
| 1546 | 1578 | ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); |
| 1547 | 1579 | (yyval.node) = (yyvsp[-2].node); |
| 1548 | 1580 | } |
| 1549 | −#line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1581 | +#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1550 | 1582 | break; |
| 1551 | 1583 | |
| 1552 | − case 11: | |
| 1553 | −#line 166 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1584 | + case 15: | |
| 1585 | +#line 192 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1554 | 1586 | { |
| 1555 | 1587 | struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); |
| 1556 | 1588 | |
| @@ -1562,100 +1594,100 @@ yyreduce: · 5 unmodified lines | ||
| 1562 | 1594 | |
| 1563 | 1595 | (yyval.node) = (yyvsp[-3].node); |
| 1564 | 1596 | } |
| 1565 | −#line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1597 | +#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1566 | 1598 | break; |
| 1567 | 1599 | |
| 1568 | − case 12: | |
| 1569 | −#line 181 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1600 | + case 16: | |
| 1601 | +#line 207 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1570 | 1602 | { |
| 1571 | 1603 | (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); |
| 1572 | 1604 | } |
| 1573 | −#line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1605 | +#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1574 | 1606 | break; |
| 1575 | 1607 | |
| 1576 | − case 13: | |
| 1577 | −#line 188 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1608 | + case 17: | |
| 1609 | +#line 214 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1578 | 1610 | { |
| 1579 | 1611 | (yyval.proplist) = NULL; |
| 1580 | 1612 | } |
| 1581 | −#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1613 | +#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1582 | 1614 | break; |
| 1583 | 1615 | |
| 1584 | − case 14: | |
| 1585 | −#line 192 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1616 | + case 18: | |
| 1617 | +#line 218 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1586 | 1618 | { |
| 1587 | 1619 | (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); |
| 1588 | 1620 | } |
| 1589 | −#line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1621 | +#line 1622 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1590 | 1622 | break; |
| 1591 | 1623 | |
| 1592 | − case 15: | |
| 1593 | −#line 199 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1624 | + case 19: | |
| 1625 | +#line 225 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1594 | 1626 | { |
| 1595 | 1627 | (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); |
| 1596 | 1628 | } |
| 1597 | −#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1629 | +#line 1630 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1598 | 1630 | break; |
| 1599 | 1631 | |
| 1600 | − case 16: | |
| 1601 | −#line 203 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1632 | + case 20: | |
| 1633 | +#line 229 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1602 | 1634 | { |
| 1603 | 1635 | (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); |
| 1604 | 1636 | } |
| 1605 | −#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1637 | +#line 1638 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1606 | 1638 | break; |
| 1607 | 1639 | |
| 1608 | − case 17: | |
| 1609 | −#line 207 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1640 | + case 21: | |
| 1641 | +#line 233 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1610 | 1642 | { |
| 1611 | 1643 | (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); |
| 1612 | 1644 | } |
| 1613 | −#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1645 | +#line 1646 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1614 | 1646 | break; |
| 1615 | 1647 | |
| 1616 | − case 18: | |
| 1617 | −#line 211 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1648 | + case 22: | |
| 1649 | +#line 237 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1618 | 1650 | { |
| 1619 | 1651 | add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); |
| 1620 | 1652 | (yyval.prop) = (yyvsp[0].prop); |
| 1621 | 1653 | } |
| 1622 | −#line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1654 | +#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1623 | 1655 | break; |
| 1624 | 1656 | |
| 1625 | − case 19: | |
| 1626 | −#line 219 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1657 | + case 23: | |
| 1658 | +#line 245 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1627 | 1659 | { |
| 1628 | 1660 | (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); |
| 1629 | 1661 | } |
| 1630 | −#line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1662 | +#line 1663 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1631 | 1663 | break; |
| 1632 | 1664 | |
| 1633 | − case 20: | |
| 1634 | −#line 223 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1665 | + case 24: | |
| 1666 | +#line 249 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1635 | 1667 | { |
| 1636 | 1668 | (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); |
| 1637 | 1669 | } |
| 1638 | −#line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1670 | +#line 1671 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1639 | 1671 | break; |
| 1640 | 1672 | |
| 1641 | − case 21: | |
| 1642 | −#line 227 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1673 | + case 25: | |
| 1674 | +#line 253 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1643 | 1675 | { |
| 1644 | 1676 | (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); |
| 1645 | 1677 | } |
| 1646 | −#line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1678 | +#line 1679 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1647 | 1679 | break; |
| 1648 | 1680 | |
| 1649 | − case 22: | |
| 1650 | −#line 231 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1681 | + case 26: | |
| 1682 | +#line 257 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1651 | 1683 | { |
| 1652 | 1684 | (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); |
| 1653 | 1685 | } |
| 1654 | −#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1686 | +#line 1687 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1655 | 1687 | break; |
| 1656 | 1688 | |
| 1657 | − case 23: | |
| 1658 | −#line 235 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1689 | + case 27: | |
| 1690 | +#line 261 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1659 | 1691 | { |
| 1660 | 1692 | FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); |
| 1661 | 1693 | struct data d; |
| @@ -1671,11 +1703,11 @@ yyreduce: · 9 unmodified lines | ||
| 1671 | 1703 | (yyval.data) = data_merge((yyvsp[-8].data), d); |
| 1672 | 1704 | fclose(f); |
| 1673 | 1705 | } |
| 1674 | −#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1706 | +#line 1707 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1675 | 1707 | break; |
| 1676 | 1708 | |
| 1677 | − case 24: | |
| 1678 | −#line 251 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1709 | + case 28: | |
| 1710 | +#line 277 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1679 | 1711 | { |
| 1680 | 1712 | FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); |
| 1681 | 1713 | struct data d = empty_data; |
| @@ -1685,43 +1717,43 @@ yyreduce: · 3 unmodified lines | ||
| 1685 | 1717 | (yyval.data) = data_merge((yyvsp[-4].data), d); |
| 1686 | 1718 | fclose(f); |
| 1687 | 1719 | } |
| 1688 | −#line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1720 | +#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1689 | 1721 | break; |
| 1690 | 1722 | |
| 1691 | − case 25: | |
| 1692 | −#line 261 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1723 | + case 29: | |
| 1724 | +#line 287 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1693 | 1725 | { |
| 1694 | 1726 | (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); |
| 1695 | 1727 | } |
| 1696 | −#line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1728 | +#line 1729 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1697 | 1729 | break; |
| 1698 | 1730 | |
| 1699 | − case 26: | |
| 1700 | −#line 268 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1731 | + case 30: | |
| 1732 | +#line 294 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1701 | 1733 | { |
| 1702 | 1734 | (yyval.data) = empty_data; |
| 1703 | 1735 | } |
| 1704 | −#line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1736 | +#line 1737 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1705 | 1737 | break; |
| 1706 | 1738 | |
| 1707 | − case 27: | |
| 1708 | −#line 272 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1739 | + case 31: | |
| 1740 | +#line 298 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1709 | 1741 | { |
| 1710 | 1742 | (yyval.data) = (yyvsp[-1].data); |
| 1711 | 1743 | } |
| 1712 | −#line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1744 | +#line 1745 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1713 | 1745 | break; |
| 1714 | 1746 | |
| 1715 | − case 28: | |
| 1716 | −#line 276 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1747 | + case 32: | |
| 1748 | +#line 302 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1717 | 1749 | { |
| 1718 | 1750 | (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); |
| 1719 | 1751 | } |
| 1720 | −#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1752 | +#line 1753 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1721 | 1753 | break; |
| 1722 | 1754 | |
| 1723 | − case 29: | |
| 1724 | −#line 283 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1755 | + case 33: | |
| 1756 | +#line 309 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1725 | 1757 | { |
| 1726 | 1758 | unsigned long long bits; |
| 1727 | 1759 | |
| @@ -1737,20 +1769,20 @@ yyreduce: · 9 unmodified lines | ||
| 1737 | 1769 | (yyval.array).data = empty_data; |
| 1738 | 1770 | (yyval.array).bits = bits; |
| 1739 | 1771 | } |
| 1740 | −#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1772 | +#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1741 | 1773 | break; |
| 1742 | 1774 | |
| 1743 | − case 30: | |
| 1744 | −#line 299 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1775 | + case 34: | |
| 1776 | +#line 325 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1745 | 1777 | { |
| 1746 | 1778 | (yyval.array).data = empty_data; |
| 1747 | 1779 | (yyval.array).bits = 32; |
| 1748 | 1780 | } |
| 1749 | −#line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1781 | +#line 1782 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1750 | 1782 | break; |
| 1751 | 1783 | |
| 1752 | − case 31: | |
| 1753 | −#line 304 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1784 | + case 35: | |
| 1785 | +#line 330 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1754 | 1786 | { |
| 1755 | 1787 | if ((yyvsp[-1].array).bits < 64) { |
| 1756 | 1788 | uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; |
| @@ -1769,11 +1801,11 @@ yyreduce: · 12 unmodified lines | ||
| 1769 | 1801 | |
| 1770 | 1802 | (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); |
| 1771 | 1803 | } |
| 1772 | −#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1804 | +#line 1805 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1773 | 1805 | break; |
| 1774 | 1806 | |
| 1775 | − case 32: | |
| 1776 | −#line 323 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1807 | + case 36: | |
| 1808 | +#line 349 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1777 | 1809 | { |
| 1778 | 1810 | uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); |
| 1779 | 1811 | |
| @@ -1787,129 +1819,129 @@ yyreduce: · 7 unmodified lines | ||
| 1787 | 1819 | |
| 1788 | 1820 | (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); |
| 1789 | 1821 | } |
| 1790 | −#line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1822 | +#line 1823 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1791 | 1823 | break; |
| 1792 | 1824 | |
| 1793 | − case 33: | |
| 1794 | −#line 337 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1825 | + case 37: | |
| 1826 | +#line 363 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1795 | 1827 | { |
| 1796 | 1828 | (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); |
| 1797 | 1829 | } |
| 1798 | −#line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1830 | +#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1799 | 1831 | break; |
| 1800 | 1832 | |
| 1801 | − case 36: | |
| 1802 | −#line 346 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1833 | + case 40: | |
| 1834 | +#line 372 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1803 | 1835 | { |
| 1804 | 1836 | (yyval.integer) = (yyvsp[-1].integer); |
| 1805 | 1837 | } |
| 1806 | −#line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1838 | +#line 1839 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1807 | 1839 | break; |
| 1808 | 1840 | |
| 1809 | − case 39: | |
| 1810 | −#line 357 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1841 | + case 43: | |
| 1842 | +#line 383 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1811 | 1843 | { (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 */ | |
| 1813 | 1845 | break; |
| 1814 | 1846 | |
| 1815 | − case 41: | |
| 1816 | −#line 362 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1847 | + case 45: | |
| 1848 | +#line 388 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1817 | 1849 | { (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 */ | |
| 1819 | 1851 | break; |
| 1820 | 1852 | |
| 1821 | − case 43: | |
| 1822 | −#line 367 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1853 | + case 47: | |
| 1854 | +#line 393 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1823 | 1855 | { (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 */ | |
| 1825 | 1857 | break; |
| 1826 | 1858 | |
| 1827 | − case 45: | |
| 1828 | −#line 372 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1859 | + case 49: | |
| 1860 | +#line 398 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1829 | 1861 | { (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 */ | |
| 1831 | 1863 | break; |
| 1832 | 1864 | |
| 1833 | − case 47: | |
| 1834 | −#line 377 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1865 | + case 51: | |
| 1866 | +#line 403 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1835 | 1867 | { (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 */ | |
| 1837 | 1869 | break; |
| 1838 | 1870 | |
| 1839 | − case 49: | |
| 1840 | −#line 382 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1871 | + case 53: | |
| 1872 | +#line 408 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1841 | 1873 | { (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 */ | |
| 1843 | 1875 | break; |
| 1844 | 1876 | |
| 1845 | − case 51: | |
| 1846 | −#line 387 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1877 | + case 55: | |
| 1878 | +#line 413 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1847 | 1879 | { (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 */ | |
| 1849 | 1881 | break; |
| 1850 | 1882 | |
| 1851 | − case 52: | |
| 1852 | −#line 388 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1883 | + case 56: | |
| 1884 | +#line 414 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1853 | 1885 | { (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 */ | |
| 1855 | 1887 | break; |
| 1856 | 1888 | |
| 1857 | − case 54: | |
| 1858 | −#line 393 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1889 | + case 58: | |
| 1890 | +#line 419 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1859 | 1891 | { (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 */ | |
| 1861 | 1893 | break; |
| 1862 | 1894 | |
| 1863 | − case 55: | |
| 1864 | −#line 394 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1895 | + case 59: | |
| 1896 | +#line 420 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1865 | 1897 | { (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 */ | |
| 1867 | 1899 | break; |
| 1868 | 1900 | |
| 1869 | − case 56: | |
| 1870 | −#line 395 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1901 | + case 60: | |
| 1902 | +#line 421 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1871 | 1903 | { (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 */ | |
| 1873 | 1905 | break; |
| 1874 | 1906 | |
| 1875 | − case 57: | |
| 1876 | −#line 396 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1907 | + case 61: | |
| 1908 | +#line 422 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1877 | 1909 | { (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 */ | |
| 1879 | 1911 | break; |
| 1880 | 1912 | |
| 1881 | − case 58: | |
| 1882 | −#line 400 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1913 | + case 62: | |
| 1914 | +#line 426 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1883 | 1915 | { (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 */ | |
| 1885 | 1917 | break; |
| 1886 | 1918 | |
| 1887 | − case 59: | |
| 1888 | −#line 401 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1919 | + case 63: | |
| 1920 | +#line 427 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1889 | 1921 | { (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 */ | |
| 1891 | 1923 | break; |
| 1892 | 1924 | |
| 1893 | − case 61: | |
| 1894 | −#line 406 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1925 | + case 65: | |
| 1926 | +#line 432 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1895 | 1927 | { (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 */ | |
| 1897 | 1929 | break; |
| 1898 | 1930 | |
| 1899 | − case 62: | |
| 1900 | −#line 407 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1931 | + case 66: | |
| 1932 | +#line 433 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1901 | 1933 | { (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 */ | |
| 1903 | 1935 | break; |
| 1904 | 1936 | |
| 1905 | − case 64: | |
| 1906 | −#line 412 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1937 | + case 68: | |
| 1938 | +#line 438 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1907 | 1939 | { (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 */ | |
| 1909 | 1941 | break; |
| 1910 | 1942 | |
| 1911 | − case 65: | |
| 1912 | −#line 414 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1943 | + case 69: | |
| 1944 | +#line 440 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1913 | 1945 | { |
| 1914 | 1946 | if ((yyvsp[0].integer) != 0) { |
| 1915 | 1947 | (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); |
| @@ -1918,11 +1950,11 @@ yyreduce: · 2 unmodified lines | ||
| 1918 | 1950 | (yyval.integer) = 0; |
| 1919 | 1951 | } |
| 1920 | 1952 | } |
| 1921 | −#line 1922 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1953 | +#line 1954 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1922 | 1954 | break; |
| 1923 | 1955 | |
| 1924 | − case 66: | |
| 1925 | −#line 423 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1956 | + case 70: | |
| 1957 | +#line 449 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1926 | 1958 | { |
| 1927 | 1959 | if ((yyvsp[0].integer) != 0) { |
| 1928 | 1960 | (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); |
| @@ -1931,103 +1963,103 @@ yyreduce: · 2 unmodified lines | ||
| 1931 | 1963 | (yyval.integer) = 0; |
| 1932 | 1964 | } |
| 1933 | 1965 | } |
| 1934 | −#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1966 | +#line 1967 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1935 | 1967 | break; |
| 1936 | 1968 | |
| 1937 | − case 69: | |
| 1938 | −#line 436 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1969 | + case 73: | |
| 1970 | +#line 462 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1939 | 1971 | { (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 */ | |
| 1941 | 1973 | break; |
| 1942 | 1974 | |
| 1943 | − case 70: | |
| 1944 | −#line 437 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1975 | + case 74: | |
| 1976 | +#line 463 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1945 | 1977 | { (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 */ | |
| 1947 | 1979 | break; |
| 1948 | 1980 | |
| 1949 | − case 71: | |
| 1950 | −#line 438 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1981 | + case 75: | |
| 1982 | +#line 464 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1951 | 1983 | { (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 */ | |
| 1953 | 1985 | break; |
| 1954 | 1986 | |
| 1955 | − case 72: | |
| 1956 | −#line 443 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1987 | + case 76: | |
| 1988 | +#line 469 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1957 | 1989 | { |
| 1958 | 1990 | (yyval.data) = empty_data; |
| 1959 | 1991 | } |
| 1960 | −#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1992 | +#line 1993 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1961 | 1993 | break; |
| 1962 | 1994 | |
| 1963 | − case 73: | |
| 1964 | −#line 447 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1995 | + case 77: | |
| 1996 | +#line 473 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1965 | 1997 | { |
| 1966 | 1998 | (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); |
| 1967 | 1999 | } |
| 1968 | −#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2000 | +#line 2001 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1969 | 2001 | break; |
| 1970 | 2002 | |
| 1971 | − case 74: | |
| 1972 | −#line 451 "dtc-parser.y" /* yacc.c:1646 */ | |
| 2003 | + case 78: | |
| 2004 | +#line 477 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1973 | 2005 | { |
| 1974 | 2006 | (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); |
| 1975 | 2007 | } |
| 1976 | −#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2008 | +#line 2009 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1977 | 2009 | break; |
| 1978 | 2010 | |
| 1979 | − case 75: | |
| 1980 | −#line 458 "dtc-parser.y" /* yacc.c:1646 */ | |
| 2011 | + case 79: | |
| 2012 | +#line 484 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1981 | 2013 | { |
| 1982 | 2014 | (yyval.nodelist) = NULL; |
| 1983 | 2015 | } |
| 1984 | −#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2016 | +#line 2017 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1985 | 2017 | break; |
| 1986 | 2018 | |
| 1987 | − case 76: | |
| 1988 | −#line 462 "dtc-parser.y" /* yacc.c:1646 */ | |
| 2019 | + case 80: | |
| 2020 | +#line 488 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1989 | 2021 | { |
| 1990 | 2022 | (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); |
| 1991 | 2023 | } |
| 1992 | −#line 1993 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2024 | +#line 2025 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 1993 | 2025 | break; |
| 1994 | 2026 | |
| 1995 | − case 77: | |
| 1996 | −#line 466 "dtc-parser.y" /* yacc.c:1646 */ | |
| 2027 | + case 81: | |
| 2028 | +#line 492 "dtc-parser.y" /* yacc.c:1646 */ | |
| 1997 | 2029 | { |
| 1998 | 2030 | ERROR(&(yylsp[0]), "Properties must precede subnodes"); |
| 1999 | 2031 | YYERROR; |
| 2000 | 2032 | } |
| 2001 | −#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2033 | +#line 2034 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2002 | 2034 | break; |
| 2003 | 2035 | |
| 2004 | − case 78: | |
| 2005 | −#line 474 "dtc-parser.y" /* yacc.c:1646 */ | |
| 2036 | + case 82: | |
| 2037 | +#line 500 "dtc-parser.y" /* yacc.c:1646 */ | |
| 2006 | 2038 | { |
| 2007 | 2039 | (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); |
| 2008 | 2040 | } |
| 2009 | −#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2041 | +#line 2042 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2010 | 2042 | break; |
| 2011 | 2043 | |
| 2012 | − case 79: | |
| 2013 | −#line 478 "dtc-parser.y" /* yacc.c:1646 */ | |
| 2044 | + case 83: | |
| 2045 | +#line 504 "dtc-parser.y" /* yacc.c:1646 */ | |
| 2014 | 2046 | { |
| 2015 | 2047 | (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); |
| 2016 | 2048 | } |
| 2017 | −#line 2018 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2049 | +#line 2050 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2018 | 2050 | break; |
| 2019 | 2051 | |
| 2020 | − case 80: | |
| 2021 | −#line 482 "dtc-parser.y" /* yacc.c:1646 */ | |
| 2052 | + case 84: | |
| 2053 | +#line 508 "dtc-parser.y" /* yacc.c:1646 */ | |
| 2022 | 2054 | { |
| 2023 | 2055 | add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); |
| 2024 | 2056 | (yyval.node) = (yyvsp[0].node); |
| 2025 | 2057 | } |
| 2026 | −#line 2027 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2058 | +#line 2059 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2027 | 2059 | break; |
| 2028 | 2060 | |
| 2029 | 2061 | |
| 2030 | −#line 2031 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2062 | +#line 2063 "dtc-parser.tab.c" /* yacc.c:1646 */ | |
| 2031 | 2063 | default: break; |
| 2032 | 2064 | } |
| 2033 | 2065 | /* User semantic actions sometimes alter yychar, and that requires |
| @@ -2262,7 +2294,7 @@ yyreturn: · 228 unmodified lines | ||
| 2262 | 2294 | #endif |
| 2263 | 2295 | return yyresult; |
| 2264 | 2296 | } |
| 2265 | −#line 488 "dtc-parser.y" /* yacc.c:1906 */ | |
| 2297 | +#line 514 "dtc-parser.y" /* yacc.c:1906 */ | |
| 2266 | 2298 | |
| 2267 | 2299 | |
| 2268 | 2300 | void yyerror(char const *s) |
| @@ -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. */ | |
| 2 | 2 | |
| 3 | 3 | /* Bison interface for Yacc-like parsers in C |
| 4 | 4 | |
| 5 | − Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. | |
| 5 | + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. | |
| 6 | 6 | |
| 7 | 7 | This program is free software: you can redistribute it and/or modify |
| 8 | 8 | it under the terms of the GNU General Public License as published by |
| @@ -46,35 +46,36 @@ extern int yydebug; · 37 unmodified lines | ||
| 46 | 46 | enum yytokentype |
| 47 | 47 | { |
| 48 | 48 | 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 | |
| 69 | 70 | }; |
| 70 | 71 | #endif |
| 71 | 72 | |
| 72 | 73 | /* Value type. */ |
| 73 | 74 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| 74 | −typedef union YYSTYPE YYSTYPE; | |
| 75 | + | |
| 75 | 76 | union YYSTYPE |
| 76 | 77 | { |
| 77 | −#line 38 "dtc-parser.y" /* yacc.c:1909 */ | |
| 78 | +#line 39 "dtc-parser.y" /* yacc.c:1909 */ | |
| 78 | 79 | |
| 79 | 80 | char *propnodename; |
| 80 | 81 | char *labelref; |
| @@ -92,9 +93,12 @@ union YYSTYPE · 11 unmodified lines | ||
| 92 | 93 | struct node *nodelist; |
| 93 | 94 | struct reserve_info *re; |
| 94 | 95 | uint64_t integer; |
| 96 | + unsigned int flags; | |
| 95 | 97 | |
| 96 | −#line 97 "dtc-parser.tab.h" /* yacc.c:1909 */ | |
| 98 | +#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */ | |
| 97 | 99 | }; |
| 100 | + | |
| 101 | +typedef union YYSTYPE YYSTYPE; | |
| 98 | 102 | # define YYSTYPE_IS_TRIVIAL 1 |
| 99 | 103 | # define YYSTYPE_IS_DECLARED 1 |
| 100 | 104 | #endif |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | */ |
| 20 | 20 | %{ |
| 21 | 21 | #include <stdio.h> |
| 22 | +#include <inttypes.h> | |
| 22 | 23 | |
| 23 | 24 | #include "dtc.h" |
| 24 | 25 | #include "srcpos.h" |
| @@ -31,7 +32,7 @@ extern void yyerror(char const *s); · 6 unmodified lines | ||
| 31 | 32 | treesource_error = true; \ |
| 32 | 33 | } while (0) |
| 33 | 34 | |
| 34 | −extern struct boot_info *the_boot_info; | |
| 35 | +extern struct dt_info *parser_output; | |
| 35 | 36 | extern bool treesource_error; |
| 36 | 37 | %} |
| 37 | 38 | |
| @@ -52,9 +53,11 @@ extern bool treesource_error; · 14 unmodified lines | ||
| 52 | 53 | struct node *nodelist; |
| 53 | 54 | struct reserve_info *re; |
| 54 | 55 | uint64_t integer; |
| 56 | + unsigned int flags; | |
| 55 | 57 | } |
| 56 | 58 | |
| 57 | 59 | %token DT_V1 |
| 60 | +%token DT_PLUGIN | |
| 58 | 61 | %token DT_MEMRESERVE |
| 59 | 62 | %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR |
| 60 | 63 | %token DT_BITS |
| @@ -71,6 +74,8 @@ extern bool treesource_error; · 10 unmodified lines | ||
| 71 | 74 | |
| 72 | 75 | %type <data> propdata |
| 73 | 76 | %type <data> propdataprefix |
| 77 | +%type <flags> header | |
| 78 | +%type <flags> headers | |
| 74 | 79 | %type <re> memreserve |
| 75 | 80 | %type <re> memreserves |
| 76 | 81 | %type <array> arrayprefix |
| @@ -101,10 +106,31 @@ extern bool treesource_error; · 24 unmodified lines | ||
| 101 | 106 | %% |
| 102 | 107 | |
| 103 | 108 | sourcefile: |
| 104 | − DT_V1 ';' memreserves devicetree | |
| 109 | + headers memreserves devicetree | |
| 105 | 110 | { |
| 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; | |
| 108 | 134 | } |
| 109 | 135 | ; |
| 110 | 136 | |
| @@ -30,7 +30,16 @@ int quiet; /* Level of quietness */ · 29 unmodified lines | ||
| 30 | 30 | int reservenum; /* Number of memory reservation slots */ |
| 31 | 31 | int minsize; /* Minimum blob size */ |
| 32 | 32 | int padsize; /* Additional padding to blob */ |
| 33 | +int alignsize; /* Additional padding to blob accroding to the alignsize */ | |
| 33 | 34 | 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 | +} | |
| 34 | 43 | |
| 35 | 44 | static void fill_fullpaths(struct node *tree, const char *prefix) |
| 36 | 45 | { |
| @@ -53,7 +62,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix) · 16 unmodified lines | ||
| 53 | 62 | #define FDT_VERSION(version) _FDT_VERSION(version) |
| 54 | 63 | #define _FDT_VERSION(version) #version |
| 55 | 64 | 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"; | |
| 57 | 66 | static struct option const usage_long_opts[] = { |
| 58 | 67 | {"quiet", no_argument, NULL, 'q'}, |
| 59 | 68 | {"in-format", a_argument, NULL, 'I'}, |
| @@ -64,6 +73,7 @@ static struct option const usage_long_opts[] = { · 4 unmodified lines | ||
| 64 | 73 | {"reserve", a_argument, NULL, 'R'}, |
| 65 | 74 | {"space", a_argument, NULL, 'S'}, |
| 66 | 75 | {"pad", a_argument, NULL, 'p'}, |
| 76 | + {"align", a_argument, NULL, 'a'}, | |
| 67 | 77 | {"boot-cpu", a_argument, NULL, 'b'}, |
| 68 | 78 | {"force", no_argument, NULL, 'f'}, |
| 69 | 79 | {"include", a_argument, NULL, 'i'}, |
| @@ -71,6 +81,8 @@ static struct option const usage_long_opts[] = { · 1 unmodified line | ||
| 71 | 81 | {"phandle", a_argument, NULL, 'H'}, |
| 72 | 82 | {"warning", a_argument, NULL, 'W'}, |
| 73 | 83 | {"error", a_argument, NULL, 'E'}, |
| 84 | + {"symbols", no_argument, NULL, '@'}, | |
| 85 | + {"auto-alias", no_argument, NULL, 'A'}, | |
| 74 | 86 | {"help", no_argument, NULL, 'h'}, |
| 75 | 87 | {"version", no_argument, NULL, 'v'}, |
| 76 | 88 | {NULL, no_argument, NULL, 0x0}, |
| @@ -91,6 +103,7 @@ static const char * const usage_opts_help[] = { · 14 unmodified lines | ||
| 91 | 103 | "\n\tMake space for <number> reserve map entries (for dtb and asm output)", |
| 92 | 104 | "\n\tMake the blob at least <bytes> long (extra space)", |
| 93 | 105 | "\n\tAdd padding to the blob of <bytes> long (extra space)", |
| 106 | + "\n\tMake the blob align to the <bytes> (extra space)", | |
| 94 | 107 | "\n\tSet the physical boot cpu", |
| 95 | 108 | "\n\tTry to produce output even if the input tree has errors", |
| 96 | 109 | "\n\tAdd a path to search for include files", |
| @@ -101,6 +114,8 @@ static const char * const usage_opts_help[] = { · 4 unmodified lines | ||
| 101 | 114 | "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties", |
| 102 | 115 | "\n\tEnable/disable warnings (prefix with \"no-\")", |
| 103 | 116 | "\n\tEnable/disable errors (prefix with \"no-\")", |
| 117 | + "\n\tEnable generation of symbols", | |
| 118 | + "\n\tEnable auto-alias of labels", | |
| 104 | 119 | "\n\tPrint this help and exit", |
| 105 | 120 | "\n\tPrint version and exit", |
| 106 | 121 | NULL, |
| @@ -153,7 +168,7 @@ static const char *guess_input_format(const char *fname, const char *fallback) · 46 unmodified lines | ||
| 153 | 168 | |
| 154 | 169 | int main(int argc, char *argv[]) |
| 155 | 170 | { |
| 156 | − struct boot_info *bi; | |
| 171 | + struct dt_info *dti; | |
| 157 | 172 | const char *inform = NULL; |
| 158 | 173 | const char *outform = NULL; |
| 159 | 174 | const char *outname = "-"; |
| @@ -169,6 +184,7 @@ int main(int argc, char *argv[]) · 9 unmodified lines | ||
| 169 | 184 | reservenum = 0; |
| 170 | 185 | minsize = 0; |
| 171 | 186 | padsize = 0; |
| 187 | + alignsize = 0; | |
| 172 | 188 | |
| 173 | 189 | while ((opt = util_getopt_long()) != EOF) { |
| 174 | 190 | switch (opt) { |
| @@ -196,6 +212,12 @@ int main(int argc, char *argv[]) · 21 unmodified lines | ||
| 196 | 212 | case 'p': |
| 197 | 213 | padsize = strtol(optarg, NULL, 0); |
| 198 | 214 | 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; | |
| 199 | 221 | case 'f': |
| 200 | 222 | force = true; |
| 201 | 223 | break; |
| @@ -234,6 +256,13 @@ int main(int argc, char *argv[]) · 32 unmodified lines | ||
| 234 | 256 | parse_checks_option(false, true, optarg); |
| 235 | 257 | break; |
| 236 | 258 | |
| 259 | + case '@': | |
| 260 | + generate_symbols = 1; | |
| 261 | + break; | |
| 262 | + case 'A': | |
| 263 | + auto_label_aliases = 1; | |
| 264 | + break; | |
| 265 | + | |
| 237 | 266 | case 'h': |
| 238 | 267 | usage(NULL); |
| 239 | 268 | default: |
| @@ -272,11 +301,11 @@ int main(int argc, char *argv[]) · 32 unmodified lines | ||
| 272 | 301 | } |
| 273 | 302 | } |
| 274 | 303 | if (streq(inform, "dts")) |
| 275 | − bi = dt_from_source(arg); | |
| 304 | + dti = dt_from_source(arg); | |
| 276 | 305 | else if (streq(inform, "fs")) |
| 277 | − bi = dt_from_fs(arg); | |
| 306 | + dti = dt_from_fs(arg); | |
| 278 | 307 | else if(streq(inform, "dtb")) |
| 279 | − bi = dt_from_blob(arg); | |
| 308 | + dti = dt_from_blob(arg); | |
| 280 | 309 | else |
| 281 | 310 | die("Unknown input format \"%s\"\n", inform); |
| 282 | 311 | |
| @@ -286,13 +315,29 @@ int main(int argc, char *argv[]) · 3 unmodified lines | ||
| 286 | 315 | } |
| 287 | 316 | |
| 288 | 317 | 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 | + } | |
| 290 | 327 | |
| 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 | + } | |
| 293 | 338 | |
| 294 | 339 | if (sort) |
| 295 | − sort_tree(bi); | |
| 340 | + sort_tree(dti); | |
| 296 | 341 | |
| 297 | 342 | if (streq(outname, "-")) { |
| 298 | 343 | outf = stdout; |
| @@ -304,11 +349,11 @@ int main(int argc, char *argv[]) · 5 unmodified lines | ||
| 304 | 349 | } |
| 305 | 350 | |
| 306 | 351 | if (streq(outform, "dts")) { |
| 307 | − dt_to_source(outf, bi); | |
| 352 | + dt_to_source(outf, dti); | |
| 308 | 353 | } else if (streq(outform, "dtb")) { |
| 309 | − dt_to_blob(outf, bi, outversion); | |
| 354 | + dt_to_blob(outf, dti, outversion); | |
| 310 | 355 | } else if (streq(outform, "asm")) { |
| 311 | − dt_to_asm(outf, bi, outversion); | |
| 356 | + dt_to_asm(outf, dti, outversion); | |
| 312 | 357 | } else if (streq(outform, "null")) { |
| 313 | 358 | /* do nothing */ |
| 314 | 359 | } else { |
| @@ -53,7 +53,11 @@ extern int quiet; /* Level of quietness */ · 52 unmodified lines | ||
| 53 | 53 | extern int reservenum; /* Number of memory reservation slots */ |
| 54 | 54 | extern int minsize; /* Minimum blob size */ |
| 55 | 55 | extern int padsize; /* Additional padding to blob */ |
| 56 | +extern int alignsize; /* Additional padding to blob accroding to the alignsize */ | |
| 56 | 57 | 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 */ | |
| 57 | 61 | |
| 58 | 62 | #define PHANDLE_LEGACY 0x1 |
| 59 | 63 | #define PHANDLE_EPAPR 0x2 |
| @@ -201,6 +205,8 @@ void delete_property(struct property *prop); · 141 unmodified lines | ||
| 201 | 205 | void add_child(struct node *parent, struct node *child); |
| 202 | 206 | void delete_node_by_name(struct node *parent, char *name); |
| 203 | 207 | void delete_node(struct node *node); |
| 208 | +void append_to_property(struct node *node, | |
| 209 | + char *name, const void *data, int len); | |
| 204 | 210 | |
| 205 | 211 | const char *get_unitname(struct node *node); |
| 206 | 212 | 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 | ||
| 235 | 241 | struct reserve_info *new); |
| 236 | 242 | |
| 237 | 243 | |
| 238 | −struct boot_info { | |
| 244 | +struct dt_info { | |
| 245 | + unsigned int dtsflags; | |
| 239 | 246 | struct reserve_info *reservelist; |
| 240 | − struct node *dt; /* the device tree */ | |
| 241 | 247 | uint32_t boot_cpuid_phys; |
| 248 | + struct node *dt; /* the device tree */ | |
| 242 | 249 | }; |
| 243 | 250 | |
| 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); | |
| 247 | 262 | |
| 248 | 263 | /* Checks */ |
| 249 | 264 | |
| 250 | 265 | 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); | |
| 252 | 267 | |
| 253 | 268 | /* Flattened trees */ |
| 254 | 269 | |
| 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); | |
| 257 | 272 | |
| 258 | −struct boot_info *dt_from_blob(const char *fname); | |
| 273 | +struct dt_info *dt_from_blob(const char *fname); | |
| 259 | 274 | |
| 260 | 275 | /* Tree source */ |
| 261 | 276 | |
| 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); | |
| 264 | 279 | |
| 265 | 280 | /* FS trees */ |
| 266 | 281 | |
| 267 | −struct boot_info *dt_from_fs(const char *dirname); | |
| 282 | +struct dt_info *dt_from_fs(const char *dirname); | |
| 268 | 283 | |
| 269 | 284 | #endif /* _DTC_H */ |
| @@ -366,7 +366,7 @@ static void make_fdt_header(struct fdt_header *fdt, · 365 unmodified lines | ||
| 366 | 366 | fdt->size_dt_struct = cpu_to_fdt32(dtsize); |
| 367 | 367 | } |
| 368 | 368 | |
| 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) | |
| 370 | 370 | { |
| 371 | 371 | struct version_info *vi = NULL; |
| 372 | 372 | int i; |
| @@ -384,29 +384,36 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version) · 11 unmodified lines | ||
| 384 | 384 | if (!vi) |
| 385 | 385 | die("Unknown device tree blob version %d\n", version); |
| 386 | 386 | |
| 387 | − flatten_tree(bi->dt, &bin_emitter, &dtbuf, &strbuf, vi); | |
| 387 | + flatten_tree(dti->dt, &bin_emitter, &dtbuf, &strbuf, vi); | |
| 388 | 388 | bin_emit_cell(&dtbuf, FDT_END); |
| 389 | 389 | |
| 390 | − reservebuf = flatten_reserve_list(bi->reservelist, vi); | |
| 390 | + reservebuf = flatten_reserve_list(dti->reservelist, vi); | |
| 391 | 391 | |
| 392 | 392 | /* Make header */ |
| 393 | 393 | make_fdt_header(&fdt, vi, reservebuf.len, dtbuf.len, strbuf.len, |
| 394 | − bi->boot_cpuid_phys); | |
| 394 | + dti->boot_cpuid_phys); | |
| 395 | 395 | |
| 396 | 396 | /* |
| 397 | 397 | * If the user asked for more space than is used, adjust the totalsize. |
| 398 | 398 | */ |
| 399 | 399 | if (minsize > 0) { |
| 400 | 400 | 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 | + } | |
| 405 | 408 | } |
| 406 | 409 | |
| 407 | 410 | if (padsize > 0) |
| 408 | 411 | padlen = padsize; |
| 409 | 412 | |
| 413 | + if (alignsize > 0) | |
| 414 | + padlen = ALIGN(fdt32_to_cpu(fdt.totalsize) + padlen, alignsize) | |
| 415 | + - fdt32_to_cpu(fdt.totalsize); | |
| 416 | + | |
| 410 | 417 | if (padlen > 0) { |
| 411 | 418 | int tsize = fdt32_to_cpu(fdt.totalsize); |
| 412 | 419 | tsize += padlen; |
| @@ -460,7 +467,7 @@ static void dump_stringtable_asm(FILE *f, struct data strbuf) · 47 unmodified lines | ||
| 460 | 467 | } |
| 461 | 468 | } |
| 462 | 469 | |
| 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) | |
| 464 | 471 | { |
| 465 | 472 | struct version_info *vi = NULL; |
| 466 | 473 | int i; |
| @@ -500,7 +507,7 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version) · 33 unmodified lines | ||
| 500 | 507 | |
| 501 | 508 | if (vi->flags & FTF_BOOTCPUID) { |
| 502 | 509 | 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); | |
| 504 | 511 | } |
| 505 | 512 | |
| 506 | 513 | if (vi->flags & FTF_STRTABSIZE) { |
| @@ -530,7 +537,7 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version) · 23 unmodified lines | ||
| 530 | 537 | * Use .long on high and low halfs of u64s to avoid .quad |
| 531 | 538 | * as it appears .quad isn't available in some assemblers. |
| 532 | 539 | */ |
| 533 | − for (re = bi->reservelist; re; re = re->next) { | |
| 540 | + for (re = dti->reservelist; re; re = re->next) { | |
| 534 | 541 | struct label *l; |
| 535 | 542 | |
| 536 | 543 | 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 | ||
| 550 | 557 | fprintf(f, "\t.long\t0, 0\n\t.long\t0, 0\n"); |
| 551 | 558 | |
| 552 | 559 | 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); | |
| 554 | 561 | |
| 555 | 562 | fprintf(f, "\t/* FDT_END */\n"); |
| 556 | 563 | 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 | ||
| 572 | 579 | if (padsize > 0) { |
| 573 | 580 | fprintf(f, "\t.space\t%d, 0\n", padsize); |
| 574 | 581 | } |
| 582 | + if (alignsize > 0) | |
| 583 | + asm_emit_align(f, alignsize); | |
| 575 | 584 | emit_label(f, symprefix, "blob_abs_end"); |
| 576 | 585 | |
| 577 | 586 | data_free(strbuf); |
| @@ -797,11 +806,15 @@ static struct node *unflatten_tree(struct inbuf *dtbuf, · 219 unmodified lines | ||
| 797 | 806 | } |
| 798 | 807 | } while (val != FDT_END_NODE); |
| 799 | 808 | |
| 809 | + if (node->name != flatname) { | |
| 810 | + free(flatname); | |
| 811 | + } | |
| 812 | + | |
| 800 | 813 | return node; |
| 801 | 814 | } |
| 802 | 815 | |
| 803 | 816 | |
| 804 | −struct boot_info *dt_from_blob(const char *fname) | |
| 817 | +struct dt_info *dt_from_blob(const char *fname) | |
| 805 | 818 | { |
| 806 | 819 | FILE *f; |
| 807 | 820 | 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 | ||
| 929 | 942 | |
| 930 | 943 | fclose(f); |
| 931 | 944 | |
| 932 | − return build_boot_info(reservelist, tree, boot_cpuid_phys); | |
| 945 | + return build_dt_info(DTSF_V1, reservelist, tree, boot_cpuid_phys); | |
| 933 | 946 | } |
| @@ -79,13 +79,12 @@ static struct node *read_fstree(const char *dirname) · 78 unmodified lines | ||
| 79 | 79 | return tree; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | −struct boot_info *dt_from_fs(const char *dirname) | |
| 82 | +struct dt_info *dt_from_fs(const char *dirname) | |
| 83 | 83 | { |
| 84 | 84 | struct node *tree; |
| 85 | 85 | |
| 86 | 86 | tree = read_fstree(dirname); |
| 87 | 87 | tree = name_node(tree, ""); |
| 88 | 88 | |
| 89 | − return build_boot_info(NULL, tree, guess_boot_cpuid(tree)); | |
| 89 | + return build_dt_info(DTSF_V1, NULL, tree, guess_boot_cpuid(tree)); | |
| 90 | 90 | } |
| 91 | − | |
| @@ -7,5 +7,5 @@ LIBFDT_soname = libfdt.$(SHAREDLIB_EXT).1 · 6 unmodified lines | ||
| 7 | 7 | LIBFDT_INCLUDES = fdt.h libfdt.h libfdt_env.h |
| 8 | 8 | LIBFDT_VERSION = version.lds |
| 9 | 9 | 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 | |
| 11 | 11 | LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o) |
| @@ -88,6 +88,32 @@ static int _fdt_string_eq(const void *fdt, int stroffset, · 87 unmodified lines | ||
| 88 | 88 | return (strlen(p) == len) && (memcmp(p, s, len) == 0); |
| 89 | 89 | } |
| 90 | 90 | |
| 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 | + | |
| 91 | 117 | int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size) |
| 92 | 118 | { |
| 93 | 119 | FDT_CHECK_HEADER(fdt); |
| @@ -545,7 +571,7 @@ int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property) · 451 unmodified lines | ||
| 545 | 571 | |
| 546 | 572 | list = fdt_getprop(fdt, nodeoffset, property, &length); |
| 547 | 573 | if (!list) |
| 548 | − return -length; | |
| 574 | + return length; | |
| 549 | 575 | |
| 550 | 576 | end = list + length; |
| 551 | 577 | |
| @@ -571,7 +597,7 @@ int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property, · 19 unmodified lines | ||
| 571 | 597 | |
| 572 | 598 | list = fdt_getprop(fdt, nodeoffset, property, &length); |
| 573 | 599 | if (!list) |
| 574 | − return -length; | |
| 600 | + return length; | |
| 575 | 601 | |
| 576 | 602 | len = strlen(string) + 1; |
| 577 | 603 | end = list + length; |
| @@ -191,17 +191,13 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size) · 190 unmodified lines | ||
| 191 | 191 | int fdt_del_mem_rsv(void *fdt, int n) |
| 192 | 192 | { |
| 193 | 193 | struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n); |
| 194 | − int err; | |
| 195 | 194 | |
| 196 | 195 | FDT_RW_CHECK_HEADER(fdt); |
| 197 | 196 | |
| 198 | 197 | if (n >= fdt_num_mem_rsv(fdt)) |
| 199 | 198 | return -FDT_ERR_NOTFOUND; |
| 200 | 199 | |
| 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); | |
| 205 | 201 | } |
| 206 | 202 | |
| 207 | 203 | static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name, |
| @@ -69,6 +69,7 @@ static struct fdt_errtabent fdt_errtable[] = { · 68 unmodified lines | ||
| 69 | 69 | |
| 70 | 70 | FDT_ERRTABENT(FDT_ERR_BADOFFSET), |
| 71 | 71 | FDT_ERRTABENT(FDT_ERR_BADPATH), |
| 72 | + FDT_ERRTABENT(FDT_ERR_BADPHANDLE), | |
| 72 | 73 | FDT_ERRTABENT(FDT_ERR_BADSTATE), |
| 73 | 74 | |
| 74 | 75 | FDT_ERRTABENT(FDT_ERR_TRUNCATED), |
| @@ -76,6 +77,11 @@ static struct fdt_errtabent fdt_errtable[] = { · 1 unmodified line | ||
| 76 | 77 | FDT_ERRTABENT(FDT_ERR_BADVERSION), |
| 77 | 78 | FDT_ERRTABENT(FDT_ERR_BADSTRUCTURE), |
| 78 | 79 | 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), | |
| 79 | 85 | }; |
| 80 | 86 | #define FDT_ERRTABSIZE (sizeof(fdt_errtable) / sizeof(fdt_errtable[0])) |
| 81 | 87 | |
| @@ -55,21 +55,42 @@ · 54 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | #include "libfdt_internal.h" |
| 57 | 57 | |
| 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 | + | |
| 58 | 78 | int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, |
| 59 | 79 | const void *val, int len) |
| 60 | 80 | { |
| 61 | − void *propval; | |
| 81 | + const void *propval; | |
| 62 | 82 | int proplen; |
| 63 | 83 | |
| 64 | − propval = fdt_getprop_w(fdt, nodeoffset, name, &proplen); | |
| 84 | + propval = fdt_getprop(fdt, nodeoffset, name, &proplen); | |
| 65 | 85 | if (! propval) |
| 66 | 86 | return proplen; |
| 67 | 87 | |
| 68 | 88 | if (proplen != len) |
| 69 | 89 | return -FDT_ERR_NOSPACE; |
| 70 | 90 | |
| 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); | |
| 73 | 94 | } |
| 74 | 95 | |
| 75 | 96 | static void _fdt_nop_region(void *start, int len) |
| @@ -61,7 +61,7 @@ · 60 unmodified lines | ||
| 61 | 61 | #define FDT_ERR_NOTFOUND 1 |
| 62 | 62 | /* FDT_ERR_NOTFOUND: The requested node or property does not exist */ |
| 63 | 63 | #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 | |
| 65 | 65 | * already exists */ |
| 66 | 66 | #define FDT_ERR_NOSPACE 3 |
| 67 | 67 | /* FDT_ERR_NOSPACE: Operation needed to expand the device |
| @@ -79,8 +79,10 @@ · 11 unmodified lines | ||
| 79 | 79 | * (e.g. missing a leading / for a function which requires an |
| 80 | 80 | * absolute path) */ |
| 81 | 81 | #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. */ | |
| 84 | 86 | #define FDT_ERR_BADSTATE 7 |
| 85 | 87 | /* FDT_ERR_BADSTATE: Function was passed an incomplete device |
| 86 | 88 | * tree created by the sequential-write functions, which is |
| @@ -126,7 +128,16 @@ · 39 unmodified lines | ||
| 126 | 128 | * value. For example: a property expected to contain a string list |
| 127 | 129 | * is not NUL-terminated within the length of its value. */ |
| 128 | 130 | |
| 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 | |
| 130 | 141 | |
| 131 | 142 | /**********************************************************************/ |
| 132 | 143 | /* 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 | ||
| 168 | 179 | */ |
| 169 | 180 | int fdt_next_subnode(const void *fdt, int offset); |
| 170 | 181 | |
| 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 | + | |
| 171 | 210 | /**********************************************************************/ |
| 172 | 211 | /* General functions */ |
| 173 | 212 | /**********************************************************************/ |
| 174 | 213 | |
| 175 | 214 | #define fdt_get_header(fdt, field) \ |
| 176 | 215 | (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)) | |
| 178 | 217 | #define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize)) |
| 179 | 218 | #define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct)) |
| 180 | 219 | #define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings)) |
| 181 | 220 | #define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap)) |
| 182 | 221 | #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)) | |
| 186 | 225 | #define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct)) |
| 187 | 226 | |
| 188 | 227 | #define __fdt_set_hdr(name) \ |
| 189 | 228 | static inline void fdt_set_##name(void *fdt, uint32_t val) \ |
| 190 | 229 | { \ |
| 191 | − struct fdt_header *fdth = (struct fdt_header*)fdt; \ | |
| 230 | + struct fdt_header *fdth = (struct fdt_header *)fdt; \ | |
| 192 | 231 | fdth->name = cpu_to_fdt32(val); \ |
| 193 | 232 | } |
| 194 | 233 | __fdt_set_hdr(magic); |
| @@ -258,6 +297,21 @@ int fdt_move(const void *fdt, void *buf, int bufsize); · 63 unmodified lines | ||
| 258 | 297 | */ |
| 259 | 298 | const char *fdt_string(const void *fdt, int stroffset); |
| 260 | 299 | |
| 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 | + | |
| 261 | 315 | /** |
| 262 | 316 | * fdt_num_mem_rsv - retrieve the number of memory reserve map entries |
| 263 | 317 | * @fdt: pointer to the device tree blob |
| @@ -318,8 +372,9 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, · 54 unmodified lines | ||
| 318 | 372 | * returns: |
| 319 | 373 | * structure block offset of the requested subnode (>=0), on success |
| 320 | 374 | * -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, | |
| 323 | 378 | * -FDT_ERR_BADVERSION, |
| 324 | 379 | * -FDT_ERR_BADSTATE, |
| 325 | 380 | * -FDT_ERR_BADSTRUCTURE, |
| @@ -351,7 +406,8 @@ int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen); · 25 unmodified lines | ||
| 351 | 406 | * address). |
| 352 | 407 | * |
| 353 | 408 | * 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 | |
| 355 | 411 | * -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid |
| 356 | 412 | * -FDT_ERR_NOTFOUND, if the requested node does not exist |
| 357 | 413 | * -FDT_ERR_BADMAGIC, |
| @@ -375,10 +431,12 @@ int fdt_path_offset(const void *fdt, const char *path); · 17 unmodified lines | ||
| 375 | 431 | * |
| 376 | 432 | * returns: |
| 377 | 433 | * 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) | |
| 379 | 436 | * NULL, on error |
| 380 | 437 | * 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 | |
| 382 | 440 | * -FDT_ERR_BADMAGIC, |
| 383 | 441 | * -FDT_ERR_BADVERSION, |
| 384 | 442 | * -FDT_ERR_BADSTATE, standard meanings |
| @@ -426,6 +484,33 @@ int fdt_first_property_offset(const void *fdt, int nodeoffset); · 41 unmodified lines | ||
| 426 | 484 | */ |
| 427 | 485 | int fdt_next_property_offset(const void *fdt, int offset); |
| 428 | 486 | |
| 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 | + | |
| 429 | 514 | /** |
| 430 | 515 | * fdt_get_property_by_offset - retrieve the property at a given offset |
| 431 | 516 | * @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 | ||
| 490 | 575 | * NULL, on error |
| 491 | 576 | * if lenp is non-NULL, *lenp contains an error code (<0): |
| 492 | 577 | * -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 | |
| 494 | 580 | * -FDT_ERR_BADMAGIC, |
| 495 | 581 | * -FDT_ERR_BADVERSION, |
| 496 | 582 | * -FDT_ERR_BADSTATE, |
| @@ -554,6 +640,13 @@ const void *fdt_getprop_by_offset(const void *fdt, int offset, · 57 unmodified lines | ||
| 554 | 640 | */ |
| 555 | 641 | const void *fdt_getprop_namelen(const void *fdt, int nodeoffset, |
| 556 | 642 | 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 | +} | |
| 557 | 650 | |
| 558 | 651 | /** |
| 559 | 652 | * 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 | ||
| 575 | 668 | * NULL, on error |
| 576 | 669 | * if lenp is non-NULL, *lenp contains an error code (<0): |
| 577 | 670 | * -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 | |
| 579 | 673 | * -FDT_ERR_BADMAGIC, |
| 580 | 674 | * -FDT_ERR_BADVERSION, |
| 581 | 675 | * -FDT_ERR_BADSTATE, |
| @@ -617,7 +711,7 @@ const char *fdt_get_alias_namelen(const void *fdt, · 35 unmodified lines | ||
| 617 | 711 | const char *name, int namelen); |
| 618 | 712 | |
| 619 | 713 | /** |
| 620 | − * fdt_get_alias - retreive the path referenced by a given alias | |
| 714 | + * fdt_get_alias - retrieve the path referenced by a given alias | |
| 621 | 715 | * @fdt: pointer to the device tree blob |
| 622 | 716 | * @name: name of the alias th look up |
| 623 | 717 | * |
| @@ -647,7 +741,7 @@ const char *fdt_get_alias(const void *fdt, const char *name); · 23 unmodified lines | ||
| 647 | 741 | * 0, on success |
| 648 | 742 | * buf contains the absolute path of the node at |
| 649 | 743 | * 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 | |
| 651 | 745 | * -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1) |
| 652 | 746 | * characters and will not fit in the given buffer. |
| 653 | 747 | * -FDT_ERR_BADMAGIC, |
| @@ -677,11 +771,11 @@ int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen); · 23 unmodified lines | ||
| 677 | 771 | * structure from the start to nodeoffset. |
| 678 | 772 | * |
| 679 | 773 | * returns: |
| 680 | − | |
| 681 | 774 | * structure block offset of the node at node offset's ancestor |
| 682 | 775 | * 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 | |
| 685 | 779 | * -FDT_ERR_BADMAGIC, |
| 686 | 780 | * -FDT_ERR_BADVERSION, |
| 687 | 781 | * -FDT_ERR_BADSTATE, |
| @@ -703,7 +797,7 @@ int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, · 15 unmodified lines | ||
| 703 | 797 | * |
| 704 | 798 | * returns: |
| 705 | 799 | * 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 | |
| 707 | 801 | * -FDT_ERR_BADMAGIC, |
| 708 | 802 | * -FDT_ERR_BADVERSION, |
| 709 | 803 | * -FDT_ERR_BADSTATE, |
| @@ -726,7 +820,7 @@ int fdt_node_depth(const void *fdt, int nodeoffset); · 16 unmodified lines | ||
| 726 | 820 | * returns: |
| 727 | 821 | * structure block offset of the parent of the node at nodeoffset |
| 728 | 822 | * (>=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 | |
| 730 | 824 | * -FDT_ERR_BADMAGIC, |
| 731 | 825 | * -FDT_ERR_BADVERSION, |
| 732 | 826 | * -FDT_ERR_BADSTATE, |
| @@ -766,7 +860,7 @@ int fdt_parent_offset(const void *fdt, int nodeoffset); · 33 unmodified lines | ||
| 766 | 860 | * on success |
| 767 | 861 | * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the |
| 768 | 862 | * 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 | |
| 770 | 864 | * -FDT_ERR_BADMAGIC, |
| 771 | 865 | * -FDT_ERR_BADVERSION, |
| 772 | 866 | * -FDT_ERR_BADSTATE, |
| @@ -813,7 +907,7 @@ int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle); · 40 unmodified lines | ||
| 813 | 907 | * 1, if the node has a 'compatible' property, but it does not list |
| 814 | 908 | * the given string |
| 815 | 909 | * -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 | |
| 817 | 911 | * -FDT_ERR_BADMAGIC, |
| 818 | 912 | * -FDT_ERR_BADVERSION, |
| 819 | 913 | * -FDT_ERR_BADSTATE, |
| @@ -850,7 +944,7 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset, · 30 unmodified lines | ||
| 850 | 944 | * on success |
| 851 | 945 | * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the |
| 852 | 946 | * 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 | |
| 854 | 948 | * -FDT_ERR_BADMAGIC, |
| 855 | 949 | * -FDT_ERR_BADVERSION, |
| 856 | 950 | * -FDT_ERR_BADSTATE, |
| @@ -960,7 +1054,8 @@ const char *fdt_stringlist_get(const void *fdt, int nodeoffset, · 103 unmodified lines | ||
| 960 | 1054 | * returns: |
| 961 | 1055 | * 0 <= n < FDT_MAX_NCELLS, on success |
| 962 | 1056 | * 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 | |
| 964 | 1059 | * -FDT_ERR_BADMAGIC, |
| 965 | 1060 | * -FDT_ERR_BADVERSION, |
| 966 | 1061 | * -FDT_ERR_BADSTATE, |
| @@ -980,7 +1075,8 @@ int fdt_address_cells(const void *fdt, int nodeoffset); · 13 unmodified lines | ||
| 980 | 1075 | * returns: |
| 981 | 1076 | * 0 <= n < FDT_MAX_NCELLS, on success |
| 982 | 1077 | * 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 | |
| 984 | 1080 | * -FDT_ERR_BADMAGIC, |
| 985 | 1081 | * -FDT_ERR_BADVERSION, |
| 986 | 1082 | * -FDT_ERR_BADSTATE, |
| @@ -994,6 +1090,27 @@ int fdt_size_cells(const void *fdt, int nodeoffset); · 7 unmodified lines | ||
| 994 | 1090 | /* Write-in-place functions */ |
| 995 | 1091 | /**********************************************************************/ |
| 996 | 1092 | |
| 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 | + | |
| 997 | 1114 | /** |
| 998 | 1115 | * fdt_setprop_inplace - change a property's value, but not its size |
| 999 | 1116 | * @fdt: pointer to the device tree blob |
| @@ -1604,9 +1721,11 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset, · 604 unmodified lines | ||
| 1604 | 1721 | * change the offsets of some existing nodes. |
| 1605 | 1722 | |
| 1606 | 1723 | * 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 | |
| 1608 | 1726 | * -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 | |
| 1610 | 1729 | * -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of |
| 1611 | 1730 | * the given name |
| 1612 | 1731 | * -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 | ||
| 1644 | 1763 | */ |
| 1645 | 1764 | int fdt_del_node(void *fdt, int nodeoffset); |
| 1646 | 1765 | |
| 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 | + | |
| 1647 | 1797 | /**********************************************************************/ |
| 1648 | 1798 | /* Debugging / informational functions */ |
| 1649 | 1799 | /**********************************************************************/ |
| @@ -54,6 +54,7 @@ · 53 unmodified lines | ||
| 54 | 54 | |
| 55 | 55 | #include <stddef.h> |
| 56 | 56 | #include <stdint.h> |
| 57 | +#include <stdlib.h> | |
| 57 | 58 | #include <string.h> |
| 58 | 59 | |
| 59 | 60 | #ifdef __CHECKER__ |
| @@ -204,7 +204,7 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node) · 203 unmodified lines | ||
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | − /* if no collision occured, add child to the old node. */ | |
| 207 | + /* if no collision occurred, add child to the old node. */ | |
| 208 | 208 | if (new_child) |
| 209 | 209 | add_child(old_node, new_child); |
| 210 | 210 | } |
| @@ -296,6 +296,23 @@ void delete_node(struct node *node) · 85 unmodified lines | ||
| 296 | 296 | delete_labels(&node->labels); |
| 297 | 297 | } |
| 298 | 298 | |
| 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 | + | |
| 299 | 316 | struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size) |
| 300 | 317 | { |
| 301 | 318 | struct reserve_info *new = xmalloc(sizeof(*new)); |
| @@ -335,17 +352,19 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list, · 33 unmodified lines | ||
| 335 | 352 | return list; |
| 336 | 353 | } |
| 337 | 354 | |
| 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) | |
| 340 | 358 | { |
| 341 | − struct boot_info *bi; | |
| 359 | + struct dt_info *dti; | |
| 342 | 360 | |
| 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; | |
| 347 | 366 | |
| 348 | − return bi; | |
| 367 | + return dti; | |
| 349 | 368 | } |
| 350 | 369 | |
| 351 | 370 | /* |
| @@ -592,12 +611,12 @@ static int cmp_reserve_info(const void *ax, const void *bx) · 240 unmodified lines | ||
| 592 | 611 | return 0; |
| 593 | 612 | } |
| 594 | 613 | |
| 595 | −static void sort_reserve_entries(struct boot_info *bi) | |
| 614 | +static void sort_reserve_entries(struct dt_info *dti) | |
| 596 | 615 | { |
| 597 | 616 | struct reserve_info *ri, **tbl; |
| 598 | 617 | int n = 0, i = 0; |
| 599 | 618 | |
| 600 | − for (ri = bi->reservelist; | |
| 619 | + for (ri = dti->reservelist; | |
| 601 | 620 | ri; |
| 602 | 621 | ri = ri->next) |
| 603 | 622 | n++; |
| @@ -607,14 +626,14 @@ static void sort_reserve_entries(struct boot_info *bi) · 3 unmodified lines | ||
| 607 | 626 | |
| 608 | 627 | tbl = xmalloc(n * sizeof(*tbl)); |
| 609 | 628 | |
| 610 | − for (ri = bi->reservelist; | |
| 629 | + for (ri = dti->reservelist; | |
| 611 | 630 | ri; |
| 612 | 631 | ri = ri->next) |
| 613 | 632 | tbl[i++] = ri; |
| 614 | 633 | |
| 615 | 634 | qsort(tbl, n, sizeof(*tbl), cmp_reserve_info); |
| 616 | 635 | |
| 617 | − bi->reservelist = tbl[0]; | |
| 636 | + dti->reservelist = tbl[0]; | |
| 618 | 637 | for (i = 0; i < (n-1); i++) |
| 619 | 638 | tbl[i]->next = tbl[i+1]; |
| 620 | 639 | tbl[n-1]->next = NULL; |
| @@ -704,8 +723,256 @@ static void sort_node(struct node *node) · 83 unmodified lines | ||
| 704 | 723 | sort_node(c); |
| 705 | 724 | } |
| 706 | 725 | |
| 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) | |
| 708 | 837 | { |
| 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); | |
| 711 | 978 | } |
| @@ -246,46 +246,27 @@ srcpos_copy(struct srcpos *pos) · 245 unmodified lines | ||
| 246 | 246 | return pos_new; |
| 247 | 247 | } |
| 248 | 248 | |
| 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 | − | |
| 264 | 249 | char * |
| 265 | 250 | srcpos_string(struct srcpos *pos) |
| 266 | 251 | { |
| 267 | 252 | const char *fname = "<no-file>"; |
| 268 | 253 | char *pos_str; |
| 269 | − int rc; | |
| 270 | 254 | |
| 271 | 255 | if (pos) |
| 272 | 256 | fname = pos->file->name; |
| 273 | 257 | |
| 274 | 258 | |
| 275 | 259 | 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); | |
| 279 | 263 | 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); | |
| 283 | 267 | 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); | |
| 289 | 270 | |
| 290 | 271 | return pos_str; |
| 291 | 272 | } |
| @@ -105,7 +105,6 @@ extern struct srcpos srcpos_empty; · 104 unmodified lines | ||
| 105 | 105 | extern void srcpos_update(struct srcpos *pos, const char *text, int len); |
| 106 | 106 | extern struct srcpos *srcpos_copy(struct srcpos *pos); |
| 107 | 107 | extern char *srcpos_string(struct srcpos *pos); |
| 108 | −extern void srcpos_dump(struct srcpos *pos); | |
| 109 | 108 | |
| 110 | 109 | extern void srcpos_verror(struct srcpos *pos, const char *prefix, |
| 111 | 110 | const char *fmt, va_list va) |
| @@ -25,12 +25,12 @@ extern FILE *yyin; · 24 unmodified lines | ||
| 25 | 25 | extern int yyparse(void); |
| 26 | 26 | extern YYLTYPE yylloc; |
| 27 | 27 | |
| 28 | −struct boot_info *the_boot_info; | |
| 28 | +struct dt_info *parser_output; | |
| 29 | 29 | bool treesource_error; |
| 30 | 30 | |
| 31 | −struct boot_info *dt_from_source(const char *fname) | |
| 31 | +struct dt_info *dt_from_source(const char *fname) | |
| 32 | 32 | { |
| 33 | − the_boot_info = NULL; | |
| 33 | + parser_output = NULL; | |
| 34 | 34 | treesource_error = false; |
| 35 | 35 | |
| 36 | 36 | srcfile_push(fname); |
| @@ -43,7 +43,7 @@ struct boot_info *dt_from_source(const char *fname) · 6 unmodified lines | ||
| 43 | 43 | if (treesource_error) |
| 44 | 44 | die("Syntax error parsing input tree\n"); |
| 45 | 45 | |
| 46 | − return the_boot_info; | |
| 46 | + return parser_output; | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | 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 | ||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | |
| 266 | −void dt_to_source(FILE *f, struct boot_info *bi) | |
| 266 | +void dt_to_source(FILE *f, struct dt_info *dti) | |
| 267 | 267 | { |
| 268 | 268 | struct reserve_info *re; |
| 269 | 269 | |
| 270 | 270 | fprintf(f, "/dts-v1/;\n\n"); |
| 271 | 271 | |
| 272 | − for (re = bi->reservelist; re; re = re->next) { | |
| 272 | + for (re = dti->reservelist; re; re = re->next) { | |
| 273 | 273 | struct label *l; |
| 274 | 274 | |
| 275 | 275 | for_each_label(re->labels, l) |
| @@ -279,6 +279,6 @@ void dt_to_source(FILE *f, struct boot_info *bi) · 3 unmodified lines | ||
| 279 | 279 | (unsigned long long)re->re.size); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | − write_tree_source_node(f, bi->dt, 0); | |
| 282 | + write_tree_source_node(f, dti->dt, 0); | |
| 283 | 283 | } |
| 284 | 284 | |
| @@ -46,6 +46,36 @@ char *xstrdup(const char *s) · 45 unmodified lines | ||
| 46 | 46 | return d; |
| 47 | 47 | } |
| 48 | 48 | |
| 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 | + | |
| 49 | 79 | char *join_path(const char *path, const char *name) |
| 50 | 80 | { |
| 51 | 81 | int lenp = strlen(path); |
| @@ -59,6 +59,7 @@ static inline void *xrealloc(void *p, size_t len) · 58 unmodified lines | ||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | extern char *xstrdup(const char *s); |
| 62 | +extern int xasprintf(char **strp, const char *fmt, ...); | |
| 62 | 63 | extern char *join_path(const char *path, const char *name); |
| 63 | 64 | |
| 64 | 65 | /** |
| @@ -1 +1 @@ | ||
| 1 | −#define DTC_VERSION "DTC 1.4.1-g53bf130b" | |
| 1 | +#define DTC_VERSION "DTC 1.4.2-g0931cea3" | |