diff options
| author | Rob Herring <robh@kernel.org> | 2017-03-21 10:01:08 -0400 |
|---|---|---|
| committer | Rob Herring <robh@kernel.org> | 2017-03-22 15:56:14 -0400 |
| commit | 89d123106a97bf412a4c10482044c822f4b069f7 (patch) | |
| tree | 35603f528aedddff67a643b957f2803601a03f95 /scripts | |
| parent | 86cef6144d273404d8cb5c0b215ada8d23e5dbeb (diff) | |
scripts/dtc: Update to upstream version v1.4.4-8-g756ffc4f52f6
This adds the following commits from upstream:
756ffc4f52f6 Build pylibfdt as part of the normal build process
8cb3896358e9 Adjust libfdt.h to work with swig
b40aa8359aff Mention pylibfdt in the documentation
12cfb740cc76 Add tests for pylibfdt
50f250701631 Add an initial Python library for libfdt
cdbb2b6c7a3a checks: Warn on node name unit-addresses with '0x' or leading 0s
4c15d5da17cc checks: Add bus checks for simple-bus buses
33c3985226d3 checks: Add bus checks for PCI buses
558cd81bdd43 dtc: Bump version to v1.4.4
c17a811c62eb fdtput: Remove star from value_len documentation
194d5caaefcb fdtget: Use @return to document the return value
d922ecdd017b tests: Make realloc_fdt() really allocate *fdt
921cc17fec29 libfdt: overlay: Check the value of the right variable
9ffdf60bf463 dtc: Simplify asm_emit_string() implementation
881012e44386 libfdt: Change names of sparse helper macros
bad5b28049e5 Fix assorted sparse warnings
672ac09ea04d Clean up gcc attributes
49300f2ade6a dtc: Don't abuse struct fdt_reserve_entry
fa8bc7f928ac dtc: Bump version to v1.4.3
34a9886a177f Add printf format attributes
f72508e2b6ca Correct some broken printf() like format mismatches
397d5ef0203c libfdt: Add fdt_setprop_empty()
69a1bd6ad3f9 libfdt: Remove undefined behaviour setting empty properties
acd1b534a592 Print output filename as part of warning messages
120775eb1cf3 dtc: Use streq() in preference to strcmp()
852e9ecbe197 checks: Add Warning for stricter node name character checking
ef0e8f061534 checks: Add Warning for stricter property name character checking
00d7bb1f4b0e dtc: pos parameter to srcpos_string() can't be NULL
95d57726bca4 livetree.c: Fix memory leak
3b9c97093d6e dtc: Fix NULL pointer use in dtlabel + dtref case
43eb551426ea manual: Fix typo it -> in
4baf15f7f13f Makefile: Add tags rule
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/dtc/checks.c | 361 | ||||
| -rw-r--r-- | scripts/dtc/data.c | 16 | ||||
| -rw-r--r-- | scripts/dtc/dtc-lexer.l | 3 | ||||
| -rw-r--r-- | scripts/dtc/dtc-lexer.lex.c_shipped | 77 | ||||
| -rw-r--r-- | scripts/dtc/dtc-parser.tab.c_shipped | 6 | ||||
| -rw-r--r-- | scripts/dtc/dtc-parser.y | 6 | ||||
| -rw-r--r-- | scripts/dtc/dtc.c | 9 | ||||
| -rw-r--r-- | scripts/dtc/dtc.h | 11 | ||||
| -rw-r--r-- | scripts/dtc/flattree.c | 58 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/fdt_rw.c | 3 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/libfdt.h | 51 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/libfdt_env.h | 26 | ||||
| -rw-r--r-- | scripts/dtc/livetree.c | 22 | ||||
| -rw-r--r-- | scripts/dtc/srcpos.c | 2 | ||||
| -rw-r--r-- | scripts/dtc/srcpos.h | 11 | ||||
| -rw-r--r-- | scripts/dtc/treesource.c | 6 | ||||
| -rw-r--r-- | scripts/dtc/util.c | 11 | ||||
| -rw-r--r-- | scripts/dtc/util.h | 24 | ||||
| -rw-r--r-- | scripts/dtc/version_gen.h | 2 |
19 files changed, 523 insertions, 182 deletions
diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c index 3d18e45374c8..5adfc8f52b4f 100644 --- a/scripts/dtc/checks.c +++ b/scripts/dtc/checks.c | |||
| @@ -72,17 +72,16 @@ struct check { | |||
| 72 | #define CHECK(_nm, _fn, _d, ...) \ | 72 | #define CHECK(_nm, _fn, _d, ...) \ |
| 73 | CHECK_ENTRY(_nm, _fn, _d, false, false, __VA_ARGS__) | 73 | CHECK_ENTRY(_nm, _fn, _d, false, false, __VA_ARGS__) |
| 74 | 74 | ||
| 75 | #ifdef __GNUC__ | 75 | static inline void PRINTF(3, 4) check_msg(struct check *c, struct dt_info *dti, |
| 76 | static inline void check_msg(struct check *c, const char *fmt, ...) __attribute__((format (printf, 2, 3))); | 76 | const char *fmt, ...) |
| 77 | #endif | ||
| 78 | static inline void check_msg(struct check *c, const char *fmt, ...) | ||
| 79 | { | 77 | { |
| 80 | va_list ap; | 78 | va_list ap; |
| 81 | va_start(ap, fmt); | 79 | va_start(ap, fmt); |
| 82 | 80 | ||
| 83 | if ((c->warn && (quiet < 1)) | 81 | if ((c->warn && (quiet < 1)) |
| 84 | || (c->error && (quiet < 2))) { | 82 | || (c->error && (quiet < 2))) { |
| 85 | fprintf(stderr, "%s (%s): ", | 83 | fprintf(stderr, "%s: %s (%s): ", |
| 84 | strcmp(dti->outname, "-") ? dti->outname : "<stdout>", | ||
| 86 | (c->error) ? "ERROR" : "Warning", c->name); | 85 | (c->error) ? "ERROR" : "Warning", c->name); |
| 87 | vfprintf(stderr, fmt, ap); | 86 | vfprintf(stderr, fmt, ap); |
| 88 | fprintf(stderr, "\n"); | 87 | fprintf(stderr, "\n"); |
| @@ -90,11 +89,11 @@ static inline void check_msg(struct check *c, const char *fmt, ...) | |||
| 90 | va_end(ap); | 89 | va_end(ap); |
| 91 | } | 90 | } |
| 92 | 91 | ||
| 93 | #define FAIL(c, ...) \ | 92 | #define FAIL(c, dti, ...) \ |
| 94 | do { \ | 93 | do { \ |
| 95 | TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \ | 94 | TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \ |
| 96 | (c)->status = FAILED; \ | 95 | (c)->status = FAILED; \ |
| 97 | check_msg((c), __VA_ARGS__); \ | 96 | check_msg((c), dti, __VA_ARGS__); \ |
| 98 | } while (0) | 97 | } while (0) |
| 99 | 98 | ||
| 100 | static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node) | 99 | static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node) |
| @@ -127,7 +126,7 @@ static bool run_check(struct check *c, struct dt_info *dti) | |||
| 127 | error = error || run_check(prq, dti); | 126 | error = error || run_check(prq, dti); |
| 128 | if (prq->status != PASSED) { | 127 | if (prq->status != PASSED) { |
| 129 | c->status = PREREQ; | 128 | c->status = PREREQ; |
| 130 | check_msg(c, "Failed prerequisite '%s'", | 129 | check_msg(c, dti, "Failed prerequisite '%s'", |
| 131 | c->prereq[i]->name); | 130 | c->prereq[i]->name); |
| 132 | } | 131 | } |
| 133 | } | 132 | } |
| @@ -157,7 +156,7 @@ out: | |||
| 157 | static inline void check_always_fail(struct check *c, struct dt_info *dti, | 156 | static inline void check_always_fail(struct check *c, struct dt_info *dti, |
| 158 | struct node *node) | 157 | struct node *node) |
| 159 | { | 158 | { |
| 160 | FAIL(c, "always_fail check"); | 159 | FAIL(c, dti, "always_fail check"); |
| 161 | } | 160 | } |
| 162 | CHECK(always_fail, check_always_fail, NULL); | 161 | CHECK(always_fail, check_always_fail, NULL); |
| 163 | 162 | ||
| @@ -172,7 +171,7 @@ static void check_is_string(struct check *c, struct dt_info *dti, | |||
| 172 | return; /* Not present, assumed ok */ | 171 | return; /* Not present, assumed ok */ |
| 173 | 172 | ||
| 174 | if (!data_is_one_string(prop->val)) | 173 | if (!data_is_one_string(prop->val)) |
| 175 | FAIL(c, "\"%s\" property in %s is not a string", | 174 | FAIL(c, dti, "\"%s\" property in %s is not a string", |
| 176 | propname, node->fullpath); | 175 | propname, node->fullpath); |
| 177 | } | 176 | } |
| 178 | #define WARNING_IF_NOT_STRING(nm, propname) \ | 177 | #define WARNING_IF_NOT_STRING(nm, propname) \ |
| @@ -191,7 +190,7 @@ static void check_is_cell(struct check *c, struct dt_info *dti, | |||
| 191 | return; /* Not present, assumed ok */ | 190 | return; /* Not present, assumed ok */ |
| 192 | 191 | ||
| 193 | if (prop->val.len != sizeof(cell_t)) | 192 | if (prop->val.len != sizeof(cell_t)) |
| 194 | FAIL(c, "\"%s\" property in %s is not a single cell", | 193 | FAIL(c, dti, "\"%s\" property in %s is not a single cell", |
| 195 | propname, node->fullpath); | 194 | propname, node->fullpath); |
| 196 | } | 195 | } |
| 197 | #define WARNING_IF_NOT_CELL(nm, propname) \ | 196 | #define WARNING_IF_NOT_CELL(nm, propname) \ |
| @@ -213,7 +212,7 @@ static void check_duplicate_node_names(struct check *c, struct dt_info *dti, | |||
| 213 | child2; | 212 | child2; |
| 214 | child2 = child2->next_sibling) | 213 | child2 = child2->next_sibling) |
| 215 | if (streq(child->name, child2->name)) | 214 | if (streq(child->name, child2->name)) |
| 216 | FAIL(c, "Duplicate node name %s", | 215 | FAIL(c, dti, "Duplicate node name %s", |
| 217 | child->fullpath); | 216 | child->fullpath); |
| 218 | } | 217 | } |
| 219 | ERROR(duplicate_node_names, check_duplicate_node_names, NULL); | 218 | ERROR(duplicate_node_names, check_duplicate_node_names, NULL); |
| @@ -228,7 +227,7 @@ static void check_duplicate_property_names(struct check *c, struct dt_info *dti, | |||
| 228 | if (prop2->deleted) | 227 | if (prop2->deleted) |
| 229 | continue; | 228 | continue; |
| 230 | if (streq(prop->name, prop2->name)) | 229 | if (streq(prop->name, prop2->name)) |
| 231 | FAIL(c, "Duplicate property name %s in %s", | 230 | FAIL(c, dti, "Duplicate property name %s in %s", |
| 232 | prop->name, node->fullpath); | 231 | prop->name, node->fullpath); |
| 233 | } | 232 | } |
| 234 | } | 233 | } |
| @@ -239,6 +238,7 @@ ERROR(duplicate_property_names, check_duplicate_property_names, NULL); | |||
| 239 | #define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | 238 | #define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 240 | #define DIGITS "0123456789" | 239 | #define DIGITS "0123456789" |
| 241 | #define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-" | 240 | #define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-" |
| 241 | #define PROPNODECHARSSTRICT LOWERCASE UPPERCASE DIGITS ",-" | ||
| 242 | 242 | ||
| 243 | static void check_node_name_chars(struct check *c, struct dt_info *dti, | 243 | static void check_node_name_chars(struct check *c, struct dt_info *dti, |
| 244 | struct node *node) | 244 | struct node *node) |
| @@ -246,16 +246,27 @@ static void check_node_name_chars(struct check *c, struct dt_info *dti, | |||
| 246 | int n = strspn(node->name, c->data); | 246 | int n = strspn(node->name, c->data); |
| 247 | 247 | ||
| 248 | if (n < strlen(node->name)) | 248 | if (n < strlen(node->name)) |
| 249 | FAIL(c, "Bad character '%c' in node %s", | 249 | FAIL(c, dti, "Bad character '%c' in node %s", |
| 250 | node->name[n], node->fullpath); | 250 | node->name[n], node->fullpath); |
| 251 | } | 251 | } |
| 252 | ERROR(node_name_chars, check_node_name_chars, PROPNODECHARS "@"); | 252 | ERROR(node_name_chars, check_node_name_chars, PROPNODECHARS "@"); |
| 253 | 253 | ||
| 254 | static void check_node_name_chars_strict(struct check *c, struct dt_info *dti, | ||
| 255 | struct node *node) | ||
| 256 | { | ||
| 257 | int n = strspn(node->name, c->data); | ||
| 258 | |||
| 259 | if (n < node->basenamelen) | ||
| 260 | FAIL(c, dti, "Character '%c' not recommended in node %s", | ||
| 261 | node->name[n], node->fullpath); | ||
| 262 | } | ||
| 263 | CHECK(node_name_chars_strict, check_node_name_chars_strict, PROPNODECHARSSTRICT); | ||
| 264 | |||
| 254 | static void check_node_name_format(struct check *c, struct dt_info *dti, | 265 | static void check_node_name_format(struct check *c, struct dt_info *dti, |
| 255 | struct node *node) | 266 | struct node *node) |
| 256 | { | 267 | { |
| 257 | if (strchr(get_unitname(node), '@')) | 268 | if (strchr(get_unitname(node), '@')) |
| 258 | FAIL(c, "Node %s has multiple '@' characters in name", | 269 | FAIL(c, dti, "Node %s has multiple '@' characters in name", |
| 259 | node->fullpath); | 270 | node->fullpath); |
| 260 | } | 271 | } |
| 261 | ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars); | 272 | ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars); |
| @@ -274,11 +285,11 @@ static void check_unit_address_vs_reg(struct check *c, struct dt_info *dti, | |||
| 274 | 285 | ||
| 275 | if (prop) { | 286 | if (prop) { |
| 276 | if (!unitname[0]) | 287 | if (!unitname[0]) |
| 277 | FAIL(c, "Node %s has a reg or ranges property, but no unit name", | 288 | FAIL(c, dti, "Node %s has a reg or ranges property, but no unit name", |
| 278 | node->fullpath); | 289 | node->fullpath); |
| 279 | } else { | 290 | } else { |
