From a77725a9a3c5924e2fd4cd5b3557dd92a8e46f87 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Mon, 25 Oct 2021 11:05:45 -0500 Subject: scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 This adds the following commits from upstream: 0a3a9d3449c8 checks: Add an interrupt-map check 8fd24744e361 checks: Ensure '#interrupt-cells' only exists in interrupt providers d8d1a9a77863 checks: Drop interrupt provider '#address-cells' check 52a16fd72824 checks: Make interrupt_provider check dependent on interrupts_extended_is_cell 37fd700685da treesource: Maintain phandle label/path on output e33ce1d6a8c7 flattree: Use '\n', not ';' to separate asm pseudo-ops d24cc189dca6 asm: Use assembler macros instead of cpp macros ff3a30c115ad asm: Use .asciz and .ascii instead of .string 5eb5927d81ee fdtdump: fix -Werror=int-to-pointer-cast 0869f8269161 libfdt: Add ALIGNMENT error string 69595a167f06 checks: Fix bus-range check 72d09e2682a4 Makefile: add -Wsign-compare to warning options b587787ef388 checks: Fix signedness comparisons warnings 69bed6c2418f dtc: Wrap phandle validity check 910221185560 fdtget: Fix signedness comparisons warnings d966f08fcd21 tests: Fix signedness comparisons warnings ecfb438c07fa dtc: Fix signedness comparisons warnings: pointer diff 5bec74a6d135 dtc: Fix signedness comparisons warnings: reservednum 24e7f511fd4a fdtdump: Fix signedness comparisons warnings b6910bec1161 Bump version to v1.6.1 21d61d18f968 Fix CID 1461557 4c2ef8f4d14c checks: Introduce is_multiple_of() e59ca36fb70e Make handling of cpp line information more tolerant 0c3fd9b6aceb checks: Drop interrupt_cells_is_cell check 6b3081abc4ac checks: Add check_is_cell() for all phandle+arg properties 2dffc192a77f yamltree: Remove marker ordering dependency 61e513439e40 pylibfdt: Rework "avoid unused variable warning" lines c8bddd106095 tests: add a positive gpio test case ad4abfadb687 checks: replace strstr and strrchr with strends 09c6a6e88718 dtc.h: add strends for suffix matching 9bb9b8d0b4a0 checks: tigthen up nr-gpios prop exception b07b62ee3342 libfdt: Add FDT alignment check to fdt_check_header() a2def5479950 libfdt: Check that the root-node name is empty 4ca61f84dc21 libfdt: Check that there is only one root node 34d708249a91 dtc: Remove -O dtbo support 8e7ff260f755 libfdt: Fix a possible "unchecked return value" warning 88875268c05c checks: Warn on node-name and property name being the same 9d2279e7e6ee checks: Change node-name check to match devicetree spec f527c867a8c6 util: limit gnu_printf format attribute to gcc >= 4.4.0 Reviewed-by: Frank Rowand Tested-by: Frank Rowand Signed-off-by: Rob Herring --- scripts/dtc/dtc.h | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'scripts/dtc/dtc.h') diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h index d3e82fb8e3db..0a1f54991026 100644 --- a/scripts/dtc/dtc.h +++ b/scripts/dtc/dtc.h @@ -35,7 +35,7 @@ * Command line options */ extern int quiet; /* Level of quietness */ -extern int reservenum; /* Number of memory reservation slots */ +extern unsigned int reservenum; /* Number of memory reservation slots */ extern int minsize; /* Minimum blob size */ extern int padsize; /* Additional padding to blob */ extern int alignsize; /* Additional padding to blob accroding to the alignsize */ @@ -51,6 +51,11 @@ extern int annotate; /* annotate .dts with input source location */ typedef uint32_t cell_t; +static inline bool phandle_is_valid(cell_t phandle) +{ + return phandle != 0 && phandle != ~0U; +} + static inline uint16_t dtb_ld16(const void *p) { const uint8_t *bp = (const uint8_t *)p; @@ -86,6 +91,16 @@ static inline uint64_t dtb_ld64(const void *p) #define streq(a, b) (strcmp((a), (b)) == 0) #define strstarts(s, prefix) (strncmp((s), (prefix), strlen(prefix)) == 0) #define strprefixeq(a, n, b) (strlen(b) == (n) && (memcmp(a, b, n) == 0)) +static inline bool strends(const char *str, const char *suffix) +{ + unsigned int len, suffix_len; + + len = strlen(str); + suffix_len = strlen(suffix); + if (len < suffix_len) + return false; + return streq(str + len - suffix_len, suffix); +} #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) @@ -101,6 +116,12 @@ enum markertype { TYPE_UINT64, TYPE_STRING, }; + +static inline bool is_type_marker(enum markertype type) +{ + return type >= TYPE_UINT8; +} + extern const char *markername(enum markertype markertype); struct marker { @@ -125,7 +146,22 @@ struct data { for_each_marker(m) \ if ((m)->type == (t)) -size_t type_marker_length(struct marker *m); +static inline struct marker *next_type_marker(struct marker *m) +{ + for_each_marker(m) + if (is_type_marker(m->type)) + break; + return m; +} + +static inline size_t type_marker_length(struct marker *m) +{ + struct marker *next = next_type_marker(m->next); + + if (next) + return next->offset - m->offset; + return 0; +} void data_free(struct data d); -- cgit v1.2.3