diff options
| author | Rob Herring <robh@kernel.org> | 2018-02-27 18:40:38 -0500 |
|---|---|---|
| committer | Rob Herring <robh@kernel.org> | 2018-03-05 21:58:17 -0500 |
| commit | 9130ba884640328bb78aaa4840e5ddf06ccafb1c (patch) | |
| tree | 078f18589cd0b7c09f4d918f75d67644b15d2e22 /scripts | |
| parent | e039139be8c25145b103ab365ff1bd4a540066a3 (diff) | |
scripts/dtc: Update to upstream version v1.4.6-9-gaadd0b65c987
This adds the following commits from upstream:
aadd0b65c987 checks: centralize printing of property names in failure messages
88960e398907 checks: centralize printing of node path in check_msg
f1879e1a50eb Add limited read-only support for older (V2 and V3) device tree to libfdt.
37dea76e9700 srcpos: drop special handling of tab
65893da4aee0 libfdt: overlay: Add missing license
962a45ca034d Avoid installing pylibfdt when dependencies are missing
cd6ea1b2bea6 Makefile: Split INSTALL out into INSTALL_{PROGRAM,LIB,DATA,SCRIPT}
51b3a16338df Makefile.tests: Add LIBDL make(1) variable for portability sake
333d533a8f4d Attempt to auto-detect stat(1) being used if not given proper invocation
e54388015af1 dtc: Bump version to v1.4.6
a1fe86f380cb fdtoverlay: Switch from using alloca to malloc
c8d5472de3ff tests: Improve compatibility with other platforms
c81d389a10cc checks: add chosen node checks
e671852042a7 checks: add aliases node checks
d0c44ebe3f42 checks: check for #{size,address}-cells without child nodes
18a3d84bb802 checks: add string list check for *-names properties
8fe94fd6f19f checks: add string list check
6c5730819604 checks: add a string check for 'label' property
a384191eba09 checks: fix sound-dai phandle with arg property check
b260c4f610c0 Fix ambiguous grammar for devicetree rule
fe667e382bac tests: Add some basic tests for the pci_bridge checks
7975f6422260 Fix widespread incorrect use of strneq(), replace with new strprefixeq()
fca296445eab Add strstarts() helper function
cc392f089007 tests: Check non-matching cases for fdt_node_check_compatible()
bba26a5291c8 livetree: avoid assertion of orphan phandles with overlays
c8f8194d76cc implement strnlen for systems that need it
c8b38f65fdec libfdt: Remove leading underscores from identifiers
3b62fdaebfe5 Remove leading underscores from identifiers
2d45d1c5c65e Replace FDT_VERSION() with stringify()
2e6fe5a107b5 Fix some errors in comments
b0ae9e4b0ceb tests: Correct warning in sw_tree1.c
Commit c8b38f65fdec upstream ("libfdt: Remove leading underscores from
identifiers") changed the multiple inclusion define protection, so the
kernel's libfdt_env.h needs the corresponding update.
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/dtc/checks.c | 439 | ||||
| -rw-r--r-- | scripts/dtc/dtc-parser.y | 17 | ||||
| -rw-r--r-- | scripts/dtc/dtc.c | 7 | ||||
| -rw-r--r-- | scripts/dtc/dtc.h | 11 | ||||
| -rw-r--r-- | scripts/dtc/flattree.c | 2 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/fdt.c | 13 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/fdt.h | 6 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/fdt_overlay.c | 51 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/fdt_ro.c | 132 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/fdt_rw.c | 90 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/fdt_sw.c | 24 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/fdt_wip.c | 10 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/libfdt.h | 37 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/libfdt_env.h | 33 | ||||
| -rw-r--r-- | scripts/dtc/libfdt/libfdt_internal.h | 32 | ||||
| -rw-r--r-- | scripts/dtc/livetree.c | 10 | ||||
| -rw-r--r-- | scripts/dtc/srcpos.c | 5 | ||||
| -rw-r--r-- | scripts/dtc/srcpos.h | 6 | ||||
| -rw-r--r-- | scripts/dtc/util.h | 9 | ||||
| -rw-r--r-- | scripts/dtc/version_gen.h | 2 |
20 files changed, 619 insertions, 317 deletions
diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c index e66138449886..c07ba4da9e36 100644 --- a/scripts/dtc/checks.c +++ b/scripts/dtc/checks.c | |||
| @@ -53,26 +53,28 @@ struct check { | |||
| 53 | struct check **prereq; | 53 | struct check **prereq; |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | #define CHECK_ENTRY(_nm, _fn, _d, _w, _e, ...) \ | 56 | #define CHECK_ENTRY(nm_, fn_, d_, w_, e_, ...) \ |
| 57 | static struct check *_nm##_prereqs[] = { __VA_ARGS__ }; \ | 57 | static struct check *nm_##_prereqs[] = { __VA_ARGS__ }; \ |
| 58 | static struct check _nm = { \ | 58 | static struct check nm_ = { \ |
| 59 | .name = #_nm, \ | 59 | .name = #nm_, \ |
| 60 | .fn = (_fn), \ | 60 | .fn = (fn_), \ |
| 61 | .data = (_d), \ | 61 | .data = (d_), \ |
| 62 | .warn = (_w), \ | 62 | .warn = (w_), \ |
| 63 | .error = (_e), \ | 63 | .error = (e_), \ |
| 64 | .status = UNCHECKED, \ | 64 | .status = UNCHECKED, \ |
| 65 | .num_prereqs = ARRAY_SIZE(_nm##_prereqs), \ | 65 | .num_prereqs = ARRAY_SIZE(nm_##_prereqs), \ |
| 66 | .prereq = _nm##_prereqs, \ | 66 | .prereq = nm_##_prereqs, \ |
| 67 | }; | 67 | }; |
| 68 | #define WARNING(_nm, _fn, _d, ...) \ | 68 | #define WARNING(nm_, fn_, d_, ...) \ |
| 69 | CHECK_ENTRY(_nm, _fn, _d, true, false, __VA_ARGS__) | 69 | CHECK_ENTRY(nm_, fn_, d_, true, false, __VA_ARGS__) |
| 70 | #define ERROR(_nm, _fn, _d, ...) \ | 70 | #define ERROR(nm_, fn_, d_, ...) \ |
| 71 | CHECK_ENTRY(_nm, _fn, _d, false, true, __VA_ARGS__) | 71 | CHECK_ENTRY(nm_, fn_, d_, false, true, __VA_ARGS__) |
| 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 | static inline void PRINTF(3, 4) check_msg(struct check *c, struct dt_info *dti, | 75 | static inline void PRINTF(5, 6) check_msg(struct check *c, struct dt_info *dti, |
| 76 | struct node *node, | ||
| 77 | struct property *prop, | ||
| 76 | const char *fmt, ...) | 78 | const char *fmt, ...) |
| 77 | { | 79 | { |
| 78 | va_list ap; | 80 | va_list ap; |
| @@ -83,19 +85,33 @@ static inline void PRINTF(3, 4) check_msg(struct check *c, struct dt_info *dti, | |||
| 83 | fprintf(stderr, "%s: %s (%s): ", | 85 | fprintf(stderr, "%s: %s (%s): ", |
| 84 | strcmp(dti->outname, "-") ? dti->outname : "<stdout>", | 86 | strcmp(dti->outname, "-") ? dti->outname : "<stdout>", |
| 85 | (c->error) ? "ERROR" : "Warning", c->name); | 87 | (c->error) ? "ERROR" : "Warning", c->name); |
| 88 | if (node) { | ||
| 89 | fprintf(stderr, "%s", node->fullpath); | ||
| 90 | if (prop) | ||
| 91 | fprintf(stderr, ":%s", prop->name); | ||
| 92 | fputs(": ", stderr); | ||
| 93 | } | ||
| 86 | vfprintf(stderr, fmt, ap); | 94 | vfprintf(stderr, fmt, ap); |
| 87 | fprintf(stderr, "\n"); | 95 | fprintf(stderr, "\n"); |
| 88 | } | 96 | } |
| 89 | va_end(ap); | 97 | va_end(ap); |
| 90 | } | 98 | } |
| 91 | 99 | ||
| 92 | #define FAIL(c, dti, ...) \ | 100 | #define FAIL(c, dti, node, ...) \ |
| 101 | do { \ | ||
| 102 | TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \ | ||
| 103 | (c)->status = FAILED; \ | ||
| 104 | check_msg((c), dti, node, NULL, __VA_ARGS__); \ | ||
| 105 | } while (0) | ||
| 106 | |||
| 107 | #define FAIL_PROP(c, dti, node, prop, ...) \ | ||
| 93 | do { \ | 108 | do { \ |
| 94 | TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \ | 109 | TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \ |
| 95 | (c)->status = FAILED; \ | 110 | (c)->status = FAILED; \ |
| 96 | check_msg((c), dti, __VA_ARGS__); \ | 111 | check_msg((c), dti, node, prop, __VA_ARGS__); \ |
| 97 | } while (0) | 112 | } while (0) |
| 98 | 113 | ||
| 114 | |||
| 99 | static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node) | 115 | static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node) |
| 100 | { | 116 | { |
| 101 | struct node *child; | 117 | struct node *child; |
| @@ -126,7 +142,7 @@ static bool run_check(struct check *c, struct dt_info *dti) | |||
| 126 | error = error || run_check(prq, dti); | 142 | error = error || run_check(prq, dti); |
| 127 | if (prq->status != PASSED) { | 143 | if (prq->status != PASSED) { |
| 128 | c->status = PREREQ; | 144 | c->status = PREREQ; |
| 129 | check_msg(c, dti, "Failed prerequisite '%s'", | 145 | check_msg(c, dti, NULL, NULL, "Failed prerequisite '%s'", |
| 130 | c->prereq[i]->name); | 146 | c->prereq[i]->name); |
| 131 | } | 147 | } |
| 132 | } | 148 | } |
| @@ -156,7 +172,7 @@ out: | |||
| 156 | static inline void check_always_fail(struct check *c, struct dt_info *dti, | 172 | static inline void check_always_fail(struct check *c, struct dt_info *dti, |
| 157 | struct node *node) | 173 | struct node *node) |
| 158 | { | 174 | { |
| 159 | FAIL(c, dti, "always_fail check"); | 175 | FAIL(c, dti, node, "always_fail check"); |
| 160 | } | 176 | } |
| 161 | CHECK(always_fail, check_always_fail, NULL); | 177 | CHECK(always_fail, check_always_fail, NULL); |
| 162 | 178 | ||
| @@ -171,14 +187,42 @@ static void check_is_string(struct check *c, struct dt_info *dti, | |||
| 171 | return; /* Not present, assumed ok */ | 187 | return; /* Not present, assumed ok */ |
| 172 | 188 | ||
| 173 | if (!data_is_one_string(prop->val)) | 189 | if (!data_is_one_string(prop->val)) |
| 174 | FAIL(c, dti, "\"%s\" property in %s is not a string", | 190 | FAIL_PROP(c, dti, node, prop, "property is not a string"); |
| 175 | propname, node->fullpath); | ||
| 176 | } | 191 | } |
| 177 | #define WARNING_IF_NOT_STRING(nm, propname) \ | 192 | #define WARNING_IF_NOT_STRING(nm, propname) \ |
| 178 | WARNING(nm, check_is_string, (propname)) | 193 | WARNING(nm, check_is_string, (propname)) |
| 179 | #define ERROR_IF_NOT_STRING(nm, propname) \ | 194 | #define ERROR_IF_NOT_STRING(nm, propname) \ |
| 180 | ERROR(nm, check_is_string, (propname)) | 195 | ERROR(nm, check_is_string, (propname)) |
| 181 | 196 | ||
| 197 | static void check_is_string_list(struct check *c, struct dt_info *dti, | ||
| 198 | struct node *node) | ||
| 199 | { | ||
| 200 | int rem, l; | ||
| 201 | struct property *prop; | ||
| 202 | char *propname = c->data; | ||
| 203 | char *str; | ||
| 204 | |||
| 205 | prop = get_property(node, propname); | ||
| 206 | if (!prop) | ||
| 207 | return; /* Not present, assumed ok */ | ||
| 208 | |||
| 209 | str = prop->val.val; | ||
| 210 | rem = prop->val.len; | ||
| 211 | while (rem > 0) { | ||
| 212 | l = strnlen(str, rem); | ||
| 213 | if (l == rem) { | ||
| 214 | FAIL_PROP(c, dti, node, prop, "property is not a string list"); | ||
| 215 | break; | ||
| 216 | } | ||
| 217 | rem -= l + 1; | ||
| 218 | str += l + 1; | ||
| 219 | } | ||
| 220 | } | ||
| 221 | #define WARNING_IF_NOT_STRING_LIST(nm, propname) \ | ||
| 222 | WARNING(nm, check_is_string_list, (propname)) | ||
| 223 | #define ERROR_IF_NOT_STRING_LIST(nm, propname) \ | ||
| 224 | ERROR(nm, check_is_string_list, (propname)) | ||
| 225 | |||
| 182 | static void check_is_cell(struct check *c, struct dt_info *dti, | 226 | static void check_is_cell(struct check *c, struct dt_info *dti, |
| 183 | struct node *node) | 227 | struct node *node) |
| 184 | { | 228 | { |
| @@ -190,8 +234,7 @@ static void check_is_cell(struct check *c, struct dt_info *dti, | |||
| 190 | return; /* Not present, assumed ok */ | 234 | return; /* Not present, assumed ok */ |
| 191 | 235 | ||
| 192 | if (prop->val.len != sizeof(cell_t)) | 236 | if (prop->val.len != sizeof(cell_t)) |
| 193 | FAIL(c, dti, "\"%s\" property in %s is not a single cell", | 237 | FAIL_PROP(c, dti, node, prop, "property is not a single cell"); |
| < | |||
