summaryrefslogtreecommitdiffstats
path: root/scripts/dtc/flattree.c
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2023-02-17 18:30:38 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2023-02-22 07:19:40 +0100
commit090d47fb0dec6bac45fe1a8933c534f76301a617 (patch)
tree2328b5dee93d0014e3aa9aeb94981c9e299ef059 /scripts/dtc/flattree.c
parent551aefef47622510d99b7c998f79ebf2d78389ef (diff)
downloadbarebox-090d47fb0dec6bac45fe1a8933c534f76301a617.tar.gz
barebox-090d47fb0dec6bac45fe1a8933c534f76301a617.tar.xz
scripts/dtc: Update to upstream version v1.7.0
This adds the following commits from upstream dtc: 039a99414e77 Bump version to v1.7.0 9b62ec84bb2d Merge remote-tracking branch 'gitlab/main' 3f29d6d85c24 pylibfdt: add size_hint parameter for get_path 2022bb10879d checks: Update #{size,address}-cells check for 'dma-ranges' abbd523bae6e pylibfdt: Work-around SWIG limitations with flexible arrays a41509bea3e7 libfdt: Replace deprecated 0-length arrays with proper flexible arrays 2cd89f862cdb dtc: Warning rather than error on possible truncation of cell values 55778a03df61 libfdt: tests: add get_next_tag_invalid_prop_len 73590342fc85 libfdt: prevent integer overflow in fdt_next_tag 035fb90d5375 libfdt: add fdt_get_property_by_offset_w helper 98a07006c48d Makefile: fix infinite recursion by dropping non-existent `%.output` a036cc7b0c10 Makefile: limit make re-execution to avoid infinite spin c6e92108bcd9 libdtc: remove duplicate judgments e37c25677dc9 Don't generate erroneous fixups from reference to path 50454658f2b5 libfdt: Don't mask fdt_get_name() returned error e64a204196c9 manual.txt: Follow README.md and remove Jon f508c83fe6f0 Update README in MANIFEST.in and setup.py to README.md c2ccf8a77dd2 Add description of Signed-off-by lines 90b9d9de42ca Split out information for contributors to CONTRIBUTING.md 0ee1d479b23a Remove Jon Loeliger from maintainers list b33a73c62c1c Convert README to README.md 7ad60734b1c1 Allow static building with meson fd9b8c96c780 Allow static building with make fda71da26e7f libfdt: Handle failed get_name() on BEGIN_NODE c7c7f17a83d5 Fix test script to run also on dash shell 01f23ffe1679 Add missing relref_merge test to meson test list ed310803ea89 pylibfdt: add FdtRo.get_path() c001fc01a43e pylibfdt: fix swig build in install 26c54f840d23 tests: add test cases for label-relative path references ec7986e682cf dtc: introduce label relative path references 651410e54cb9 util: introduce xstrndup helper 4048aed12b81 setup.py: fix out of tree build ff5afb96d0c0 Handle integer overflow in check_property_phandle_args() ca7294434309 README: Explain how to add a new API function c0c2e115f82e Fix a UB when fdt_get_string return null cd5f69cbc0d4 tests: setprop_inplace: use xstrdup instead of unchecked strdup a04f69025003 pylibfdt: add Property.as_*int*_array() 83102717d7c4 pylibfdt: add Property.as_stringlist() d152126bb029 Fix Python crash on getprop deallocation 17739b7ef510 Support 'r' format for printing raw bytes with fdtget 45f3d1a095dd libfdt: overlay: make overlay_get_target() public c19a4bafa514 libfdt: fix an incorrect integer promotion 1cc41b1c969f pylibfdt: Add packaging metadata db72398cd437 README: Update pylibfdt install instructions 383e148b70a4 pylibfdt: fix with Python 3.10 23b56cb7e189 pylibfdt: Move setup.py to the top level 69a760747d8d pylibfdt: Split setup.py author name and email 0b106a77dbdc pylibfdt: Use setuptools_scm for the version c691776ddb26 pylibfdt: Use setuptools instead of distutils 5216f3f1bbb7 libfdt: Add static lib to meson build 4eda2590f481 CI: Cirrus: bump used FreeBSD from 12.1 to 13.0 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 183df9e9c2b9 gitignore: Ignore the swp files 0db6d09584e1 gitignore: Add cscope files 307afa1a7be8 Update Jon Loeliger's email ca16a723fa9d fdtdump: Fix gcc11 warning 64990a272e8f srcpos: increase MAX_SRCFILE_DEPTH 163f0469bf2e dtc: Allow overlays to have .dtbo extension 3b01518e688d Set last_comp_version correctly in new dtb and fix potential version issues in fdt_open_into f7e5737f26aa tests: Fix overlay_overlay_nosugar test case 7cd5d5fe43d5 libfdt: Tweak description of assume-aligned load helpers a7c404099349 libfdt: Internally perform potentially unaligned loads bab85e48a6f4 meson: increase default timeout for tests f8b46098824d meson: do not assume python is installed, skip tests 30a56bce4f0b meson: fix -Wall warning 5e735860c478 libfdt: Check for 8-byte address alignment in fdt_ro_probe_() 67849a327927 build-sys: add meson build 05874d08212d pylibfdt: allow build out of tree 3bc3a6b9fe0c dtc: Fix signedness comparisons warnings: Wrap (-1) e1147b159e92 dtc: Fix signedness comparisons warnings: change types 04cf1fdc0fcf convert-dtsv0: Fix signedness comparisons warning b30013edb878 libfdt: Fix kernel-doc comments cbca977ea121 checks: Allow PCI bridge child nodes without an address 73e0f143b73d libfdt: fdt_strerror(): Fix comparison warning 6c2be7d85315 libfdt: fdt_get_string(): Fix sequential write comparison warnings 82525f41d59e libfdt: libfdt_wip: Fix comparison warning fb1f65f15832 libfdt: fdt_create_with_flags(): Fix comparison warning f28aa271000b libfdt: fdt_move(): Fix comparison warnings 3d7c6f44195a libfdt: fdt_add_string_(): Fix comparison warning 10f682788c30 libfdt: fdt_node_offset_by_phandle(): Fix comparison warning 07158f4cf2a2 libfdt: overlay: Fix comparison warning ce9e1f25a7de libfdt: fdt_resize(): Fix comparison warning faa76fc10bc5 libfdt: fdt_splice_(): Fix comparison warning 54dca0985316 libfdt: fdt_get_string(): Fix comparison warnings f8e11e61624e libfdt: fdt_grab_space_(): Fix comparison warning 0c43d4d7bf5a libfdt: fdt_mem_rsv(): Fix comparison warnings 442ea3dd1579 libfdt: fdt_offset_ptr(): Fix comparison warnings ca19c3db2bf6 Makefile: Specify cflags for libyaml 7bb86f1c0956 libfdt: fix fdt_check_node_offset_ w/ VALID_INPUT 3d522abc7571 dtc: Include stdlib.h in util.h 808cdaaf524f dtc: Avoid UB when shifting 3e3138b4a956 libfdt: fix fdt_check_full buffer overrun 9d7888cbf19c dtc: Consider one-character strings as strings 8259d59f59de checks: Improve i2c reg property checking fdabcf2980a4 checks: Remove warning for I2C_OWN_SLAVE_ADDRESS 2478b1652c8d libfdt: add extern "C" for C++ f68bfc2668b2 libfdt: trivial typo fix 7be250b4d059 libfdt: Correct condition for reordering blocks 81e0919a3e21 checks: Add interrupt provider test 85e5d839847a Makefile: when building libfdt only, do not add unneeded deps b28464a550c5 Fix some potential unaligned accesses in dtc 87a656ae5ff9 check: Inform about missing ranges 73d6e9ecb417 libfdt: fix undefined behaviour in fdt_splice_() 2525da3dba9b Bump version to v1.6.0 62cb4ad286ff Execute tests on FreeBSD with Cirrus CI 1f9a41750883 tests: Allow running the testsuite on already installed binary / libraries c5995ddf4c20 tests: Honour NO_YAML make variable e4ce227e89d7 tests: Properly clean up .bak file from tests 9b75292c335c tests: Honour $(NO_PYTHON) flag from Makefile in run_tests.sh 6c253afd07d4 Encode $(NO_PYTHON) consistently with other variables 95ec8ef706bd tests: No need to explicitly pass $PYTHON from Make to run_tests.sh 2b5f62d109a2 tests: Let run_tests.sh run Python tests without Makefile assistance 76b43dcbd18a checks: Add 'dma-ranges' check e5c92a4780c6 libfdt: Use VALID_INPUT for FDT_ERR_BADSTATE checks e5cc26b68bc0 libfdt: Add support for disabling internal checks 28fd7590aad2 libfdt: Improve comments in some of the assumptions fc207c32341b libfdt: Fix a few typos 0f61c72dedc4 libfdt: Allow exclusion of fdt_check_full() f270f45fd5d2 libfdt: Add support for disabling ordering check/fixup c18bae9a4c96 libfdt: Add support for disabling version checks fc03c4a2e04e libfdt: Add support for disabling rollback handling 77563ae72b7c libfdt: Add support for disabling sanity checks 57bc6327b80b libfdt: Add support for disabling dtb checks 464962489dcc Add a way to control the level of checks in the code 0c5326cb2845 libfdt: De-inline fdt_header_size() cc6a5a071504 Revert "yamltree: Ensure consistent bracketing of properties with phandles" 0e9225eb0dfe Remove redundant YYLOC global declaration cab09eedd644 Move -DNO_VALGRIND into CPPFLAGS 0eb1cb0b531e Makefile: pass $(CFLAGS) also during dependency generation c40aeb60b47a travis.yml: Run tests on the non-x86 builders, too 9f86aff444f4 Add .cirrus.yml for FreeBSD build 34c82275bae6 Avoid gnu_printf attribute when using Clang 743000931bc9 tests: default to 'cc' if CC not set adcd676491cc Add test-case for trailing zero d9c55f855b65 Remove trailing zero from the overlay path 7a22132c79ec pylibfdt: Adjust for deprecated test methods dbe80d577ee2 tests: add extension to sed -i for GNU/BSD sed compatibility af57d440d887 libfdt: Correct prototype for fdt_ro_probe_() 6ce585ac153b Use correct inttypes.h format specifier 715028622547 support byacc in addition to bison fdf3f6d897ab pylibfdt: Correct the type for fdt_property_stub() 430419c28100 tests: fix some python warnings 588a29ff2e4e util: use gnu_printf format attribute bc876708ab1d fstree: replace lstat with stat 4c3c4ccb9916 dumptrees: pass outputdir as first argument aa522da9fff6 tests: allow out-of-tree test run 0d0d0fa51b1f fdtoverlay: Return non-zero exit code if overlays can't be applied 4605eb047b38 Add .editorconfig 18d7b2f4ee45 yamltree: Ensure consistent bracketing of properties with phandles 67f790c1adcc libfdt.h: add explicit cast from void* to uint8_t* in fdt(32|64)_st b111122ea5eb pylibfdt: use python3 shebang Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230217173057.1839835-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts/dtc/flattree.c')
-rw-r--r--scripts/dtc/flattree.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c
index bd6977eedc..95e43d32c3 100644
--- a/scripts/dtc/flattree.c
+++ b/scripts/dtc/flattree.c
@@ -124,7 +124,8 @@ static void asm_emit_cell(void *e, cell_t val)
{
FILE *f = e;
- fprintf(f, "\t.byte 0x%02x; .byte 0x%02x; .byte 0x%02x; .byte 0x%02x\n",
+ fprintf(f, "\t.byte\t0x%02x\n" "\t.byte\t0x%02x\n"
+ "\t.byte\t0x%02x\n" "\t.byte\t0x%02x\n",
(val >> 24) & 0xff, (val >> 16) & 0xff,
(val >> 8) & 0xff, val & 0xff);
}
@@ -134,9 +135,9 @@ static void asm_emit_string(void *e, const char *str, int len)
FILE *f = e;
if (len != 0)
- fprintf(f, "\t.string\t\"%.*s\"\n", len, str);
+ fprintf(f, "\t.asciz\t\"%.*s\"\n", len, str);
else
- fprintf(f, "\t.string\t\"%s\"\n", str);
+ fprintf(f, "\t.asciz\t\"%s\"\n", str);
}
static void asm_emit_align(void *e, int a)
@@ -149,14 +150,14 @@ static void asm_emit_align(void *e, int a)
static void asm_emit_data(void *e, struct data d)
{
FILE *f = e;
- int off = 0;
+ unsigned int off = 0;
struct marker *m = d.markers;
for_each_marker_of_type(m, LABEL)
emit_offset_label(f, m->ref, m->offset);
while ((d.len - off) >= sizeof(uint32_t)) {
- asm_emit_cell(e, fdt32_to_cpu(*((fdt32_t *)(d.val+off))));
+ asm_emit_cell(e, dtb_ld32(d.val + off));
off += sizeof(uint32_t);
}
@@ -219,7 +220,7 @@ static struct emitter asm_emitter = {
static int stringtable_insert(struct data *d, const char *str)
{
- int i;
+ unsigned int i;
/* FIXME: do this more efficiently? */
@@ -295,7 +296,7 @@ static struct data flatten_reserve_list(struct reserve_info *reservelist,
{
struct reserve_info *re;
struct data d = empty_data;
- int j;
+ unsigned int j;
for (re = reservelist; re; re = re->next) {
d = data_append_re(d, re->address, re->size);
@@ -345,7 +346,7 @@ static void make_fdt_header(struct fdt_header *fdt,
void dt_to_blob(FILE *f, struct dt_info *dti, int version)
{
struct version_info *vi = NULL;
- int i;
+ unsigned int i;
struct data blob = empty_data;
struct data reservebuf = empty_data;
struct data dtbuf = empty_data;
@@ -438,7 +439,7 @@ static void dump_stringtable_asm(FILE *f, struct data strbuf)
while (p < (strbuf.val + strbuf.len)) {
len = strlen(p);
- fprintf(f, "\t.string \"%s\"\n", p);
+ fprintf(f, "\t.asciz \"%s\"\n", p);
p += len+1;
}
}
@@ -446,7 +447,7 @@ static void dump_stringtable_asm(FILE *f, struct data strbuf)
void dt_to_asm(FILE *f, struct dt_info *dti, int version)
{
struct version_info *vi = NULL;
- int i;
+ unsigned int i;
struct data strbuf = empty_data;
struct reserve_info *re;
const char *symprefix = "dt";