Skip to contentSkip to conversation

Follow the Linux Kernel in building dtc as needed

PATCH New Tom Rini 5 participants 25 messages Sep 24, 2017 – Oct 3, 2017

Subsystems (2)
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

cover Follow the Linux Kernel in building dtc as needed

The following series has been applied. I am posting this for the record.

For the record, I do not believe that using git submodules is a good approach here. We have a small amount of code that we need here, and happily we can leverage infrastructur e from the Linux Kernel.

Speaking of, this is not the first time we have run into problems deviating from the workflow of the kernel. The problems of having large number of warnings, or not stemmed from not just leve raging all of the infrastructure from the kernel. So related, yes, fixes for these warnings should come in, and as always, if they're in the upstream kernel dts as well, they should be fixed there.

Thanks all.

Signature · 1 line
Tom
author
#1 lore raw

PATCH 1/5 scripts/dtc: Update to upstream version v1.4.3

Using the update-dtc-source.sh script from Linux v4.14-rc1 import the portions of dtc that we require. We bring in update-dtc-source.sh and scripts/dtc/Makefile from Linux v4.14-rc1. Rework DTC_FLAGS handling to not require a test.

---
 scripts/Kbuild.include               |    5 -
 scripts/Makefile.extrawarn           |   16 +-
 scripts/dtc/Makefile                 |   31 +
 scripts/dtc/Makefile.dtc             |   18 +
 scripts/dtc/checks.c                 |  849 +++++++++++++
 scripts/dtc/data.c                   |  269 ++++
 scripts/dtc/dtc-lexer.l              |  311 +++++
 scripts/dtc/dtc-lexer.lex.c_shipped  | 2260 +++++++++++++++++++++++++++++++++
 scripts/dtc/dtc-parser.tab.c_shipped | 2301 ++++++++++++++++++++++++++++++++++
 scripts/dtc/dtc-parser.tab.h_shipped |  123 ++
 scripts/dtc/dtc-parser.y             |  519 ++++++++
 scripts/dtc/dtc.c                    |  366 ++++++
 scripts/dtc/dtc.h                    |  285 +++++
 scripts/dtc/flattree.c               |  946 ++++++++++++++
 scripts/dtc/fstree.c                 |   90 ++
 scripts/dtc/libfdt/Makefile.libfdt   |   11 +
 scripts/dtc/libfdt/fdt.c             |  251 ++++
 scripts/dtc/libfdt/fdt.h             |  111 ++
 scripts/dtc/libfdt/fdt_empty_tree.c  |   84 ++
 scripts/dtc/libfdt/fdt_ro.c          |  703 +++++++++++
 scripts/dtc/libfdt/fdt_rw.c          |  491 ++++++++
 scripts/dtc/libfdt/fdt_strerror.c    |  102 ++
 scripts/dtc/libfdt/fdt_sw.c          |  288 +++++
 scripts/dtc/libfdt/fdt_wip.c         |  139 ++
 scripts/dtc/libfdt/libfdt.h          | 1833 +++++++++++++++++++++++++++
 scripts/dtc/libfdt/libfdt_env.h      |  112 ++
 scripts/dtc/libfdt/libfdt_internal.h |   95 ++
 scripts/dtc/livetree.c               |  980 +++++++++++++++
 scripts/dtc/srcpos.c                 |  302 +++++
 scripts/dtc/srcpos.h                 |  118 ++
 scripts/dtc/treesource.c             |  284 +++++
 scripts/dtc/update-dtc-source.sh     |   81 ++
 scripts/dtc/util.c                   |  473 +++++++
 scripts/dtc/util.h                   |  265 ++++
 scripts/dtc/version_gen.h            |    1 +
 35 files changed, 15100 insertions(+), 13 deletions(-)
 create mode 100644 scripts/dtc/Makefile
 create mode 100644 scripts/dtc/Makefile.dtc
 create mode 100644 scripts/dtc/checks.c
 create mode 100644 scripts/dtc/data.c
 create mode 100644 scripts/dtc/dtc-lexer.l
 create mode 100644 scripts/dtc/dtc-lexer.lex.c_shipped
 create mode 100644 scripts/dtc/dtc-parser.tab.c_shipped
 create mode 100644 scripts/dtc/dtc-parser.tab.h_shipped
 create mode 100644 scripts/dtc/dtc-parser.y
 create mode 100644 scripts/dtc/dtc.c
 create mode 100644 scripts/dtc/dtc.h
 create mode 100644 scripts/dtc/flattree.c
 create mode 100644 scripts/dtc/fstree.c
 create mode 100644 scripts/dtc/libfdt/Makefile.libfdt
 create mode 100644 scripts/dtc/libfdt/fdt.c
 create mode 100644 scripts/dtc/libfdt/fdt.h
 create mode 100644 scripts/dtc/libfdt/fdt_empty_tree.c
 create mode 100644 scripts/dtc/libfdt/fdt_ro.c
 create mode 100644 scripts/dtc/libfdt/fdt_rw.c
 create mode 100644 scripts/dtc/libfdt/fdt_strerror.c
 create mode 100644 scripts/dtc/libfdt/fdt_sw.c
 create mode 100644 scripts/dtc/libfdt/fdt_wip.c
 create mode 100644 scripts/dtc/libfdt/libfdt.h
 create mode 100644 scripts/dtc/libfdt/libfdt_env.h
 create mode 100644 scripts/dtc/libfdt/libfdt_internal.h
 create mode 100644 scripts/dtc/livetree.c
 create mode 100644 scripts/dtc/srcpos.c
 create mode 100644 scripts/dtc/srcpos.h
 create mode 100644 scripts/dtc/treesource.c
 create mode 100755 scripts/dtc/update-dtc-source.sh
 create mode 100644 scripts/dtc/util.c
 create mode 100644 scripts/dtc/util.h
 create mode 100644 scripts/dtc/version_gen.h
scripts/Kbuild.include +0 -5
index a3a5c59d0da2..2c7918ad3721 100644
@@ -172,11 +172,6 @@ ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)
 # Usage:  $(call ld-ifversion, -ge, 22252, y)
 ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4))
 
-# dtc-option
-# Usage:  DTC_FLAGS += $(call dtc-option,-Wno-unit_address_vs_reg)
-dtc-option = $(call try-run,\
-	echo '/dts-v1/; / {};' | $(DTC) $(1),$(1),$(2))
-
 ######
 
 ###
scripts/Makefile.extrawarn +8 -8
index 90dc149df3d9..1d3a5705946d 100644
@@ -58,8 +58,8 @@ endif
 
 KBUILD_CFLAGS += $(warning)
 
-dtc-warning-2 += $(call dtc-option,-Wnode_name_chars_strict)
-dtc-warning-2 += $(call dtc-option,-Wproperty_name_chars_strict)
+dtc-warning-2 += -Wnode_name_chars_strict
+dtc-warning-2 += -Wproperty_name_chars_strict
 
 dtc-warning := $(dtc-warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
 dtc-warning += $(dtc-warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
@@ -70,11 +70,11 @@ DTC_FLAGS += $(dtc-warning)
 else
 
 # Disable noisy checks by default
-DTC_FLAGS += $(call dtc-option,-Wno-unit_address_vs_reg)
-DTC_FLAGS += $(call dtc-option,-Wno-simple_bus_reg)
-DTC_FLAGS += $(call dtc-option,-Wno-unit_address_format)
-DTC_FLAGS += $(call dtc-option,-Wno-pci_bridge)
-DTC_FLAGS += $(call dtc-option,-Wno-pci_device_bus_num)
-DTC_FLAGS += $(call dtc-option,-Wno-pci_device_reg)
+DTC_FLAGS += -Wno-unit_address_vs_reg
+DTC_FLAGS += -Wno-simple_bus_reg
+DTC_FLAGS += -Wno-unit_address_format
+DTC_FLAGS += -Wno-pci_bridge
+DTC_FLAGS += -Wno-pci_device_bus_num
+DTC_FLAGS += -Wno-pci_device_reg
 
 endif
scripts/dtc/Makefile new file +31 -0
new file mode 100644
index 000000000000..2a48022c41e7
@@ -0,0 +1,31 @@
+# scripts/dtc makefile
+
+hostprogs-y	:= dtc
+always		:= $(hostprogs-y)
+
+dtc-objs	:= dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
+		   srcpos.o checks.o util.o
+dtc-objs	+= dtc-lexer.lex.o dtc-parser.tab.o
+
+# Source files need to get at the userspace version of libfdt_env.h to compile
+
+HOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt
+
+HOSTCFLAGS_checks.o := $(HOSTCFLAGS_DTC)
+HOSTCFLAGS_data.o := $(HOSTCFLAGS_DTC)
+HOSTCFLAGS_dtc.o := $(HOSTCFLAGS_DTC)
+HOSTCFLAGS_flattree.o := $(HOSTCFLAGS_DTC)
+HOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC)
+HOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC)
+HOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC)
+HOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC)
+HOSTCFLAGS_util.o := $(HOSTCFLAGS_DTC)
+
+HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC)
+HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
+
+# dependencies on generated files need to be listed explicitly
+$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
+
+# generated files need to be cleaned explicitly
+clean-files	:= dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h
scripts/dtc/Makefile.dtc new file +18 -0
new file mode 100644
index 000000000000..bece49b35535
@@ -0,0 +1,18 @@
+# Makefile.dtc
+#
+# This is not a complete Makefile of itself.  Instead, it is designed to
+# be easily embeddable into other systems of Makefiles.
+#
+DTC_SRCS = \
+	checks.c \
+	data.c \
+	dtc.c \
+	flattree.c \
+	fstree.c \
+	livetree.c \
+	srcpos.c \
+	treesource.c \
+	util.c
+
+DTC_GEN_SRCS = dtc-lexer.lex.c dtc-parser.tab.c
+DTC_OBJS = $(DTC_SRCS:%.c=%.o) $(DTC_GEN_SRCS:%.c=%.o)
scripts/dtc/checks.c new file +849 -0

849 lines not on this page · raw message

scripts/dtc/data.c new file +269 -0

269 lines not on this page · raw message

scripts/dtc/dtc-lexer.l new file +311 -0

311 lines not on this page · raw message

scripts/dtc/dtc-lexer.lex.c_shipped new file +2260 -0

1,484 lines not on this page · raw message

scripts/dtc/dtc-parser.tab.c_shipped new file +2301 -0

2,301 lines not on this page · raw message

scripts/dtc/dtc-parser.tab.h_shipped new file +123 -0

123 lines not on this page · raw message

scripts/dtc/dtc-parser.y new file +519 -0

519 lines not on this page · raw message

scripts/dtc/dtc.c new file +366 -0

366 lines not on this page · raw message

scripts/dtc/dtc.h new file +285 -0

285 lines not on this page · raw message

scripts/dtc/flattree.c new file +946 -0

946 lines not on this page · raw message

scripts/dtc/fstree.c new file +90 -0

90 lines not on this page · raw message

scripts/dtc/libfdt/Makefile.libfdt new file +11 -0
new file mode 100644
index 000000000000..098b3f36e668

Lines of this file are not shown. View the raw message.

scripts/dtc/libfdt/fdt.c new file +251 -0

251 lines not on this page · raw message

scripts/dtc/libfdt/fdt.h new file +111 -0

111 lines not on this page · raw message

scripts/dtc/libfdt/fdt_empty_tree.c new file +84 -0

84 lines not on this page · raw message

scripts/dtc/libfdt/fdt_ro.c new file +703 -0

703 lines not on this page · raw message

scripts/dtc/libfdt/fdt_rw.c new file +491 -0

491 lines not on this page · raw message

scripts/dtc/libfdt/fdt_strerror.c new file +102 -0

102 lines not on this page · raw message

scripts/dtc/libfdt/fdt_sw.c new file +288 -0

288 lines not on this page · raw message

scripts/dtc/libfdt/fdt_wip.c new file +139 -0

139 lines not on this page · raw message

scripts/dtc/libfdt/libfdt.h new file +1833 -0

1,833 lines not on this page · raw message

scripts/dtc/libfdt/libfdt_env.h new file +112 -0

112 lines not on this page · raw message

scripts/dtc/libfdt/libfdt_internal.h new file +95 -0

95 lines not on this page · raw message

scripts/dtc/livetree.c new file +980 -0

980 lines not on this page · raw message

scripts/dtc/srcpos.c new file +302 -0

302 lines not on this page · raw message

scripts/dtc/srcpos.h new file +118 -0

118 lines not on this page · raw message

scripts/dtc/treesource.c new file +284 -0

284 lines not on this page · raw message

scripts/dtc/update-dtc-source.sh new file +81 -0

81 lines not on this page · raw message

scripts/dtc/util.c new file +473 -0

473 lines not on this page · raw message

scripts/dtc/util.h new file +265 -0

265 lines not on this page · raw message

scripts/dtc/version_gen.h new file +1 -0
new file mode 100644
index 000000000000..bbbd96b1dca3

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.9.1

Part of the diff is not shown here. View the raw message.

maintainer
#2 lore raw

PATCH 1/5 scripts/dtc: Update to upstream version v1.4.3

Quoted 4 lines · Tom Rini

Using the update-dtc-source.sh script from Linux v4.14-rc1 import the portions of dtc that we require. We bring in update-dtc-source.sh and scripts/dtc/Makefile from Linux v4.14-rc1. Rework DTC_FLAGS handling to not require a test.

You are missing fdt_addresses.c and fdt_overlay.c (which I thought u-boot was dependent on) as the script doesn't automatically add new files. I'm about to send out a script fix.

Rob

author
#3 lore raw

PATCH 1/5 scripts/dtc: Update to upstream version v1.4.3

Quoted 9 lines · Rob Herring
Quoted 4 lines · Tom Rini

Using the update-dtc-source.sh script from Linux v4.14-rc1 import the portions of dtc that we require. We bring in update-dtc-source.sh and scripts/dtc/Makefile from Linux v4.14-rc1. Rework DTC_FLAGS handling to not require a test.

You are missing fdt_addresses.c and fdt_overlay.c (which I thought u-boot was dependent on) as the script doesn't automatically add new files. I'm about to send out a script fix.

We only need 'dtc', and those aren't listed in DTC_OBJS in Makefile.dtc.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171003/a43cff59/attachment.sig>
maintainer
#4 lore raw

PATCH 1/5 scripts/dtc: Update to upstream version v1.4.3

Quoted 7 lines · Tom Rini
Quoted 6 lines · Rob Herring
Quoted 4 lines · Tom Rini

Using the update-dtc-source.sh script from Linux v4.14-rc1 import the portions of dtc that we require. We bring in update-dtc-source.sh and scripts/dtc/Makefile from Linux v4.14-rc1. Rework DTC_FLAGS handling to not require a test.

Quoted 5 lines
Quoted 3 lines

You are missing fdt_addresses.c and fdt_overlay.c (which I thought u-boot was dependent on) as the script doesn't automatically add new files. I'm about to send out a script fix.

We only need 'dtc', and those aren't listed in DTC_OBJS in Makefile.dtc.

So now you have 2 copies of libfdt?

Rob

author
#5 lore raw

PATCH 1/5 scripts/dtc: Update to upstream version v1.4.3

Quoted 8 lines · Rob Herring
Quoted 7 lines · Tom Rini
Quoted 6 lines · Rob Herring
Quoted 4 lines · Tom Rini

Using the update-dtc-source.sh script from Linux v4.14-rc1 import the portions of dtc that we require. We bring in update-dtc-source.sh and scripts/dtc/Makefile from Linux v4.14-rc1. Rework DTC_FLAGS handling to not require a test.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

You are missing fdt_addresses.c and fdt_overlay.c (which I thought u-boot was dependent on) as the script doesn't automatically add new files. I'm about to send out a script fix.

We only need 'dtc', and those aren't listed in DTC_OBJS in Makefile.dtc.

So now you have 2 copies of libfdt?

For the moment. A follow-up is to make sure we can turn those second copies into just #include of the copy we really use.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171003/4ff798ef/attachment.sig>
author
#6 lore raw

PATCH 2/5 scripts/dtc: Update to upstream version v1.4.4

In reply to Tom Rini

This adds the following commits from upstream:

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

---
 scripts/dtc/checks.c                | 12 ++----
 scripts/dtc/data.c                  | 16 ++++----
 scripts/dtc/dtc-lexer.l             |  7 +---
 scripts/dtc/dtc-lexer.lex.c_shipped | 81 +++++++++++++++++--------------------
 scripts/dtc/dtc.c                   |  5 +--
 scripts/dtc/dtc.h                   |  5 +--
 scripts/dtc/flattree.c              | 58 ++++++++++++--------------
 scripts/dtc/libfdt/libfdt_env.h     | 26 ++++++------
 scripts/dtc/livetree.c              | 16 ++++----
 scripts/dtc/srcpos.h                | 11 +++--
 scripts/dtc/treesource.c            |  6 +--
 scripts/dtc/util.c                  | 11 ++---
 scripts/dtc/util.h                  | 30 +++++++-------
 scripts/dtc/version_gen.h           |  2 +-
 14 files changed, 131 insertions(+), 155 deletions(-)
scripts/dtc/checks.c +4 -8
index 0e8b978c360c..38f548e582c8 100644
@@ -72,12 +72,8 @@ struct check {
 #define CHECK(_nm, _fn, _d, ...) \
 	CHECK_ENTRY(_nm, _fn, _d, false, false, __VA_ARGS__)
 
-#ifdef __GNUC__
-static inline void check_msg(struct check *c, struct dt_info *dti,
-			     const char *fmt, ...) __attribute__((format (printf, 3, 4)));
-#endif
-static inline void check_msg(struct check *c, struct dt_info *dti,
-			     const char *fmt, ...)
+static inline void  PRINTF(3, 4) check_msg(struct check *c, struct dt_info *dti,
+					   const char *fmt, ...)
 {
 	va_list ap;
 	va_start(ap, fmt);
@@ -538,13 +534,13 @@ static void fixup_phandle_references(struct check *c, struct dt_info *dti,
 					FAIL(c, dti, "Reference to non-existent node or "
 							"label \"%s\"\n", m->ref);
 				else /* mark the entry as unresolved */
-					*((cell_t *)(prop->val.val + m->offset)) =
+					*((fdt32_t *)(prop->val.val + m->offset)) =
 						cpu_to_fdt32(0xffffffff);
 				continue;
 			}
 
 			phandle = get_node_phandle(dt, refnode);
-			*((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
+			*((fdt32_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
 		}
 	}
 }
scripts/dtc/data.c +8 -8
index 8cae23746882..aa37a16c8891 100644
@@ -171,9 +171,9 @@ struct data data_merge(struct data d1, struct data d2)
 struct data data_append_integer(struct data d, uint64_t value, int bits)
 {
 	uint8_t value_8;
-	uint16_t value_16;
-	uint32_t value_32;
-	uint64_t value_64;
+	fdt16_t value_16;
+	fdt32_t value_32;
+	fdt64_t value_64;
 
 	switch (bits) {
 	case 8:
@@ -197,14 +197,14 @@ struct data data_append_integer(struct data d, uint64_t value, int bits)
 	}
 }
 
-struct data data_append_re(struct data d, const struct fdt_reserve_entry *re)
+struct data data_append_re(struct data d, uint64_t address, uint64_t size)
 {
-	struct fdt_reserve_entry bere;
+	struct fdt_reserve_entry re;
 
-	bere.address = cpu_to_fdt64(re->address);
-	bere.size = cpu_to_fdt64(re->size);
+	re.address = cpu_to_fdt64(address);
+	re.size = cpu_to_fdt64(size);
 
-	return data_append_data(d, &bere, sizeof(bere));
+	return data_append_data(d, &re, sizeof(re));
 }
 
 struct data data_append_cell(struct data d, cell_t word)
scripts/dtc/dtc-lexer.l +1 -6
index 52bed7b74940..fd825ebba69c 100644
@@ -62,12 +62,7 @@ static int dts_version = 1;
 
 static void push_input_file(const char *filename);
 static bool pop_input_file(void);
-#ifdef __GNUC__
-static void lexical_error(const char *fmt, ...)
-	__attribute__((format (printf, 1, 2)));
-#else
-static void lexical_error(const char *fmt, ...);
-#endif
+static void PRINTF(1, 2) lexical_error(const char *fmt, ...);
 
 %}
 
scripts/dtc/dtc-lexer.lex.c_shipped +38 -43

275 lines not on this page · raw message

scripts/dtc/dtc.c +2 -3
index bb1e52b3181c..f5eed9d72c02 100644
@@ -138,7 +138,7 @@ static const char *guess_type_by_name(const char *fname, const char *fallback)
 static const char *guess_input_format(const char *fname, const char *fallback)
 {
 	struct stat statbuf;
-	uint32_t magic;
+	fdt32_t magic;
 	FILE *f;
 
 	if (stat(fname, &statbuf) != 0)
@@ -159,8 +159,7 @@ static const char *guess_input_format(const char *fname, const char *fallback)
 	}
 	fclose(f);
 
-	magic = fdt32_to_cpu(magic);
-	if (magic == FDT_MAGIC)
+	if (fdt32_to_cpu(magic) == FDT_MAGIC)
 		return "dtb";
 
 	return guess_type_by_name(fname, fallback);
scripts/dtc/dtc.h +2 -3
index 1ac2a1e3a4a5..403b79deab88 100644
@@ -43,7 +43,6 @@
 #define debug(...)
 #endif
 
-
 #define DEFAULT_FDT_VERSION	17
 
 /*
@@ -114,7 +113,7 @@ struct data data_insert_at_marker(struct data d, struct marker *m,
 struct data data_merge(struct data d1, struct data d2);
 struct data data_append_cell(struct data d, cell_t word);
 struct data data_append_integer(struct data d, uint64_t word, int bits);
-struct data data_append_re(struct data d, const struct fdt_reserve_entry *re);
+struct data data_append_re(struct data d, uint64_t address, uint64_t size);
 struct data data_append_addr(struct data d, uint64_t addr);
 struct data data_append_byte(struct data d, uint8_t byte);
 struct data data_append_zeroes(struct data d, int len);
@@ -227,7 +226,7 @@ uint32_t guess_boot_cpuid(struct node *tree);
 /* Boot info (tree plus memreserve information */
 
 struct reserve_info {
-	struct fdt_reserve_entry re;
+	uint64_t address, size;
 
 	struct reserve_info *next;
 
scripts/dtc/flattree.c +26 -32

148 lines not on this page · raw message

scripts/dtc/libfdt/libfdt_env.h +13 -13
index 99f936dacc60..952056cddf09 100644
@@ -58,16 +58,16 @@
 #include <string.h>
 
 #ifdef __CHECKER__
-#define __force __attribute__((force))
-#define __bitwise __attribute__((bitwise))
+#define FDT_FORCE __attribute__((force))
+#define FDT_BITWISE __attribute__((bitwise))
 #else
-#define __force
-#define __bitwise
+#define FDT_FORCE
+#define FDT_BITWISE
 #endif
 
-typedef uint16_t __bitwise fdt16_t;
-typedef uint32_t __bitwise fdt32_t;
-typedef uint64_t __bitwise fdt64_t;
+typedef uint16_t FDT_BITWISE fdt16_t;
+typedef uint32_t FDT_BITWISE fdt32_t;
+typedef uint64_t FDT_BITWISE fdt64_t;
 
 #define EXTRACT_BYTE(x, n)	((unsigned long long)((uint8_t *)&x)[n])
 #define CPU_TO_FDT16(x) ((EXTRACT_BYTE(x, 0) << 8) | EXTRACT_BYTE(x, 1))
@@ -80,29 +80,29 @@ typedef uint64_t __bitwise fdt64_t;
 
 static inline uint16_t fdt16_to_cpu(fdt16_t x)
 {
-	return (__force uint16_t)CPU_TO_FDT16(x);
+	return (FDT_FORCE uint16_t)CPU_TO_FDT16(x);
 }
 static inline fdt16_t cpu_to_fdt16(uint16_t x)
 {
-	return (__force fdt16_t)CPU_TO_FDT16(x);
+	return (FDT_FORCE fdt16_t)CPU_TO_FDT16(x);
 }
 
 static inline uint32_t fdt32_to_cpu(fdt32_t x)
 {
-	return (__force uint32_t)CPU_TO_FDT32(x);
+	return (FDT_FORCE uint32_t)CPU_TO_FDT32(x);
 }
 static inline fdt32_t cpu_to_fdt32(uint32_t x)
 {
-	return (__force fdt32_t)CPU_TO_FDT32(x);
+	return (FDT_FORCE fdt32_t)CPU_TO_FDT32(x);
 }
 
 static inline uint64_t fdt64_to_cpu(fdt64_t x)
 {
-	return (__force uint64_t)CPU_TO_FDT64(x);
+	return (FDT_FORCE uint64_t)CPU_TO_FDT64(x);
 }
 static inline fdt64_t cpu_to_fdt64(uint64_t x)
 {
-	return (__force fdt64_t)CPU_TO_FDT64(x);
+	return (FDT_FORCE fdt64_t)CPU_TO_FDT64(x);
 }
 #undef CPU_TO_FDT64
 #undef CPU_TO_FDT32
scripts/dtc/livetree.c +8 -8
index 36be9afefd53..3673de07e4e5 100644
@@ -319,8 +319,8 @@ struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size)
 
 	memset(new, 0, sizeof(*new));
 
-	new->re.address = address;
-	new->re.size = size;
+	new->address = address;
+	new->size = size;
 
 	return new;
 }
@@ -393,7 +393,7 @@ struct property *get_property(struct node *node, const char *propname)
 cell_t propval_cell(struct property *prop)
 {
 	assert(prop->val.len == sizeof(cell_t));
-	return fdt32_to_cpu(*((cell_t *)prop->val.val));
+	return fdt32_to_cpu(*((fdt32_t *)prop->val.val));
 }
 
 struct property *get_property_by_label(struct node *tree, const char *label,
@@ -599,13 +599,13 @@ static int cmp_reserve_info(const void *ax, const void *bx)
 	a = *((const struct reserve_info * const *)ax);
 	b = *((const struct reserve_info * const *)bx);
 
-	if (a->re.address < b->re.address)
+	if (a->address < b->address)
 		return -1;
-	else if (a->re.address > b->re.address)
+	else if (a->address > b->address)
 		return 1;
-	else if (a->re.size < b->re.size)
+	else if (a->size < b->size)
 		return -1;
-	else if (a->re.size > b->re.size)
+	else if (a->size > b->size)
 		return 1;
 	else
 		return 0;
@@ -902,7 +902,7 @@ static void add_local_fixup_entry(struct dt_info *dti,
 		struct node *refnode)
 {
 	struct node *wn, *nwn;	/* local fixup node, walk node, new */
-	uint32_t value_32;
+	fdt32_t value_32;
 	char **compp;
 	int i, depth;
 
scripts/dtc/srcpos.h +5 -6
index 2cdfcd82e95e..7caca8257c6d 100644
@@ -22,6 +22,7 @@
 
 #include <stdio.h>
 #include <stdbool.h>
+#include "util.h"
 
 struct srcfile_state {
 	FILE *f;
@@ -106,12 +107,10 @@ extern void srcpos_update(struct srcpos *pos, const char *text, int len);
 extern struct srcpos *srcpos_copy(struct srcpos *pos);
 extern char *srcpos_string(struct srcpos *pos);
 
-extern void srcpos_verror(struct srcpos *pos, const char *prefix,
-			  const char *fmt, va_list va)
-	__attribute__((format(printf, 3, 0)));
-extern void srcpos_error(struct srcpos *pos, const char *prefix,
-			 const char *fmt, ...)
-	__attribute__((format(printf, 3, 4)));
+extern void PRINTF(3, 0) srcpos_verror(struct srcpos *pos, const char *prefix,
+					const char *fmt, va_list va);
+extern void PRINTF(3, 4) srcpos_error(struct srcpos *pos, const char *prefix,
+				      const char *fmt, ...);
 
 extern void srcpos_set_line(char *f, int l);
 
scripts/dtc/treesource.c +3 -3
index c9d8967969f9..2461a3d068a0 100644
@@ -137,7 +137,7 @@ static void write_propval_string(FILE *f, struct data val)
 static void write_propval_cells(FILE *f, struct data val)
 {
 	void *propend = val.val + val.len;
-	cell_t *cp = (cell_t *)val.val;
+	fdt32_t *cp = (fdt32_t *)val.val;
 	struct marker *m = val.markers;
 
 	fprintf(f, "<");
@@ -275,8 +275,8 @@ void dt_to_source(FILE *f, struct dt_info *dti)
 		for_each_label(re->labels, l)
 			fprintf(f, "%s: ", l->label);
 		fprintf(f, "/memreserve/\t0x%016llx 0x%016llx;\n",
-			(unsigned long long)re->re.address,
-			(unsigned long long)re->re.size);
+			(unsigned long long)re->address,
+			(unsigned long long)re->size);
 	}
 
 	write_tree_source_node(f, dti->dt, 0);
scripts/dtc/util.c +6 -5
index 3550f86bd6df..9953c32a0244 100644
@@ -396,7 +396,7 @@ void utilfdt_print_data(const char *data, int len)
 		} while (s < data + len);
 
 	} else if ((len % 4) == 0) {
-		const uint32_t *cell = (const uint32_t *)data;
+		const fdt32_t *cell = (const fdt32_t *)data;
 
 		printf(" = <");
 		for (i = 0, len /= 4; i < len; i++)
@@ -412,15 +412,16 @@ void utilfdt_print_data(const char *data, int len)
 	}
 }
 
-void util_version(void)
+void NORETURN util_version(void)
 {
 	printf("Version: %s\n", DTC_VERSION);
 	exit(0);
 }
 
-void util_usage(const char *errmsg, const char *synopsis,
-		const char *short_opts, struct option const long_opts[],
-		const char * const opts_help[])
+void NORETURN util_usage(const char *errmsg, const char *synopsis,
+			 const char *short_opts,
+			 struct option const long_opts[],
+			 const char * const opts_help[])
 {
 	FILE *fp = errmsg ? stderr : stdout;
 	const char a_arg[] = "<arg>";
scripts/dtc/util.h +14 -16
index bc3d223fa6e3..ad5f41199edb 100644
@@ -25,15 +25,17 @@
  *                                                                   USA
  */
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
 #ifdef __GNUC__
-static inline void
-__attribute__((noreturn)) __attribute__((format (printf, 1, 2)))
-die(const char *str, ...)
+#define PRINTF(i, j)	__attribute__((format (printf, i, j)))
+#define NORETURN	__attribute__((noreturn))
 #else
-static inline void die(const char *str, ...)
+#define PRINTF(i, j)
+#define NORETURN
 #endif
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+static inline void NORETURN PRINTF(1, 2) die(const char *str, ...)
 {
 	va_list ap;
 
@@ -66,12 +68,7 @@ static inline void *xrealloc(void *p, size_t len)
 
 extern char *xstrdup(const char *s);
 
-#ifdef __GNUC__
-extern int __attribute__((format (printf, 2, 3)))
-xasprintf(char **strp, const char *fmt, ...);
-#else
-extern int xasprintf(char **strp, const char *fmt, ...);
-#endif
+extern int PRINTF(2, 3) xasprintf(char **strp, const char *fmt, ...);
 extern char *join_path(const char *path, const char *name);
 
 /**
@@ -200,7 +197,7 @@ void utilfdt_print_data(const char *data, int len);
 /**
  * Show source version and exit
  */
-void util_version(void) __attribute__((noreturn));
+void NORETURN util_version(void);
 
 /**
  * Show usage and exit
@@ -214,9 +211,10 @@ void util_version(void) __attribute__((noreturn));
  * @param long_opts	The structure of long options
  * @param opts_help	An array of help strings (should align with long_opts)
  */
-void util_usage(const char *errmsg, const char *synopsis,
-		const char *short_opts, struct option const long_opts[],
-		const char * const opts_help[]) __attribute__((noreturn));
+void NORETURN util_usage(const char *errmsg, const char *synopsis,
+			 const char *short_opts,
+			 struct option const long_opts[],
+			 const char * const opts_help[]);
 
 /**
  * Show usage and exit
scripts/dtc/version_gen.h +1 -1
index bbbd96b1dca3..859564e8b466 100644
@@ -1 +1 @@
-#define DTC_VERSION "DTC 1.4.3"
+#define DTC_VERSION "DTC 1.4.4"
Signature · 1 line
1.9.1
author
#7 lore raw

PATCH 3/5 scripts/dtc: Update to upstream version v1.4.4-50-gfe50bd1ecc1d

In reply to Tom Rini

This adds the following commits from upstream:

fe50bd1ecc1d fdtget: Split out cell list display into a new function 62d812308d11 README: Add a note about test_tree1.dts
5bed86aee9e8 pylibfdt: Add support for fdt_subnode_offset() 46f31b65b3b3 pylibfdt: Add support for fdt_node_offset_by_phandle() a3ae43723687 pylibfdt: Add support for fdt_parent_offset() a198af80344c pylibfdt: Add support for fdt_get_phandle()
b9eba92ea50f tests: Return a failure code when any tests fail 155faf6cc209 pylibfdt: Use local pylibfdt module
50e5cd07f325 pylibfdt: Add a test for use of uint32_t
ab78860f09f5 pylibfdt: Add stdint include to fix uint32_t 36f511fb1113 tests: Add stacked overlay tests on fdtoverlay 1bb00655d3e5 fdt: Allow stacked overlays phandle references a33c2247ac8d Introduce fdt_setprop_placeholder() method
0016f8c2aa32 dtc: change default phandles to ePAPR style instead of both e3b9a9588a35 tests: fdtoverlay unit test
42409146f2db fdtoverlay: A tool that applies overlays
aae22722fc8d manual: Document missing options
13ce6e1c2fc4 dtc: fix sprintf() format string error, again d990b8013889 Makefile: Fix build on MSYS2 and Cygwin
51f56dedf8ea Clean up shared library compile/link options 21a2bc896e3d Suppress expected error message in fdtdump test 2a42b14d0d03 dtc: check.c fix compile error
a10cb3c818d3 Fix get_node_by_path string equality check
548aea2c436a fdtdump: Discourage use of fdtdump
c2258841a785 fdtdump: Fix over-zealous version check
9067ee4be0e6 Fix a few whitespace and style nits
e56f2b07be38 pylibfdt: Use setup.py to build the swig file 896f1c133265 pylibfdt: Use Makefile constructs to implement NO_PYTHON 90db6d9989ca pylibfdt: Allow setup.py to operate stand-alone e20d9658cd8f Add Coverity Scan support
b04a2cf08862 pylibfdt: Fix code style in setup.py
1c5170d3a466 pylibfdt: Rename libfdt.swig to libfdt.i
580a9f6c2880 Add a libfdt function to write a property placeholder ab15256d8d02 pylibfdt: Use the call function to simplify the Makefile 9f2e3a3a1f19 pylibfdt: Use the correct libfdt version in the module e91c652af215 pylibfdt: Enable installation of Python module 8a892fd85d94 pylibfdt: Allow building to be disabled
741cdff85d3e .travis.yml: Add builds with and without Python library prerequisites 14c4171f4f9a pylibfdt: Use package_dir to set the package directory 89a5062ab231 pylibfdt: Use environment to pass C flags and files 4e0e0d049757 pylibfdt: Allow pkg-config to be supplied in the environment 6afd7d9688f5 Correct typo: s/pylibgfdt/pylibfdt/
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

---
 scripts/dtc/checks.c                | 231 ++++++++++++++++++++++++++++++++++++
 scripts/dtc/dtc.c                   |   2 +-
 scripts/dtc/dtc.h                   |   6 +
 scripts/dtc/libfdt/fdt_empty_tree.c |   1 -
 scripts/dtc/libfdt/fdt_ro.c         |   4 +-
 scripts/dtc/libfdt/fdt_rw.c         |  24 +++-
 scripts/dtc/libfdt/fdt_sw.c         |  16 ++-
 scripts/dtc/libfdt/fdt_wip.c        |   4 +-
 scripts/dtc/libfdt/libfdt.h         |  68 ++++++++++-
 scripts/dtc/livetree.c              |   3 +-
 scripts/dtc/version_gen.h           |   2 +-
 11 files changed, 345 insertions(+), 16 deletions(-)
scripts/dtc/checks.c +231 -0
index 38f548e582c8..afabf64337d5 100644
@@ -681,6 +681,229 @@ static void check_ranges_format(struct check *c, struct dt_info *dti,
 }
 WARNING(ranges_format, check_ranges_format, NULL, &addr_size_cells);
 
+static const struct bus_type pci_bus = {
+	.name = "PCI",
+};
+
+static void check_pci_bridge(struct check *c, struct dt_info *dti, struct node *node)
+{
+	struct property *prop;
+	cell_t *cells;
+
+	prop = get_property(node, "device_type");
+	if (!prop || !streq(prop->val.val, "pci"))
+		return;
+
+	node->bus = &pci_bus;
+
+	if (!strneq(node->name, "pci", node->basenamelen) &&
+	    !strneq(node->name, "pcie", node->basenamelen))
+		FAIL(c, dti, "Node %s node name is not \"pci\" or \"pcie\"",
+			     node->fullpath);
+
+	prop = get_property(node, "ranges");
+	if (!prop)
+		FAIL(c, dti, "Node %s missing ranges for PCI bridge (or not a bridge)",
+			     node->fullpath);
+
+	if (node_addr_cells(node) != 3)
+		FAIL(c, dti, "Node %s incorrect #address-cells for PCI bridge",
+			     node->fullpath);
+	if (node_size_cells(node) != 2)
+		FAIL(c, dti, "Node %s incorrect #size-cells for PCI bridge",
+			     node->fullpath);
+
+	prop = get_property(node, "bus-range");
+	if (!prop) {
+		FAIL(c, dti, "Node %s missing bus-range for PCI bridge",
+			     node->fullpath);
+		return;
+	}
+	if (prop->val.len != (sizeof(cell_t) * 2)) {
+		FAIL(c, dti, "Node %s bus-range must be 2 cells",
+			     node->fullpath);
+		return;
+	}
+	cells = (cell_t *)prop->val.val;
+	if (fdt32_to_cpu(cells[0]) > fdt32_to_cpu(cells[1]))
+		FAIL(c, dti, "Node %s bus-range 1st cell must be less than or equal to 2nd cell",
+			     node->fullpath);
+	if (fdt32_to_cpu(cells[1]) > 0xff)
+		FAIL(c, dti, "Node %s bus-range maximum bus number must be less than 256",
+			     node->fullpath);
+}
+WARNING(pci_bridge, check_pci_bridge, NULL,
+	&device_type_is_string, &addr_size_cells);
+
+static void check_pci_device_bus_num(struct check *c, struct dt_info *dti, struct node *node)
+{
+	struct property *prop;
+	unsigned int bus_num, min_bus, max_bus;
+	cell_t *cells;
+
+	if (!node->parent || (node->parent->bus != &pci_bus))
+		return;
+
+	prop = get_property(node, "reg");
+	if (!prop)
+		return;
+
+	cells = (cell_t *)prop->val.val;
+	bus_num = (fdt32_to_cpu(cells[0]) & 0x00ff0000) >> 16;
+
+	prop = get_property(node->parent, "bus-range");
+	if (!prop) {
+		min_bus = max_bus = 0;
+	} else {
+		cells = (cell_t *)prop->val.val;
+		min_bus = fdt32_to_cpu(cells[0]);
+		max_bus = fdt32_to_cpu(cells[0]);
+	}
+	if ((bus_num < min_bus) || (bus_num > max_bus))
+		FAIL(c, dti, "Node %s PCI bus number %d out of range, expected (%d - %d)",
+		     node->fullpath, bus_num, min_bus, max_bus);
+}
+WARNING(pci_device_bus_num, check_pci_device_bus_num, NULL, &reg_format, &pci_bridge);
+
+static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct node *node)
+{
+	struct property *prop;
+	const char *unitname = get_unitname(node);
+	char unit_addr[5];
+	unsigned int dev, func, reg;
+	cell_t *cells;
+
+	if (!node->parent || (node->parent->bus != &pci_bus))
+		return;
+
+	prop = get_property(node, "reg");
+	if (!prop) {
+		FAIL(c, dti, "Node %s missing PCI reg property", node->fullpath);
+		return;
+	}
+
+	cells = (cell_t *)prop->val.val;
+	if (cells[1] || cells[2])
+		FAIL(c, dti, "Node %s PCI reg config space address cells 2 and 3 must be 0",
+			     node->fullpath);
+
+	reg = fdt32_to_cpu(cells[0]);
+	dev = (reg & 0xf800) >> 11;
+	func = (reg & 0x700) >> 8;
+
+	if (reg & 0xff000000)
+		FAIL(c, dti, "Node %s PCI reg address is not configuration space",
+			     node->fullpath);
+	if (reg & 0x000000ff)
+		FAIL(c, dti, "Node %s PCI reg config space address register number must be 0",
+			     node->fullpath);
+
+	if (func == 0) {
+		snprintf(unit_addr, sizeof(unit_addr), "%x", dev);
+		if (streq(unitname, unit_addr))
+			return;
+	}
+
+	snprintf(unit_addr, sizeof(unit_addr), "%x,%x", dev, func);
+	if (streq(unitname, unit_addr))
+		return;
+
+	FAIL(c, dti, "Node %s PCI unit address format error, expected \"%s\"",
+	     node->fullpath, unit_addr);
+}
+WARNING(pci_device_reg, check_pci_device_reg, NULL, &reg_format, &pci_bridge);
+
+static const struct bus_type simple_bus = {
+	.name = "simple-bus",
+};
+
+static bool node_is_compatible(struct node *node, const char *compat)
+{
+	struct property *prop;
+	const char *str, *end;
+
+	prop = get_property(node, "compatible");
+	if (!prop)
+		return false;
+
+	for (str = prop->val.val, end = str + prop->val.len; str < end;
+	     str += strnlen(str, end - str) + 1) {
+		if (strneq(str, compat, end - str))
+			return true;
+	}
+	return false;
+}
+
+static void check_simple_bus_bridge(struct check *c, struct dt_info *dti, struct node *node)
+{
+	if (node_is_compatible(node, "simple-bus"))
+		node->bus = &simple_bus;
+}
+WARNING(simple_bus_bridge, check_simple_bus_bridge, NULL, &addr_size_cells);
+
+static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct node *node)
+{
+	struct property *prop;
+	const char *unitname = get_unitname(node);
+	char unit_addr[17];
+	unsigned int size;
+	uint64_t reg = 0;
+	cell_t *cells = NULL;
+
+	if (!node->parent || (node->parent->bus != &simple_bus))
+		return;
+
+	prop = get_property(node, "reg");
+	if (prop)
+		cells = (cell_t *)prop->val.val;
+	else {
+		prop = get_property(node, "ranges");
+		if (prop && prop->val.len)
+			/* skip of child address */
+			cells = ((cell_t *)prop->val.val) + node_addr_cells(node);
+	}
+
+	if (!cells) {
+		if (node->parent->parent && !(node->bus == &simple_bus))
+			FAIL(c, dti, "Node %s missing or empty reg/ranges property", node->fullpath);
+		return;
+	}
+
+	size = node_addr_cells(node->parent);
+	while (size--)
+		reg = (reg << 32) | fdt32_to_cpu(*(cells++));
+
+	snprintf(unit_addr, sizeof(unit_addr), "%"PRIx64, reg);
+	if (!streq(unitname, unit_addr))
+		FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"",
+		     node->fullpath, unit_addr);
+}
+WARNING(simple_bus_reg, check_simple_bus_reg, NULL, &reg_format, &simple_bus_bridge);
+
+static void check_unit_address_format(struct check *c, struct dt_info *dti,
+				      struct node *node)
+{
+	const char *unitname = get_unitname(node);
+
+	if (node->parent && node->parent->bus)
+		return;
+
+	if (!unitname[0])
+		return;
+
+	if (!strncmp(unitname, "0x", 2)) {
+		FAIL(c, dti, "Node %s unit name should not have leading \"0x\"",
+		    node->fullpath);
+		/* skip over 0x for next test */
+		unitname += 2;
+	}
+	if (unitname[0] == '0' && isxdigit(unitname[1]))
+		FAIL(c, dti, "Node %s unit name should not have leading 0s",
+		    node->fullpath);
+}
+WARNING(unit_address_format, check_unit_address_format, NULL,
+	&node_name_format, &pci_bridge, &simple_bus_bridge);
+
 /*
  * Style checks
  */
@@ -752,6 +975,14 @@ static struct check *check_table[] = {
 	&addr_size_cells, &reg_format, &ranges_format,
 
 	&unit_address_vs_reg,
+	&unit_address_format,
+
+	&pci_bridge,
+	&pci_device_reg,
+	&pci_device_bus_num,
+
+	&simple_bus_bridge,
+	&simple_bus_reg,
 
 	&avoid_default_addr_size,
 	&obsolete_chosen_interrupt_controller,
scripts/dtc/dtc.c +1 -1
index f5eed9d72c02..5ed873c72ad1 100644
@@ -31,7 +31,7 @@ int reservenum;		/* Number of memory reservation slots */
 int minsize;		/* Minimum blob size */
 int padsize;		/* Additional padding to blob */
 int alignsize;		/* Additional padding to blob accroding to the alignsize */
-int phandle_format = PHANDLE_BOTH;	/* Use linux,phandle or phandle properties */
+int phandle_format = PHANDLE_EPAPR;	/* Use linux,phandle or phandle properties */
 int generate_symbols;	/* enable symbols & fixup support */
 int generate_fixups;		/* suppress generation of fixups on symbol support */
 int auto_label_aliases;		/* auto generate labels -> aliases */
scripts/dtc/dtc.h +6 -0
index 403b79deab88..409db76c94b7 100644
@@ -31,6 +31,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <unistd.h>
+#include <inttypes.h>
 
 #include <libfdt_env.h>
 #include <fdt.h>
@@ -135,6 +136,10 @@ struct label {
 	struct label *next;
 };
 
+struct bus_type {
+	const char *name;
+};
+
 struct property {
 	bool deleted;
 	char *name;
@@ -161,6 +166,7 @@ struct node {
 	int addr_cells, size_cells;
 
 	struct label *labels;
+	const struct bus_type *bus;
 };
 
 #define for_each_label_withdel(l0, l) \
scripts/dtc/libfdt/fdt_empty_tree.c +0 -1
index f72d13b1d19c..f2ae9b77c285 100644
@@ -81,4 +81,3 @@ int fdt_create_empty_tree(void *buf, int bufsize)
 
 	return fdt_open_into(buf, buf, bufsize);
 }
-
scripts/dtc/libfdt/fdt_ro.c +2 -2
index 3d00d2eee0e3..08de2cce674d 100644
@@ -60,7 +60,7 @@ static int _fdt_nodename_eq(const void *fdt, int offset,
 {
 	const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1);
 
-	if (! p)
+	if (!p)
 		/* short match */
 		return 0;
 
@@ -327,7 +327,7 @@ const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
 	const struct fdt_property *prop;
 
 	prop = fdt_get_property_namelen(fdt, nodeoffset, name, namelen, lenp);
-	if (! prop)
+	if (!prop)
 		return NULL;
 
 	return prop->data;
scripts/dtc/libfdt/fdt_rw.c +19 -5
index 3fd5847377c9..5c3a2bb0bc6b 100644
@@ -207,7 +207,7 @@ static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
 	int err;
 
 	*prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen);
-	if (! (*prop))
+	if (!*prop)
 		return oldlen;
 
 	if ((err = _fdt_splice_struct(fdt, (*prop)->data, FDT_TAGALIGN(oldlen),
@@ -269,8 +269,8 @@ int fdt_set_name(void *fdt, int nodeoffset, const char *name)
 	return 0;
 }
 
-int fdt_setprop(void *fdt, int nodeoffset, const char *name,
-		const void *val, int len)
+int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,
+			    int len, void **prop_data)
 {
 	struct fdt_property *prop;
 	int err;
@@ -283,8 +283,22 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name,
 	if (err)
 		return err;
 
+	*prop_data = prop->data;
+	return 0;
+}
+
+int fdt_setprop(void *fdt, int nodeoffset, const char *name,
+		const void *val, int len)
+{
+	void *prop_data;
+	int err;
+
+	err = fdt_setprop_placeholder(fdt, nodeoffset, name, len, &prop_data);
+	if (err)
+		return err;
+
 	if (len)
-		memcpy(prop->data, val, len);
+		memcpy(prop_data, val, len);
 	return 0;
 }
 
@@ -323,7 +337,7 @@ int fdt_delprop(void *fdt, int nodeoffset, const char *name)
 	FDT_RW_CHECK_HEADER(fdt);
 
 	prop = fdt_get_property_w(fdt, nodeoffset, name, &len);
-	if (! prop)
+	if (!prop)
 		return len;
 
 	proplen = sizeof(*prop) + FDT_TAGALIGN(len);
scripts/dtc/libfdt/fdt_sw.c +14 -2
index 6a804859fd0c..2bd15e7aef87 100644
@@ -220,7 +220,7 @@ static int _fdt_find_add_string(void *fdt, const char *s)
 	return offset;
 }
 
-int fdt_property(void *fdt, const char *name, const void *val, int len)
+int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp)
 {
 	struct fdt_property *prop;
 	int nameoff;
@@ -238,7 +238,19 @@ int fdt_property(void *fdt, const char *name, const void *val, int len)
 	prop->tag = cpu_to_fdt32(FDT_PROP);
 	prop->nameoff = cpu_to_fdt32(nameoff);
 	prop->len = cpu_to_fdt32(len);
-	memcpy(prop->data, val, len);
+	*valp = prop->data;
+	return 0;
+}
+
+int fdt_property(void *fdt, const char *name, const void *val, int len)
+{
+	void *ptr;
+	int ret;
+
+	ret = fdt_property_placeholder(fdt, name, len, &ptr);
+	if (ret)
+		return ret;
+	memcpy(ptr, val, len);
 	return 0;
 }
 
scripts/dtc/libfdt/fdt_wip.c +2 -2
index 6aaab399929c..5e859198622b 100644
@@ -82,7 +82,7 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
 	int proplen;
 
 	propval = fdt_getprop(fdt, nodeoffset, name, &proplen);
-	if (! propval)
+	if (!propval)
 		return proplen;
 
 	if (proplen != len)
@@ -107,7 +107,7 @@ int fdt_nop_property(void *fdt, int nodeoffset, const char *name)
 	int len;
 
 	prop = fdt_get_property_w(fdt, nodeoffset, name, &len);
-	if (! prop)
+	if (!prop)
 		return len;
 
 	_fdt_nop_region(prop, len + sizeof(*prop));
scripts/dtc/libfdt/libfdt.h +67 -1

172 lines not on this page · raw message

scripts/dtc/livetree.c +2 -1
index 3673de07e4e5..aecd27875fdd 100644
@@ -478,7 +478,8 @@ struct node *get_node_by_path(struct node *tree, const char *path)
 	p = strchr(path, '/');
 
 	for_each_child(tree, child) {
-		if (p && strneq(path, child->name, p-path))
+		if (p && (strlen(child->name) == p-path) &&
+				strneq(path, child->name, p-path))
 			return get_node_by_path(child, p+1);
 		else if (!p && streq(path, child->name))
 			return child;
scripts/dtc/version_gen.h +1 -1
index 859564e8b466..b5ed715eccf1 100644
@@ -1 +1 @@
-#define DTC_VERSION "DTC 1.4.4"
+#define DTC_VERSION "DTC 1.4.4-gfe50bd1e"
Signature · 1 line
1.9.1
author
#8 lore raw

PATCH 4/5 dtc: Switch to building and using our own dtc unless provided

In reply to Tom Rini

This makes us act like the Linux Kernel does and allow for dtc to be provided externally but otherwise we use the version of dtc that is included in the sources. This in turn means that we can drop the checkdtc logic. We select DTC in the cases where we will need the dtc tool provided.

---
 .travis.yml      |  6 ++----
 Makefile         | 10 ++--------
 dts/Kconfig      |  4 ++++
 scripts/Makefile |  1 +
 4 files changed, 9 insertions(+), 12 deletions(-)
.travis.yml +2 -4
index 9dfd016da000..00b2a73a5eff 100644
@@ -26,11 +26,9 @@ addons:
     - grub-efi-ia32-bin
     - rpm2cpio
     - wget
+    - device-tree-compiler
 
 install:
- # install latest device tree compiler
- - git clone --depth=1 -b v1.4.3 git://git.kernel.org/pub/scm/utils/dtc/dtc.git /tmp/dtc
- - make -j4 -C /tmp/dtc
  # Clone uboot-test-hooks
  - git clone --depth=1 git://github.com/swarren/uboot-test-hooks.git /tmp/uboot-test-hooks
  - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
@@ -51,7 +49,7 @@ install:
 
 env:
   global:
-    - PATH=/tmp/dtc:/tmp/qemu-install/bin:/tmp/uboot-test-hooks/bin:/usr/bin:/bin
+    - PATH=/tmp/qemu-install/bin:/tmp/uboot-test-hooks/bin:/usr/bin:/bin
     - PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci
     - BUILD_DIR=build
     - HOSTCC="cc"
Makefile +2 -8
index e058e9854b7b..b7d5cbb3f9ad 100644
@@ -349,7 +349,7 @@ OBJDUMP		= $(CROSS_COMPILE)objdump
 AWK		= awk
 PERL		= perl
 PYTHON		?= python
-DTC		?= dtc
+DTC		?= $(objtree)/scripts/dtc/dtc
 CHECK		= sparse
 
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
@@ -872,7 +872,7 @@ endif
 PHONY += dtbs
 dtbs: dts/dt.dtb
 	@:
-dts/dt.dtb: checkdtc u-boot
+dts/dt.dtb: u-boot
 	$(Q)$(MAKE) $(build)=dts dtbs
 
 quiet_cmd_copy = COPY    $@
@@ -1447,12 +1447,6 @@ SYSTEM_MAP = \
 System.map:	u-boot
 		@$(call SYSTEM_MAP,$<) > $@
 
-checkdtc:
-	@if test $(call dtc-version) -lt 010403; then \
-		echo '*** Your dtc is too old, please upgrade to dtc 1.4.3 or newer'; \
-		false; \
-	fi
-
 #########################################################################
 
 # ARM relocations should all be R_ARM_RELATIVE (32-bit) or
dts/Kconfig +4 -0
index b4b7ddc1444a..44fc9fe36dd7 100644
@@ -5,11 +5,15 @@
 config SUPPORT_OF_CONTROL
 	bool
 
+config DTC
+	bool
+
 menu "Device Tree Control"
 	depends on SUPPORT_OF_CONTROL
 
 config OF_CONTROL
 	bool "Run-time configuration via Device Tree"
+	select DTC
 	help
 	  This feature provides for run-time configuration of U-Boot
 	  via a flattened device tree.
scripts/Makefile +1 -0
index 3e10c16d59fd..9d55241463d4 100644
@@ -21,3 +21,4 @@ build_docproc: $(obj)/docproc
 
 # Let clean descend into subdirs
 subdir-	+= basic kconfig
+subdir-$(CONFIG_DTC)	+= dtc
Signature · 1 line
1.9.1
author
#9 lore raw

PATCH 5/5 tools/mkimage: Make the path to the dtc binary that mkimage calls configurable

In reply to Tom Rini

In some cases, such as FreeBSD, the path to an alternative dtc needs to be used. Rather than override the one given in the Makefile on the command line, make this part of the build configuration.

---
 dts/Kconfig    | 9 +++++++++
 tools/Makefile | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
dts/Kconfig +9 -0
index 44fc9fe36dd7..4ee051094319 100644
@@ -170,3 +170,12 @@ config TPL_OF_PLATDATA
 	  information.
 
 endmenu
+
+config MKIMAGE_DTC_PATH
+	string "Path to dtc binary for use within mkimage"
+	default "dtc"
+	help
+	  The mkimage host tool will, in order to generate FIT images make
+	  calls to the dtc application in order to create the output.  In
+	  some cases the system dtc may not support all required features
+	  and the path to a different version should be given here.
tools/Makefile +1 -1
index a0db19d6b057..c16477459d23 100644
@@ -175,7 +175,7 @@ HOSTCFLAGS_rsa-sign.o += -Wno-deprecated-declarations
 endif
 endif
 
-HOSTCFLAGS_fit_image.o += -DMKIMAGE_DTC=\"$(DTC)\"
+HOSTCFLAGS_fit_image.o += -DMKIMAGE_DTC=\"$(CONFIG_MKIMAGE_DTC_PATH)\"
 
 HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage)
 HOSTLOADLIBES_fit_info := $(HOSTLOADLIBES_mkimage)
Signature · 1 line
1.9.1
#10 lore raw

cover Follow the Linux Kernel in building dtc as needed

In reply to Tom Rini
Quoted 6 lines · Tom Rini

The following series has been applied. I am posting this for the record.

For the record, I do not believe that using git submodules is a good approach here. We have a small amount of code that we need here, and happily we can leverage infrastructur e from the Linux Kernel.

Quoted 6 lines

Speaking of, this is not the first time we have run into problems deviating from the workflow of the kernel. The problems of having large number of warnings, or not stemmed from not just leve raging all of the infrastructure from the kernel. So related, yes, fixes for these warnings should come in, and as always, if they're in the upstream kernel dts as well, they should be fixed there.

So any comments regarding bundling external tools were ignored, even though the discussion was not finished, great.

Furthermore, there was zero time to review this series, it was just applied and posted afterward ? What sort of practice is this ?

Quoted 2 lines

Thanks all.

Signature · 2 lines
Best regards,
Marek Vasut
author
#11 lore raw

cover Follow the Linux Kernel in building dtc as needed

Quoted 14 lines · Marek Vasut
Quoted 6 lines · Tom Rini

The following series has been applied. I am posting this for the record.

For the record, I do not believe that using git submodules is a good approach here. We have a small amount of code that we need here, and happily we can leverage infrastructur e from the Linux Kernel.

Quoted 6 lines

Speaking of, this is not the first time we have run into problems deviating from the workflow of the kernel. The problems of having large number of warnings, or not stemmed from not just leve raging all of the infrastructure from the kernel. So related, yes, fixes for these warnings should come in, and as always, if they're in the upstream kernel dts as well, they should be fixed there.

Quoted 5 lines

So any comments regarding bundling external tools were ignored, even though the discussion was not finished, great.

Furthermore, there was zero time to review this series, it was just applied and posted afterward ? What sort of practice is this ?

Yes. I put on my slightly-less-than-benevolent dictator hat today, and explained my reasoning. I do feel bad that you're rather unhappy with the overall situation, but no, I believe this is the right answer.

Now, there's some follow up further re-syncing with the kernel that could be done (scripts/Makefile.lib/extrawarn can be further re-matched up with the kernel now, but that would have made a larger delta than "just migrate to providing the tool").

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170924/3a82e835/attachment.sig>
#12 lore raw

cover Follow the Linux Kernel in building dtc as needed

Hi Tom,

Quoted 15 lines · Marek Vasut
Quoted 14 lines · Tom Rini
Quoted 12 lines

The following series has been applied. I am posting this for the record.

For the record, I do not believe that using git submodules is a good approach here. We have a small amount of code that we need here, and happily we can leverage infrastructur e from the Linux Kernel.

Speaking of, this is not the first time we have run into problems deviating from the workflow of the kernel. The problems of having large number of warnings, or not stemmed from not just leve raging all of the infrastructure from the kernel. So related, yes, fixes for these warnings should come in, and as always, if they're in the upstream kernel dts as well, they should be fixed there.

Quoted 7 lines
Quoted 5 lines

So any comments regarding bundling external tools were ignored, even though the discussion was not finished, great.

Furthermore, there was zero time to review this series, it was just applied and posted afterward ? What sort of practice is this ?

Yes. I put on my slightly-less-than-benevolent dictator hat today, and

Linus style? :D Management

Quoted 8 lines

explained my reasoning. I do feel bad that you're rather unhappy with the overall situation, but no, I believe this is the right answer.

Now, there's some follow up further re-syncing with the kernel that could be done (scripts/Makefile.lib/extrawarn can be further re-matched up with the kernel now, but that would have made a larger delta than "just migrate to providing the tool").

But seriously, do we have some kind of road map for this?

I mean if we have copied the dtc tool into u-boot temporarily (until distros catch up) or will it stay with us forever ?

Signature · 9 lines
Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
author
#13 lore raw

cover Follow the Linux Kernel in building dtc as needed

Quoted 20 lines · Å�ukasz Majewski

Hi Tom,

Quoted 18 lines · Marek Vasut
Quoted 17 lines · Tom Rini
Quoted 6 lines

The following series has been applied. I am posting this for the record.

For the record, I do not believe that using git submodules is a good approach here. We have a small amount of code that we need here, and happily we can leverage infrastructur e from the Linux Kernel.

Quoted 6 lines

Speaking of, this is not the first time we have run into problems deviating from the workflow of the kernel. The problems of having large number of warnings, or not stemmed from not just leve raging all of the infrastructure from the kernel. So related, yes, fixes for these warnings should come in, and as always, if they're in the upstream kernel dts as well, they should be fixed there.

So any comments regarding bundling external tools were ignored, even though the discussion was not finished, great.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Furthermore, there was zero time to review this series, it was just applied and posted afterward ? What sort of practice is this ?

Yes. I put on my slightly-less-than-benevolent dictator hat today, and

Linus style? :D Management

It is not my general preference, but yes.

Quoted 8 lines
Quoted 7 lines

explained my reasoning. I do feel bad that you're rather unhappy with the overall situation, but no, I believe this is the right answer.

Now, there's some follow up further re-syncing with the kernel that could be done (scripts/Makefile.lib/extrawarn can be further re-matched up with the kernel now, but that would have made a larger delta than "just migrate to providing the tool").

Quoted 4 lines

But seriously, do we have some kind of road map for this?

I mean if we have copied the dtc tool into u-boot temporarily (until distros catch up) or will it stay with us forever ?

I think long term we'll match what the kernel does and keep synced with upstream, just what we need. I'm thinking I ought to see about pushing a re-sync in the kernel for the next -rc1 there as I know it has been lamented that it hasn't happened in a bit.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170924/d9b0cc08/attachment.sig>
#14 lore raw

cover Follow the Linux Kernel in building dtc as needed

In reply to Tom Rini
Quoted 18 lines · Tom Rini
Quoted 17 lines · Marek Vasut
Quoted 6 lines · Tom Rini

The following series has been applied. I am posting this for the record.

For the record, I do not believe that using git submodules is a good approach here. We have a small amount of code that we need here, and happily we can leverage infrastructur e from the Linux Kernel.

Quoted 6 lines

Speaking of, this is not the first time we have run into problems deviating from the workflow of the kernel. The problems of having large number of warnings, or not stemmed from not just leve raging all of the infrastructure from the kernel. So related, yes, fixes for these warnings should come in, and as always, if they're in the upstream kernel dts as well, they should be fixed there.

So any comments regarding bundling external tools were ignored, even though the discussion was not finished, great.

Quoted 6 lines
Quoted 2 lines

Furthermore, there was zero time to review this series, it was just applied and posted afterward ? What sort of practice is this ?

Yes. I put on my slightly-less-than-benevolent dictator hat today, and explained my reasoning. I do feel bad that you're rather unhappy with the overall situation, but no, I believe this is the right answer.

I believe we have a well-established process of submitting patches, getting a review and then applying them. If the head maintainer doesn't follow the process, why should anyone else ?

I believe you should be an example of doing it right, but what you did here is the exact opposite.

The discussion how to solve this problem properly was also unfinished, yet a decision was taken without any community agreement. What is the point of discussing anything on the ML if the decision gets ignored ?

Quoted 5 lines

Now, there's some follow up further re-syncing with the kernel that could be done (scripts/Makefile.lib/extrawarn can be further re-matched up with the kernel now, but that would have made a larger delta than "just migrate to providing the tool").

Signature · 2 lines
Best regards,
Marek Vasut
#15 lore raw

cover Follow the Linux Kernel in building dtc as needed

In reply to Tom Rini

Dear Tom,

Quoted 2 lines · In message <[email protected]> you wrote:

The following series has been applied. I am posting this for the record.

Argghhh... This is not the way things should be done.

I am definitely unhappy here - not so much about the patches, but about the procedure.

Even as a maintainer you are supposed to post the patches first. And then _wait_ and give people a chance to review the patches. And then decide based on the review results.

Shortcutting an ongoing discussion with such a "management decision" does not match my understanding of how U-Boot development takes place. Accepting unreviewed patches because of the powers of a custodian/maintainer is IMO a strict no-go.

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If I had to live my life again,  I'd  make  the  same  mistakes, only
sooner.                                          -- Tallulah Bankhead
#16 lore raw

cover REVERT Follow the Linux Kernel in building dtc as needed

In reply to Tom Rini

This patch series reverts some patches that should never have been merged into mainline at all:

- They were applied in violation of the well established rule that ALL patches must be posted on the mailing list before, and given enough time for review by the community.
- Obviously, these patches have not been Acked-by: by anybody.
- They implement a solution that probably does not represent the majority of the developers who discussed this issue. They were applied cutting short the ongoing discussion, without giving a good, comprehensible reason. Alternative solutions were presented before, but this patch series ignores them.

U-Boot is a community project with an established and documented development process. No single person, not even a custodian or maintainer, shall have the power to push through any changes without or against the consent of the community. If we want to maintain these standards, we cannot accept this. We therefore have only one
choice: revert these patches now, and let them undergo the necessary review process on the mailing list, allowing for the usual grace period of two weeks. Sorry.

Wolfgang Denk (5):
Revert "tools/mkimage: Make the path to the dtc binary that mkimage
calls configurable"
Revert "dtc: Switch to building and using our own dtc unless provided" Revert "scripts/dtc: Update to upstream version

    v1.4.4-50-gfe50bd1ecc1d"

Revert "scripts/dtc: Update to upstream version v1.4.4" Revert "scripts/dtc: Update to upstream version v1.4.3"

Cc Albert Aribaud <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Alexey Brodkin <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Andre Przywara <[email protected]>,
Cc Andreas Bießmann <[email protected]>
Cc Angelo Dureghello <[email protected]>
Cc Bin Meng <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Daniel Schwierzeck <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Heinrich Schuchardt <[email protected]>
Cc Huan Wang <[email protected]>
Cc Jagan Teki <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Kim Phillips <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Macpaul Lin <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Michal Simek <[email protected]>
Cc Minkyu Kang <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc Prafulla Wadaskar <[email protected]>
Cc Przemyslaw Marczak <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Scott Wood <[email protected]>
Cc Simon Glass <[email protected]>
Cc Sonic Zhang <[email protected]>
Cc Stanislav Galabov <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Tom Rini <[email protected]>
Cc Tom Warren <[email protected]>
Cc u-boot at lists.denx.de
Cc Vagrant Cascadian <[email protected]>
Cc Vipin Kumar <[email protected]>
Cc York Sun <[email protected]>
 .travis.yml                          |    6 +-
 Makefile                             |   10 +-
 dts/Kconfig                          |   13 -
 scripts/Kbuild.include               |    5 +
 scripts/Makefile                     |    1 -
 scripts/Makefile.extrawarn           |   16 +-
 scripts/dtc/Makefile                 |   31 -
 scripts/dtc/Makefile.dtc             |   18 -
 scripts/dtc/checks.c                 | 1076 ----------------
 scripts/dtc/data.c                   |  269 ----
 scripts/dtc/dtc-lexer.l              |  306 -----
 scripts/dtc/dtc-lexer.lex.c_shipped  | 2255 ---------------------------------
 scripts/dtc/dtc-parser.tab.c_shipped | 2301 ----------------------------------
 scripts/dtc/dtc-parser.tab.h_shipped |  123 --
 scripts/dtc/dtc-parser.y             |  519 --------
 scripts/dtc/dtc.c                    |  365 ------
 scripts/dtc/dtc.h                    |  290 -----
 scripts/dtc/flattree.c               |  940 --------------
 scripts/dtc/fstree.c                 |   90 --
 scripts/dtc/libfdt/Makefile.libfdt   |   11 -
 scripts/dtc/libfdt/fdt.c             |  251 ----
 scripts/dtc/libfdt/fdt.h             |  111 --
 scripts/dtc/libfdt/fdt_empty_tree.c  |   83 --
 scripts/dtc/libfdt/fdt_ro.c          |  703 -----------
 scripts/dtc/libfdt/fdt_rw.c          |  505 --------
 scripts/dtc/libfdt/fdt_strerror.c    |  102 --
 scripts/dtc/libfdt/fdt_sw.c          |  300 -----
 scripts/dtc/libfdt/fdt_wip.c         |  139 --
 scripts/dtc/libfdt/libfdt.h          | 1899 ----------------------------
 scripts/dtc/libfdt/libfdt_env.h      |  112 --
 scripts/dtc/libfdt/libfdt_internal.h |   95 --
 scripts/dtc/livetree.c               |  981 ---------------
 scripts/dtc/srcpos.c                 |  302 -----
 scripts/dtc/srcpos.h                 |  117 --
 scripts/dtc/treesource.c             |  284 -----
 scripts/dtc/update-dtc-source.sh     |   81 --
 scripts/dtc/util.c                   |  474 -------
 scripts/dtc/util.h                   |  263 ----
 scripts/dtc/version_gen.h            |    1 -
 tools/Makefile                       |    2 +-
 40 files changed, 26 insertions(+), 15424 deletions(-)
 delete mode 100644 scripts/dtc/Makefile
 delete mode 100644 scripts/dtc/Makefile.dtc
 delete mode 100644 scripts/dtc/checks.c
 delete mode 100644 scripts/dtc/data.c
 delete mode 100644 scripts/dtc/dtc-lexer.l
 delete mode 100644 scripts/dtc/dtc-lexer.lex.c_shipped
 delete mode 100644 scripts/dtc/dtc-parser.tab.c_shipped
 delete mode 100644 scripts/dtc/dtc-parser.tab.h_shipped
 delete mode 100644 scripts/dtc/dtc-parser.y
 delete mode 100644 scripts/dtc/dtc.c
 delete mode 100644 scripts/dtc/dtc.h
 delete mode 100644 scripts/dtc/flattree.c
 delete mode 100644 scripts/dtc/fstree.c
 delete mode 100644 scripts/dtc/libfdt/Makefile.libfdt
 delete mode 100644 scripts/dtc/libfdt/fdt.c
 delete mode 100644 scripts/dtc/libfdt/fdt.h
 delete mode 100644 scripts/dtc/libfdt/fdt_empty_tree.c
 delete mode 100644 scripts/dtc/libfdt/fdt_ro.c
 delete mode 100644 scripts/dtc/libfdt/fdt_rw.c
 delete mode 100644 scripts/dtc/libfdt/fdt_strerror.c
 delete mode 100644 scripts/dtc/libfdt/fdt_sw.c
 delete mode 100644 scripts/dtc/libfdt/fdt_wip.c
 delete mode 100644 scripts/dtc/libfdt/libfdt.h
 delete mode 100644 scripts/dtc/libfdt/libfdt_env.h
 delete mode 100644 scripts/dtc/libfdt/libfdt_internal.h
 delete mode 100644 scripts/dtc/livetree.c
 delete mode 100644 scripts/dtc/srcpos.c
 delete mode 100644 scripts/dtc/srcpos.h
 delete mode 100644 scripts/dtc/treesource.c
 delete mode 100755 scripts/dtc/update-dtc-source.sh
 delete mode 100644 scripts/dtc/util.c
 delete mode 100644 scripts/dtc/util.h
 delete mode 100644 scripts/dtc/version_gen.h
Signature · 1 line
2.13.3
#17 lore raw

PATCH 1/5 Revert "tools/mkimage: Make the path to the dtc binary that mkimage calls configurable"

This reverts commit 1f6049e2501b5c35c61435dbc05ba96743202674.

This patch is part of a series which has never been reviewed and has not been generally accepted by the community.

Cc Albert Aribaud <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Alexey Brodkin <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Andre Przywara <[email protected]>,
Cc Andreas Bießmann <[email protected]>
Cc Angelo Dureghello <[email protected]>
Cc Bin Meng <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Daniel Schwierzeck <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Heinrich Schuchardt <[email protected]>
Cc Huan Wang <[email protected]>
Cc Jagan Teki <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Kim Phillips <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Macpaul Lin <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Michal Simek <[email protected]>
Cc Minkyu Kang <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc Prafulla Wadaskar <[email protected]>
Cc Przemyslaw Marczak <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Scott Wood <[email protected]>
Cc Simon Glass <[email protected]>
Cc Sonic Zhang <[email protected]>
Cc Stanislav Galabov <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Tom Rini <[email protected]>
Cc Tom Warren <[email protected]>
Cc u-boot at lists.denx.de
Cc Vagrant Cascadian <[email protected]>
Cc Vipin Kumar <[email protected]>
Cc York Sun <[email protected]>
---
 dts/Kconfig    | 9 ---------
 tools/Makefile | 2 +-
 2 files changed, 1 insertion(+), 10 deletions(-)
dts/Kconfig +0 -9
index 4ee0510943..44fc9fe36d 100644
@@ -170,12 +170,3 @@ config TPL_OF_PLATDATA
 	  information.
 
 endmenu
-
-config MKIMAGE_DTC_PATH
-	string "Path to dtc binary for use within mkimage"
-	default "dtc"
-	help
-	  The mkimage host tool will, in order to generate FIT images make
-	  calls to the dtc application in order to create the output.  In
-	  some cases the system dtc may not support all required features
-	  and the path to a different version should be given here.
tools/Makefile +1 -1
index c16477459d..a0db19d6b0 100644
@@ -175,7 +175,7 @@ HOSTCFLAGS_rsa-sign.o += -Wno-deprecated-declarations
 endif
 endif
 
-HOSTCFLAGS_fit_image.o += -DMKIMAGE_DTC=\"$(CONFIG_MKIMAGE_DTC_PATH)\"
+HOSTCFLAGS_fit_image.o += -DMKIMAGE_DTC=\"$(DTC)\"
 
 HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage)
 HOSTLOADLIBES_fit_info := $(HOSTLOADLIBES_mkimage)
Signature · 1 line
2.13.3
#18 lore raw

PATCH 2/5 Revert "dtc: Switch to building and using our own dtc unless provided"

In reply to Wolfgang Denk

This reverts commit 36dd5f1b8abcd0aa5f8490b3ef1e4e7ecce2eb8c.

This patch is part of a series which has never been reviewed and has not been generally accepted by the community.

Cc Albert Aribaud <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Alexey Brodkin <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Andre Przywara <[email protected]>,
Cc Andreas Bießmann <[email protected]>
Cc Angelo Dureghello <[email protected]>
Cc Bin Meng <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Daniel Schwierzeck <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Heinrich Schuchardt <[email protected]>
Cc Huan Wang <[email protected]>
Cc Jagan Teki <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Kim Phillips <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Macpaul Lin <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Michal Simek <[email protected]>
Cc Minkyu Kang <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc Prafulla Wadaskar <[email protected]>
Cc Przemyslaw Marczak <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Scott Wood <[email protected]>
Cc Simon Glass <[email protected]>
Cc Sonic Zhang <[email protected]>
Cc Stanislav Galabov <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Tom Rini <[email protected]>
Cc Tom Warren <[email protected]>
Cc u-boot at lists.denx.de
Cc Vagrant Cascadian <[email protected]>
Cc Vipin Kumar <[email protected]>
Cc York Sun <[email protected]>
---
 .travis.yml      |  6 ++++--
 Makefile         | 10 ++++++++--
 dts/Kconfig      |  4 ----
 scripts/Makefile |  1 -
 4 files changed, 12 insertions(+), 9 deletions(-)
.travis.yml +4 -2
index 00b2a73a5e..9dfd016da0 100644
@@ -26,9 +26,11 @@ addons:
     - grub-efi-ia32-bin
     - rpm2cpio
     - wget
-    - device-tree-compiler
 
 install:
+ # install latest device tree compiler
+ - git clone --depth=1 -b v1.4.3 git://git.kernel.org/pub/scm/utils/dtc/dtc.git /tmp/dtc
+ - make -j4 -C /tmp/dtc
  # Clone uboot-test-hooks
  - git clone --depth=1 git://github.com/swarren/uboot-test-hooks.git /tmp/uboot-test-hooks
  - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
@@ -49,7 +51,7 @@ install:
 
 env:
   global:
-    - PATH=/tmp/qemu-install/bin:/tmp/uboot-test-hooks/bin:/usr/bin:/bin
+    - PATH=/tmp/dtc:/tmp/qemu-install/bin:/tmp/uboot-test-hooks/bin:/usr/bin:/bin
     - PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci
     - BUILD_DIR=build
     - HOSTCC="cc"
Makefile +8 -2
index b7d5cbb3f9..e058e9854b 100644
@@ -349,7 +349,7 @@ OBJDUMP		= $(CROSS_COMPILE)objdump
 AWK		= awk
 PERL		= perl
 PYTHON		?= python
-DTC		?= $(objtree)/scripts/dtc/dtc
+DTC		?= dtc
 CHECK		= sparse
 
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
@@ -872,7 +872,7 @@ endif
 PHONY += dtbs
 dtbs: dts/dt.dtb
 	@:
-dts/dt.dtb: u-boot
+dts/dt.dtb: checkdtc u-boot
 	$(Q)$(MAKE) $(build)=dts dtbs
 
 quiet_cmd_copy = COPY    $@
@@ -1447,6 +1447,12 @@ SYSTEM_MAP = \
 System.map:	u-boot
 		@$(call SYSTEM_MAP,$<) > $@
 
+checkdtc:
+	@if test $(call dtc-version) -lt 010403; then \
+		echo '*** Your dtc is too old, please upgrade to dtc 1.4.3 or newer'; \
+		false; \
+	fi
+
 #########################################################################
 
 # ARM relocations should all be R_ARM_RELATIVE (32-bit) or
dts/Kconfig +0 -4
index 44fc9fe36d..b4b7ddc144 100644
@@ -5,15 +5,11 @@
 config SUPPORT_OF_CONTROL
 	bool
 
-config DTC
-	bool
-
 menu "Device Tree Control"
 	depends on SUPPORT_OF_CONTROL
 
 config OF_CONTROL
 	bool "Run-time configuration via Device Tree"
-	select DTC
 	help
 	  This feature provides for run-time configuration of U-Boot
 	  via a flattened device tree.
scripts/Makefile +0 -1
index 9d55241463..3e10c16d59 100644
@@ -21,4 +21,3 @@ build_docproc: $(obj)/docproc
 
 # Let clean descend into subdirs
 subdir-	+= basic kconfig
-subdir-$(CONFIG_DTC)	+= dtc
Signature · 1 line
2.13.3
#19 lore raw

PATCH 3/5 Revert "scripts/dtc: Update to upstream version v1.4.4-50-gfe50bd1ecc1d"

In reply to Wolfgang Denk

This reverts commit 2d4c2259930b91fe5e7a2f92db32c03fe640ed60.

This patch is part of a series which has never been reviewed and has not been generally accepted by the community.

Cc Albert Aribaud <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Alexey Brodkin <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Andre Przywara <[email protected]>,
Cc Andreas Bießmann <[email protected]>
Cc Angelo Dureghello <[email protected]>
Cc Bin Meng <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Daniel Schwierzeck <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Heinrich Schuchardt <[email protected]>
Cc Huan Wang <[email protected]>
Cc Jagan Teki <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Kim Phillips <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Macpaul Lin <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Michal Simek <[email protected]>
Cc Minkyu Kang <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc Prafulla Wadaskar <[email protected]>
Cc Przemyslaw Marczak <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Scott Wood <[email protected]>
Cc Simon Glass <[email protected]>
Cc Sonic Zhang <[email protected]>
Cc Stanislav Galabov <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Tom Rini <[email protected]>
Cc Tom Warren <[email protected]>
Cc u-boot at lists.denx.de
Cc Vagrant Cascadian <[email protected]>
Cc Vipin Kumar <[email protected]>
Cc York Sun <[email protected]>
---
 scripts/dtc/checks.c                | 231 ------------------------------------
 scripts/dtc/dtc.c                   |   2 +-
 scripts/dtc/dtc.h                   |   6 -
 scripts/dtc/libfdt/fdt_empty_tree.c |   1 +
 scripts/dtc/libfdt/fdt_ro.c         |   4 +-
 scripts/dtc/libfdt/fdt_rw.c         |  24 +---
 scripts/dtc/libfdt/fdt_sw.c         |  16 +--
 scripts/dtc/libfdt/fdt_wip.c        |   4 +-
 scripts/dtc/libfdt/libfdt.h         |  68 +----------
 scripts/dtc/livetree.c              |   3 +-
 scripts/dtc/version_gen.h           |   2 +-
 11 files changed, 16 insertions(+), 345 deletions(-)
scripts/dtc/checks.c +0 -231
index afabf64337..38f548e582 100644
@@ -681,229 +681,6 @@ static void check_ranges_format(struct check *c, struct dt_info *dti,
 }
 WARNING(ranges_format, check_ranges_format, NULL, &addr_size_cells);
 
-static const struct bus_type pci_bus = {
-	.name = "PCI",
-};
-
-static void check_pci_bridge(struct check *c, struct dt_info *dti, struct node *node)
-{
-	struct property *prop;
-	cell_t *cells;
-
-	prop = get_property(node, "device_type");
-	if (!prop || !streq(prop->val.val, "pci"))
-		return;
-
-	node->bus = &pci_bus;
-
-	if (!strneq(node->name, "pci", node->basenamelen) &&
-	    !strneq(node->name, "pcie", node->basenamelen))
-		FAIL(c, dti, "Node %s node name is not \"pci\" or \"pcie\"",
-			     node->fullpath);
-
-	prop = get_property(node, "ranges");
-	if (!prop)
-		FAIL(c, dti, "Node %s missing ranges for PCI bridge (or not a bridge)",
-			     node->fullpath);
-
-	if (node_addr_cells(node) != 3)
-		FAIL(c, dti, "Node %s incorrect #address-cells for PCI bridge",
-			     node->fullpath);
-	if (node_size_cells(node) != 2)
-		FAIL(c, dti, "Node %s incorrect #size-cells for PCI bridge",
-			     node->fullpath);
-
-	prop = get_property(node, "bus-range");
-	if (!prop) {
-		FAIL(c, dti, "Node %s missing bus-range for PCI bridge",
-			     node->fullpath);
-		return;
-	}
-	if (prop->val.len != (sizeof(cell_t) * 2)) {
-		FAIL(c, dti, "Node %s bus-range must be 2 cells",
-			     node->fullpath);
-		return;
-	}
-	cells = (cell_t *)prop->val.val;
-	if (fdt32_to_cpu(cells[0]) > fdt32_to_cpu(cells[1]))
-		FAIL(c, dti, "Node %s bus-range 1st cell must be less than or equal to 2nd cell",
-			     node->fullpath);
-	if (fdt32_to_cpu(cells[1]) > 0xff)
-		FAIL(c, dti, "Node %s bus-range maximum bus number must be less than 256",
-			     node->fullpath);
-}
-WARNING(pci_bridge, check_pci_bridge, NULL,
-	&device_type_is_string, &addr_size_cells);
-
-static void check_pci_device_bus_num(struct check *c, struct dt_info *dti, struct node *node)
-{
-	struct property *prop;
-	unsigned int bus_num, min_bus, max_bus;
-	cell_t *cells;
-
-	if (!node->parent || (node->parent->bus != &pci_bus))
-		return;
-
-	prop = get_property(node, "reg");
-	if (!prop)
-		return;
-
-	cells = (cell_t *)prop->val.val;
-	bus_num = (fdt32_to_cpu(cells[0]) & 0x00ff0000) >> 16;
-
-	prop = get_property(node->parent, "bus-range");
-	if (!prop) {
-		min_bus = max_bus = 0;
-	} else {
-		cells = (cell_t *)prop->val.val;
-		min_bus = fdt32_to_cpu(cells[0]);
-		max_bus = fdt32_to_cpu(cells[0]);
-	}
-	if ((bus_num < min_bus) || (bus_num > max_bus))
-		FAIL(c, dti, "Node %s PCI bus number %d out of range, expected (%d - %d)",
-		     node->fullpath, bus_num, min_bus, max_bus);
-}
-WARNING(pci_device_bus_num, check_pci_device_bus_num, NULL, &reg_format, &pci_bridge);
-
-static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct node *node)
-{
-	struct property *prop;
-	const char *unitname = get_unitname(node);
-	char unit_addr[5];
-	unsigned int dev, func, reg;
-	cell_t *cells;
-
-	if (!node->parent || (node->parent->bus != &pci_bus))
-		return;
-
-	prop = get_property(node, "reg");
-	if (!prop) {
-		FAIL(c, dti, "Node %s missing PCI reg property", node->fullpath);
-		return;
-	}
-
-	cells = (cell_t *)prop->val.val;
-	if (cells[1] || cells[2])
-		FAIL(c, dti, "Node %s PCI reg config space address cells 2 and 3 must be 0",
-			     node->fullpath);
-
-	reg = fdt32_to_cpu(cells[0]);
-	dev = (reg & 0xf800) >> 11;
-	func = (reg & 0x700) >> 8;
-
-	if (reg & 0xff000000)
-		FAIL(c, dti, "Node %s PCI reg address is not configuration space",
-			     node->fullpath);
-	if (reg & 0x000000ff)
-		FAIL(c, dti, "Node %s PCI reg config space address register number must be 0",
-			     node->fullpath);
-
-	if (func == 0) {
-		snprintf(unit_addr, sizeof(unit_addr), "%x", dev);
-		if (streq(unitname, unit_addr))
-			return;
-	}
-
-	snprintf(unit_addr, sizeof(unit_addr), "%x,%x", dev, func);
-	if (streq(unitname, unit_addr))
-		return;
-
-	FAIL(c, dti, "Node %s PCI unit address format error, expected \"%s\"",
-	     node->fullpath, unit_addr);
-}
-WARNING(pci_device_reg, check_pci_device_reg, NULL, &reg_format, &pci_bridge);
-
-static const struct bus_type simple_bus = {
-	.name = "simple-bus",
-};
-
-static bool node_is_compatible(struct node *node, const char *compat)
-{
-	struct property *prop;
-	const char *str, *end;
-
-	prop = get_property(node, "compatible");
-	if (!prop)
-		return false;
-
-	for (str = prop->val.val, end = str + prop->val.len; str < end;
-	     str += strnlen(str, end - str) + 1) {
-		if (strneq(str, compat, end - str))
-			return true;
-	}
-	return false;
-}
-
-static void check_simple_bus_bridge(struct check *c, struct dt_info *dti, struct node *node)
-{
-	if (node_is_compatible(node, "simple-bus"))
-		node->bus = &simple_bus;
-}
-WARNING(simple_bus_bridge, check_simple_bus_bridge, NULL, &addr_size_cells);
-
-static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct node *node)
-{
-	struct property *prop;
-	const char *unitname = get_unitname(node);
-	char unit_addr[17];
-	unsigned int size;
-	uint64_t reg = 0;
-	cell_t *cells = NULL;
-
-	if (!node->parent || (node->parent->bus != &simple_bus))
-		return;
-
-	prop = get_property(node, "reg");
-	if (prop)
-		cells = (cell_t *)prop->val.val;
-	else {
-		prop = get_property(node, "ranges");
-		if (prop && prop->val.len)
-			/* skip of child address */
-			cells = ((cell_t *)prop->val.val) + node_addr_cells(node);
-	}
-
-	if (!cells) {
-		if (node->parent->parent && !(node->bus == &simple_bus))
-			FAIL(c, dti, "Node %s missing or empty reg/ranges property", node->fullpath);
-		return;
-	}
-
-	size = node_addr_cells(node->parent);
-	while (size--)
-		reg = (reg << 32) | fdt32_to_cpu(*(cells++));
-
-	snprintf(unit_addr, sizeof(unit_addr), "%"PRIx64, reg);
-	if (!streq(unitname, unit_addr))
-		FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"",
-		     node->fullpath, unit_addr);
-}
-WARNING(simple_bus_reg, check_simple_bus_reg, NULL, &reg_format, &simple_bus_bridge);
-
-static void check_unit_address_format(struct check *c, struct dt_info *dti,
-				      struct node *node)
-{
-	const char *unitname = get_unitname(node);
-
-	if (node->parent && node->parent->bus)
-		return;
-
-	if (!unitname[0])
-		return;
-
-	if (!strncmp(unitname, "0x", 2)) {
-		FAIL(c, dti, "Node %s unit name should not have leading \"0x\"",
-		    node->fullpath);
-		/* skip over 0x for next test */
-		unitname += 2;
-	}
-	if (unitname[0] == '0' && isxdigit(unitname[1]))
-		FAIL(c, dti, "Node %s unit name should not have leading 0s",
-		    node->fullpath);
-}
-WARNING(unit_address_format, check_unit_address_format, NULL,
-	&node_name_format, &pci_bridge, &simple_bus_bridge);
-
 /*
  * Style checks
  */
@@ -975,14 +752,6 @@ static struct check *check_table[] = {
 	&addr_size_cells, &reg_format, &ranges_format,
 
 	&unit_address_vs_reg,
-	&unit_address_format,
-
-	&pci_bridge,
-	&pci_device_reg,
-	&pci_device_bus_num,
-
-	&simple_bus_bridge,
-	&simple_bus_reg,
 
 	&avoid_default_addr_size,
 	&obsolete_chosen_interrupt_controller,
scripts/dtc/dtc.c +1 -1
index 5ed873c72a..f5eed9d72c 100644
@@ -31,7 +31,7 @@ int reservenum;		/* Number of memory reservation slots */
 int minsize;		/* Minimum blob size */
 int padsize;		/* Additional padding to blob */
 int alignsize;		/* Additional padding to blob accroding to the alignsize */
-int phandle_format = PHANDLE_EPAPR;	/* Use linux,phandle or phandle properties */
+int phandle_format = PHANDLE_BOTH;	/* Use linux,phandle or phandle properties */
 int generate_symbols;	/* enable symbols & fixup support */
 int generate_fixups;		/* suppress generation of fixups on symbol support */
 int auto_label_aliases;		/* auto generate labels -> aliases */
scripts/dtc/dtc.h +0 -6
index 409db76c94..403b79deab 100644
@@ -31,7 +31,6 @@
 #include <ctype.h>
 #include <errno.h>
 #include <unistd.h>
-#include <inttypes.h>
 
 #include <libfdt_env.h>
 #include <fdt.h>
@@ -136,10 +135,6 @@ struct label {
 	struct label *next;
 };
 
-struct bus_type {
-	const char *name;
-};
-
 struct property {
 	bool deleted;
 	char *name;
@@ -166,7 +161,6 @@ struct node {
 	int addr_cells, size_cells;
 
 	struct label *labels;
-	const struct bus_type *bus;
 };
 
 #define for_each_label_withdel(l0, l) \
scripts/dtc/libfdt/fdt_empty_tree.c +1 -0
index f2ae9b77c2..f72d13b1d1 100644
@@ -81,3 +81,4 @@ int fdt_create_empty_tree(void *buf, int bufsize)
 
 	return fdt_open_into(buf, buf, bufsize);
 }
+
scripts/dtc/libfdt/fdt_ro.c +2 -2
index 08de2cce67..3d00d2eee0 100644
@@ -60,7 +60,7 @@ static int _fdt_nodename_eq(const void *fdt, int offset,
 {
 	const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1);
 
-	if (!p)
+	if (! p)
 		/* short match */
 		return 0;
 
@@ -327,7 +327,7 @@ const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
 	const struct fdt_property *prop;
 
 	prop = fdt_get_property_namelen(fdt, nodeoffset, name, namelen, lenp);
-	if (!prop)
+	if (! prop)
 		return NULL;
 
 	return prop->data;
scripts/dtc/libfdt/fdt_rw.c +5 -19
index 5c3a2bb0bc..3fd5847377 100644
@@ -207,7 +207,7 @@ static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
 	int err;
 
 	*prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen);
-	if (!*prop)
+	if (! (*prop))
 		return oldlen;
 
 	if ((err = _fdt_splice_struct(fdt, (*prop)->data, FDT_TAGALIGN(oldlen),
@@ -269,8 +269,8 @@ int fdt_set_name(void *fdt, int nodeoffset, const char *name)
 	return 0;
 }
 
-int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,
-			    int len, void **prop_data)
+int fdt_setprop(void *fdt, int nodeoffset, const char *name,
+		const void *val, int len)
 {
 	struct fdt_property *prop;
 	int err;
@@ -283,22 +283,8 @@ int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,
 	if (err)
 		return err;
 
-	*prop_data = prop->data;
-	return 0;
-}
-
-int fdt_setprop(void *fdt, int nodeoffset, const char *name,
-		const void *val, int len)
-{
-	void *prop_data;
-	int err;
-
-	err = fdt_setprop_placeholder(fdt, nodeoffset, name, len, &prop_data);
-	if (err)
-		return err;
-
 	if (len)
-		memcpy(prop_data, val, len);
+		memcpy(prop->data, val, len);
 	return 0;
 }
 
@@ -337,7 +323,7 @@ int fdt_delprop(void *fdt, int nodeoffset, const char *name)
 	FDT_RW_CHECK_HEADER(fdt);
 
 	prop = fdt_get_property_w(fdt, nodeoffset, name, &len);
-	if (!prop)
+	if (! prop)
 		return len;
 
 	proplen = sizeof(*prop) + FDT_TAGALIGN(len);
scripts/dtc/libfdt/fdt_sw.c +2 -14
index 2bd15e7aef..6a804859fd 100644
@@ -220,7 +220,7 @@ static int _fdt_find_add_string(void *fdt, const char *s)
 	return offset;
 }
 
-int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp)
+int fdt_property(void *fdt, const char *name, const void *val, int len)
 {
 	struct fdt_property *prop;
 	int nameoff;
@@ -238,19 +238,7 @@ int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp)
 	prop->tag = cpu_to_fdt32(FDT_PROP);
 	prop->nameoff = cpu_to_fdt32(nameoff);
 	prop->len = cpu_to_fdt32(len);
-	*valp = prop->data;
-	return 0;
-}
-
-int fdt_property(void *fdt, const char *name, const void *val, int len)
-{
-	void *ptr;
-	int ret;
-
-	ret = fdt_property_placeholder(fdt, name, len, &ptr);
-	if (ret)
-		return ret;
-	memcpy(ptr, val, len);
+	memcpy(prop->data, val, len);
 	return 0;
 }
 
scripts/dtc/libfdt/fdt_wip.c +2 -2
index 5e85919862..6aaab39992 100644
@@ -82,7 +82,7 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
 	int proplen;
 
 	propval = fdt_getprop(fdt, nodeoffset, name, &proplen);
-	if (!propval)
+	if (! propval)
 		return proplen;
 
 	if (proplen != len)
@@ -107,7 +107,7 @@ int fdt_nop_property(void *fdt, int nodeoffset, const char *name)
 	int len;
 
 	prop = fdt_get_property_w(fdt, nodeoffset, name, &len);
-	if (!prop)
+	if (! prop)
 		return len;
 
 	_fdt_nop_region(prop, len + sizeof(*prop));
scripts/dtc/libfdt/libfdt.h +1 -67

172 lines not on this page · raw message

scripts/dtc/livetree.c +1 -2
index aecd27875f..3673de07e4 100644
@@ -478,8 +478,7 @@ struct node *get_node_by_path(struct node *tree, const char *path)
 	p = strchr(path, '/');
 
 	for_each_child(tree, child) {
-		if (p && (strlen(child->name) == p-path) &&
-				strneq(path, child->name, p-path))
+		if (p && strneq(path, child->name, p-path))
 			return get_node_by_path(child, p+1);
 		else if (!p && streq(path, child->name))
 			return child;
scripts/dtc/version_gen.h +1 -1
index b5ed715ecc..859564e8b4 100644
@@ -1 +1 @@
-#define DTC_VERSION "DTC 1.4.4-gfe50bd1e"
+#define DTC_VERSION "DTC 1.4.4"
Signature · 1 line
2.13.3
#20 lore raw

PATCH 4/5 Revert "scripts/dtc: Update to upstream version v1.4.4"

In reply to Wolfgang Denk

This reverts commit d6fc90ced42e9fb77185cedfe45d0a2c7ac78508.

This patch is part of a series which has never been reviewed and has not been generally accepted by the community.

Cc Albert Aribaud <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Alexey Brodkin <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Andre Przywara <[email protected]>,
Cc Andreas Bießmann <[email protected]>
Cc Angelo Dureghello <[email protected]>
Cc Bin Meng <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Daniel Schwierzeck <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Heinrich Schuchardt <[email protected]>
Cc Huan Wang <[email protected]>
Cc Jagan Teki <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Kim Phillips <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Macpaul Lin <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Michal Simek <[email protected]>
Cc Minkyu Kang <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc Prafulla Wadaskar <[email protected]>
Cc Przemyslaw Marczak <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Scott Wood <[email protected]>
Cc Simon Glass <[email protected]>
Cc Sonic Zhang <[email protected]>
Cc Stanislav Galabov <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Tom Rini <[email protected]>
Cc Tom Warren <[email protected]>
Cc u-boot at lists.denx.de
Cc Vagrant Cascadian <[email protected]>
Cc Vipin Kumar <[email protected]>
Cc York Sun <[email protected]>
---
 scripts/dtc/checks.c                | 12 ++++--
 scripts/dtc/data.c                  | 16 ++++----
 scripts/dtc/dtc-lexer.l             |  7 +++-
 scripts/dtc/dtc-lexer.lex.c_shipped | 81 ++++++++++++++++++++-----------------
 scripts/dtc/dtc.c                   |  5 ++-
 scripts/dtc/dtc.h                   |  5 ++-
 scripts/dtc/flattree.c              | 58 ++++++++++++++------------
 scripts/dtc/libfdt/libfdt_env.h     | 26 ++++++------
 scripts/dtc/livetree.c              | 16 ++++----
 scripts/dtc/srcpos.h                | 11 ++---
 scripts/dtc/treesource.c            |  6 +--
 scripts/dtc/util.c                  | 11 +++--
 scripts/dtc/util.h                  | 30 +++++++-------
 scripts/dtc/version_gen.h           |  2 +-
 14 files changed, 155 insertions(+), 131 deletions(-)
scripts/dtc/checks.c +8 -4
index 38f548e582..0e8b978c36 100644
@@ -72,8 +72,12 @@ struct check {
 #define CHECK(_nm, _fn, _d, ...) \
 	CHECK_ENTRY(_nm, _fn, _d, false, false, __VA_ARGS__)
 
-static inline void  PRINTF(3, 4) check_msg(struct check *c, struct dt_info *dti,
-					   const char *fmt, ...)
+#ifdef __GNUC__
+static inline void check_msg(struct check *c, struct dt_info *dti,
+			     const char *fmt, ...) __attribute__((format (printf, 3, 4)));
+#endif
+static inline void check_msg(struct check *c, struct dt_info *dti,
+			     const char *fmt, ...)
 {
 	va_list ap;
 	va_start(ap, fmt);
@@ -534,13 +538,13 @@ static void fixup_phandle_references(struct check *c, struct dt_info *dti,
 					FAIL(c, dti, "Reference to non-existent node or "
 							"label \"%s\"\n", m->ref);
 				else /* mark the entry as unresolved */
-					*((fdt32_t *)(prop->val.val + m->offset)) =
+					*((cell_t *)(prop->val.val + m->offset)) =
 						cpu_to_fdt32(0xffffffff);
 				continue;
 			}
 
 			phandle = get_node_phandle(dt, refnode);
-			*((fdt32_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
+			*((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
 		}
 	}
 }
scripts/dtc/data.c +8 -8
index aa37a16c88..8cae237468 100644
@@ -171,9 +171,9 @@ struct data data_merge(struct data d1, struct data d2)
 struct data data_append_integer(struct data d, uint64_t value, int bits)
 {
 	uint8_t value_8;
-	fdt16_t value_16;
-	fdt32_t value_32;
-	fdt64_t value_64;
+	uint16_t value_16;
+	uint32_t value_32;
+	uint64_t value_64;
 
 	switch (bits) {
 	case 8:
@@ -197,14 +197,14 @@ struct data data_append_integer(struct data d, uint64_t value, int bits)
 	}
 }
 
-struct data data_append_re(struct data d, uint64_t address, uint64_t size)
+struct data data_append_re(struct data d, const struct fdt_reserve_entry *re)
 {
-	struct fdt_reserve_entry re;
+	struct fdt_reserve_entry bere;
 
-	re.address = cpu_to_fdt64(address);
-	re.size = cpu_to_fdt64(size);
+	bere.address = cpu_to_fdt64(re->address);
+	bere.size = cpu_to_fdt64(re->size);
 
-	return data_append_data(d, &re, sizeof(re));
+	return data_append_data(d, &bere, sizeof(bere));
 }
 
 struct data data_append_cell(struct data d, cell_t word)
scripts/dtc/dtc-lexer.l +6 -1
index fd825ebba6..52bed7b749 100644
@@ -62,7 +62,12 @@ static int dts_version = 1;
 
 static void push_input_file(const char *filename);
 static bool pop_input_file(void);
-static void PRINTF(1, 2) lexical_error(const char *fmt, ...);
+#ifdef __GNUC__
+static void lexical_error(const char *fmt, ...)
+	__attribute__((format (printf, 1, 2)));
+#else
+static void lexical_error(const char *fmt, ...);
+#endif
 
 %}
 
scripts/dtc/dtc-lexer.lex.c_shipped +43 -38

275 lines not on this page · raw message

scripts/dtc/dtc.c +3 -2
index f5eed9d72c..bb1e52b318 100644
@@ -138,7 +138,7 @@ static const char *guess_type_by_name(const char *fname, const char *fallback)
 static const char *guess_input_format(const char *fname, const char *fallback)
 {
 	struct stat statbuf;
-	fdt32_t magic;
+	uint32_t magic;
 	FILE *f;
 
 	if (stat(fname, &statbuf) != 0)
@@ -159,7 +159,8 @@ static const char *guess_input_format(const char *fname, const char *fallback)
 	}
 	fclose(f);
 
-	if (fdt32_to_cpu(magic) == FDT_MAGIC)
+	magic = fdt32_to_cpu(magic);
+	if (magic == FDT_MAGIC)
 		return "dtb";
 
 	return guess_type_by_name(fname, fallback);
scripts/dtc/dtc.h +3 -2
index 403b79deab..1ac2a1e3a4 100644
@@ -43,6 +43,7 @@
 #define debug(...)
 #endif
 
+
 #define DEFAULT_FDT_VERSION	17
 
 /*
@@ -113,7 +114,7 @@ struct data data_insert_at_marker(struct data d, struct marker *m,
 struct data data_merge(struct data d1, struct data d2);
 struct data data_append_cell(struct data d, cell_t word);
 struct data data_append_integer(struct data d, uint64_t word, int bits);
-struct data data_append_re(struct data d, uint64_t address, uint64_t size);
+struct data data_append_re(struct data d, const struct fdt_reserve_entry *re);
 struct data data_append_addr(struct data d, uint64_t addr);
 struct data data_append_byte(struct data d, uint8_t byte);
 struct data data_append_zeroes(struct data d, int len);
@@ -226,7 +227,7 @@ uint32_t guess_boot_cpuid(struct node *tree);
 /* Boot info (tree plus memreserve information */
 
 struct reserve_info {
-	uint64_t address, size;
+	struct fdt_reserve_entry re;
 
 	struct reserve_info *next;
 
scripts/dtc/flattree.c +32 -26

148 lines not on this page · raw message

scripts/dtc/libfdt/libfdt_env.h +13 -13
index 952056cddf..99f936dacc 100644
@@ -58,16 +58,16 @@
 #include <string.h>
 
 #ifdef __CHECKER__
-#define FDT_FORCE __attribute__((force))
-#define FDT_BITWISE __attribute__((bitwise))
+#define __force __attribute__((force))
+#define __bitwise __attribute__((bitwise))
 #else
-#define FDT_FORCE
-#define FDT_BITWISE
+#define __force
+#define __bitwise
 #endif
 
-typedef uint16_t FDT_BITWISE fdt16_t;
-typedef uint32_t FDT_BITWISE fdt32_t;
-typedef uint64_t FDT_BITWISE fdt64_t;
+typedef uint16_t __bitwise fdt16_t;
+typedef uint32_t __bitwise fdt32_t;
+typedef uint64_t __bitwise fdt64_t;
 
 #define EXTRACT_BYTE(x, n)	((unsigned long long)((uint8_t *)&x)[n])
 #define CPU_TO_FDT16(x) ((EXTRACT_BYTE(x, 0) << 8) | EXTRACT_BYTE(x, 1))
@@ -80,29 +80,29 @@ typedef uint64_t FDT_BITWISE fdt64_t;
 
 static inline uint16_t fdt16_to_cpu(fdt16_t x)
 {
-	return (FDT_FORCE uint16_t)CPU_TO_FDT16(x);
+	return (__force uint16_t)CPU_TO_FDT16(x);
 }
 static inline fdt16_t cpu_to_fdt16(uint16_t x)
 {
-	return (FDT_FORCE fdt16_t)CPU_TO_FDT16(x);
+	return (__force fdt16_t)CPU_TO_FDT16(x);
 }
 
 static inline uint32_t fdt32_to_cpu(fdt32_t x)
 {
-	return (FDT_FORCE uint32_t)CPU_TO_FDT32(x);
+	return (__force uint32_t)CPU_TO_FDT32(x);
 }
 static inline fdt32_t cpu_to_fdt32(uint32_t x)
 {
-	return (FDT_FORCE fdt32_t)CPU_TO_FDT32(x);
+	return (__force fdt32_t)CPU_TO_FDT32(x);
 }
 
 static inline uint64_t fdt64_to_cpu(fdt64_t x)
 {
-	return (FDT_FORCE uint64_t)CPU_TO_FDT64(x);
+	return (__force uint64_t)CPU_TO_FDT64(x);
 }
 static inline fdt64_t cpu_to_fdt64(uint64_t x)
 {
-	return (FDT_FORCE fdt64_t)CPU_TO_FDT64(x);
+	return (__force fdt64_t)CPU_TO_FDT64(x);
 }
 #undef CPU_TO_FDT64
 #undef CPU_TO_FDT32
scripts/dtc/livetree.c +8 -8
index 3673de07e4..36be9afefd 100644
@@ -319,8 +319,8 @@ struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size)
 
 	memset(new, 0, sizeof(*new));
 
-	new->address = address;
-	new->size = size;
+	new->re.address = address;
+	new->re.size = size;
 
 	return new;
 }
@@ -393,7 +393,7 @@ struct property *get_property(struct node *node, const char *propname)
 cell_t propval_cell(struct property *prop)
 {
 	assert(prop->val.len == sizeof(cell_t));
-	return fdt32_to_cpu(*((fdt32_t *)prop->val.val));
+	return fdt32_to_cpu(*((cell_t *)prop->val.val));
 }
 
 struct property *get_property_by_label(struct node *tree, const char *label,
@@ -599,13 +599,13 @@ static int cmp_reserve_info(const void *ax, const void *bx)
 	a = *((const struct reserve_info * const *)ax);
 	b = *((const struct reserve_info * const *)bx);
 
-	if (a->address < b->address)
+	if (a->re.address < b->re.address)
 		return -1;
-	else if (a->address > b->address)
+	else if (a->re.address > b->re.address)
 		return 1;
-	else if (a->size < b->size)
+	else if (a->re.size < b->re.size)
 		return -1;
-	else if (a->size > b->size)
+	else if (a->re.size > b->re.size)
 		return 1;
 	else
 		return 0;
@@ -902,7 +902,7 @@ static void add_local_fixup_entry(struct dt_info *dti,
 		struct node *refnode)
 {
 	struct node *wn, *nwn;	/* local fixup node, walk node, new */
-	fdt32_t value_32;
+	uint32_t value_32;
 	char **compp;
 	int i, depth;
 
scripts/dtc/srcpos.h +6 -5
index 7caca8257c..2cdfcd82e9 100644
@@ -22,7 +22,6 @@
 
 #include <stdio.h>
 #include <stdbool.h>
-#include "util.h"
 
 struct srcfile_state {
 	FILE *f;
@@ -107,10 +106,12 @@ extern void srcpos_update(struct srcpos *pos, const char *text, int len);
 extern struct srcpos *srcpos_copy(struct srcpos *pos);
 extern char *srcpos_string(struct srcpos *pos);
 
-extern void PRINTF(3, 0) srcpos_verror(struct srcpos *pos, const char *prefix,
-					const char *fmt, va_list va);
-extern void PRINTF(3, 4) srcpos_error(struct srcpos *pos, const char *prefix,
-				      const char *fmt, ...);
+extern void srcpos_verror(struct srcpos *pos, const char *prefix,
+			  const char *fmt, va_list va)
+	__attribute__((format(printf, 3, 0)));
+extern void srcpos_error(struct srcpos *pos, const char *prefix,
+			 const char *fmt, ...)
+	__attribute__((format(printf, 3, 4)));
 
 extern void srcpos_set_line(char *f, int l);
 
scripts/dtc/treesource.c +3 -3
index 2461a3d068..c9d8967969 100644
@@ -137,7 +137,7 @@ static void write_propval_string(FILE *f, struct data val)
 static void write_propval_cells(FILE *f, struct data val)
 {
 	void *propend = val.val + val.len;
-	fdt32_t *cp = (fdt32_t *)val.val;
+	cell_t *cp = (cell_t *)val.val;
 	struct marker *m = val.markers;
 
 	fprintf(f, "<");
@@ -275,8 +275,8 @@ void dt_to_source(FILE *f, struct dt_info *dti)
 		for_each_label(re->labels, l)
 			fprintf(f, "%s: ", l->label);
 		fprintf(f, "/memreserve/\t0x%016llx 0x%016llx;\n",
-			(unsigned long long)re->address,
-			(unsigned long long)re->size);
+			(unsigned long long)re->re.address,
+			(unsigned long long)re->re.size);
 	}
 
 	write_tree_source_node(f, dti->dt, 0);
scripts/dtc/util.c +5 -6
index 9953c32a02..3550f86bd6 100644
@@ -396,7 +396,7 @@ void utilfdt_print_data(const char *data, int len)
 		} while (s < data + len);
 
 	} else if ((len % 4) == 0) {
-		const fdt32_t *cell = (const fdt32_t *)data;
+		const uint32_t *cell = (const uint32_t *)data;
 
 		printf(" = <");
 		for (i = 0, len /= 4; i < len; i++)
@@ -412,16 +412,15 @@ void utilfdt_print_data(const char *data, int len)
 	}
 }
 
-void NORETURN util_version(void)
+void util_version(void)
 {
 	printf("Version: %s\n", DTC_VERSION);
 	exit(0);
 }
 
-void NORETURN util_usage(const char *errmsg, const char *synopsis,
-			 const char *short_opts,
-			 struct option const long_opts[],
-			 const char * const opts_help[])
+void util_usage(const char *errmsg, const char *synopsis,
+		const char *short_opts, struct option const long_opts[],
+		const char * const opts_help[])
 {
 	FILE *fp = errmsg ? stderr : stdout;
 	const char a_arg[] = "<arg>";
scripts/dtc/util.h +16 -14
index ad5f41199e..bc3d223fa6 100644
@@ -25,17 +25,15 @@
  *                                                                   USA
  */
 
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
 #ifdef __GNUC__
-#define PRINTF(i, j)	__attribute__((format (printf, i, j)))
-#define NORETURN	__attribute__((noreturn))
+static inline void
+__attribute__((noreturn)) __attribute__((format (printf, 1, 2)))
+die(const char *str, ...)
 #else
-#define PRINTF(i, j)
-#define NORETURN
+static inline void die(const char *str, ...)
 #endif
-
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
-static inline void NORETURN PRINTF(1, 2) die(const char *str, ...)
 {
 	va_list ap;
 
@@ -68,7 +66,12 @@ static inline void *xrealloc(void *p, size_t len)
 
 extern char *xstrdup(const char *s);
 
-extern int PRINTF(2, 3) xasprintf(char **strp, const char *fmt, ...);
+#ifdef __GNUC__
+extern int __attribute__((format (printf, 2, 3)))
+xasprintf(char **strp, const char *fmt, ...);
+#else
+extern int xasprintf(char **strp, const char *fmt, ...);
+#endif
 extern char *join_path(const char *path, const char *name);
 
 /**
@@ -197,7 +200,7 @@ void utilfdt_print_data(const char *data, int len);
 /**
  * Show source version and exit
  */
-void NORETURN util_version(void);
+void util_version(void) __attribute__((noreturn));
 
 /**
  * Show usage and exit
@@ -211,10 +214,9 @@ void NORETURN util_version(void);
  * @param long_opts	The structure of long options
  * @param opts_help	An array of help strings (should align with long_opts)
  */
-void NORETURN util_usage(const char *errmsg, const char *synopsis,
-			 const char *short_opts,
-			 struct option const long_opts[],
-			 const char * const opts_help[]);
+void util_usage(const char *errmsg, const char *synopsis,
+		const char *short_opts, struct option const long_opts[],
+		const char * const opts_help[]) __attribute__((noreturn));
 
 /**
  * Show usage and exit
scripts/dtc/version_gen.h +1 -1
index 859564e8b4..bbbd96b1dc 100644
@@ -1 +1 @@
-#define DTC_VERSION "DTC 1.4.4"
+#define DTC_VERSION "DTC 1.4.3"
Signature · 1 line
2.13.3
#21 lore raw

PATCH 5/5 Revert "scripts/dtc: Update to upstream version v1.4.3"

In reply to Wolfgang Denk

This reverts commit c0e032e0090d6541549b19cc47e06ccd1f302893.

This patch is part of a series which has never been reviewed and has not been generally accepted by the community.

Cc Albert Aribaud <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Alexey Brodkin <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Andre Przywara <[email protected]>,
Cc Andreas Bießmann <[email protected]>
Cc Angelo Dureghello <[email protected]>
Cc Bin Meng <[email protected]>
Cc Daniel Hellstrom <[email protected]>
Cc Daniel Schwierzeck <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Heinrich Schuchardt <[email protected]>
Cc Huan Wang <[email protected]>
Cc Jagan Teki <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Kim Phillips <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Macpaul Lin <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Michal Simek <[email protected]>
Cc Minkyu Kang <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc Prafulla Wadaskar <[email protected]>
Cc Przemyslaw Marczak <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Scott Wood <[email protected]>
Cc Simon Glass <[email protected]>
Cc Sonic Zhang <[email protected]>
Cc Stanislav Galabov <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Tom Rini <[email protected]>
Cc Tom Warren <[email protected]>
Cc u-boot at lists.denx.de
Cc Vagrant Cascadian <[email protected]>
Cc Vipin Kumar <[email protected]>
Cc York Sun <[email protected]>
---
 scripts/Kbuild.include               |    5 +
 scripts/Makefile.extrawarn           |   16 +-
 scripts/dtc/Makefile                 |   31 -
 scripts/dtc/Makefile.dtc             |   18 -
 scripts/dtc/checks.c                 |  849 -------------
 scripts/dtc/data.c                   |  269 ----
 scripts/dtc/dtc-lexer.l              |  311 -----
 scripts/dtc/dtc-lexer.lex.c_shipped  | 2260 ---------------------------------
 scripts/dtc/dtc-parser.tab.c_shipped | 2301 ----------------------------------
 scripts/dtc/dtc-parser.tab.h_shipped |  123 --
 scripts/dtc/dtc-parser.y             |  519 --------
 scripts/dtc/dtc.c                    |  366 ------
 scripts/dtc/dtc.h                    |  285 -----
 scripts/dtc/flattree.c               |  946 --------------
 scripts/dtc/fstree.c                 |   90 --
 scripts/dtc/libfdt/Makefile.libfdt   |   11 -
 scripts/dtc/libfdt/fdt.c             |  251 ----
 scripts/dtc/libfdt/fdt.h             |  111 --
 scripts/dtc/libfdt/fdt_empty_tree.c  |   84 --
 scripts/dtc/libfdt/fdt_ro.c          |  703 -----------
 scripts/dtc/libfdt/fdt_rw.c          |  491 --------
 scripts/dtc/libfdt/fdt_strerror.c    |  102 --
 scripts/dtc/libfdt/fdt_sw.c          |  288 -----
 scripts/dtc/libfdt/fdt_wip.c         |  139 --
 scripts/dtc/libfdt/libfdt.h          | 1833 ---------------------------
 scripts/dtc/libfdt/libfdt_env.h      |  112 --
 scripts/dtc/libfdt/libfdt_internal.h |   95 --
 scripts/dtc/livetree.c               |  980 ---------------
 scripts/dtc/srcpos.c                 |  302 -----
 scripts/dtc/srcpos.h                 |  118 --
 scripts/dtc/treesource.c             |  284 -----
 scripts/dtc/update-dtc-source.sh     |   81 --
 scripts/dtc/util.c                   |  473 -------
 scripts/dtc/util.h                   |  265 ----
 scripts/dtc/version_gen.h            |    1 -
 35 files changed, 13 insertions(+), 15100 deletions(-)
 delete mode 100644 scripts/dtc/Makefile
 delete mode 100644 scripts/dtc/Makefile.dtc
 delete mode 100644 scripts/dtc/checks.c
 delete mode 100644 scripts/dtc/data.c
 delete mode 100644 scripts/dtc/dtc-lexer.l
 delete mode 100644 scripts/dtc/dtc-lexer.lex.c_shipped
 delete mode 100644 scripts/dtc/dtc-parser.tab.c_shipped
 delete mode 100644 scripts/dtc/dtc-parser.tab.h_shipped
 delete mode 100644 scripts/dtc/dtc-parser.y
 delete mode 100644 scripts/dtc/dtc.c
 delete mode 100644 scripts/dtc/dtc.h
 delete mode 100644 scripts/dtc/flattree.c
 delete mode 100644 scripts/dtc/fstree.c
 delete mode 100644 scripts/dtc/libfdt/Makefile.libfdt
 delete mode 100644 scripts/dtc/libfdt/fdt.c
 delete mode 100644 scripts/dtc/libfdt/fdt.h
 delete mode 100644 scripts/dtc/libfdt/fdt_empty_tree.c
 delete mode 100644 scripts/dtc/libfdt/fdt_ro.c
 delete mode 100644 scripts/dtc/libfdt/fdt_rw.c
 delete mode 100644 scripts/dtc/libfdt/fdt_strerror.c
 delete mode 100644 scripts/dtc/libfdt/fdt_sw.c
 delete mode 100644 scripts/dtc/libfdt/fdt_wip.c
 delete mode 100644 scripts/dtc/libfdt/libfdt.h
 delete mode 100644 scripts/dtc/libfdt/libfdt_env.h
 delete mode 100644 scripts/dtc/libfdt/libfdt_internal.h
 delete mode 100644 scripts/dtc/livetree.c
 delete mode 100644 scripts/dtc/srcpos.c
 delete mode 100644 scripts/dtc/srcpos.h
 delete mode 100644 scripts/dtc/treesource.c
 delete mode 100755 scripts/dtc/update-dtc-source.sh
 delete mode 100644 scripts/dtc/util.c
 delete mode 100644 scripts/dtc/util.h
 delete mode 100644 scripts/dtc/version_gen.h
scripts/Kbuild.include +5 -0
index 2c7918ad37..a3a5c59d0d 100644
@@ -172,6 +172,11 @@ ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)
 # Usage:  $(call ld-ifversion, -ge, 22252, y)
 ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4))
 
+# dtc-option
+# Usage:  DTC_FLAGS += $(call dtc-option,-Wno-unit_address_vs_reg)
+dtc-option = $(call try-run,\
+	echo '/dts-v1/; / {};' | $(DTC) $(1),$(1),$(2))
+
 ######
 
 ###
scripts/Makefile.extrawarn +8 -8
index 1d3a570594..90dc149df3 100644
@@ -58,8 +58,8 @@ endif
 
 KBUILD_CFLAGS += $(warning)
 
-dtc-warning-2 += -Wnode_name_chars_strict
-dtc-warning-2 += -Wproperty_name_chars_strict
+dtc-warning-2 += $(call dtc-option,-Wnode_name_chars_strict)
+dtc-warning-2 += $(call dtc-option,-Wproperty_name_chars_strict)
 
 dtc-warning := $(dtc-warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
 dtc-warning += $(dtc-warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
@@ -70,11 +70,11 @@ DTC_FLAGS += $(dtc-warning)
 else
 
 # Disable noisy checks by default
-DTC_FLAGS += -Wno-unit_address_vs_reg
-DTC_FLAGS += -Wno-simple_bus_reg
-DTC_FLAGS += -Wno-unit_address_format
-DTC_FLAGS += -Wno-pci_bridge
-DTC_FLAGS += -Wno-pci_device_bus_num
-DTC_FLAGS += -Wno-pci_device_reg
+DTC_FLAGS += $(call dtc-option,-Wno-unit_address_vs_reg)
+DTC_FLAGS += $(call dtc-option,-Wno-simple_bus_reg)
+DTC_FLAGS += $(call dtc-option,-Wno-unit_address_format)
+DTC_FLAGS += $(call dtc-option,-Wno-pci_bridge)
+DTC_FLAGS += $(call dtc-option,-Wno-pci_device_bus_num)
+DTC_FLAGS += $(call dtc-option,-Wno-pci_device_reg)
 
 endif
scripts/dtc/Makefile deleted +0 -31
deleted file mode 100644
index 2a48022c41..0000000000
@@ -1,31 +0,0 @@
-# scripts/dtc makefile
-
-hostprogs-y	:= dtc
-always		:= $(hostprogs-y)
-
-dtc-objs	:= dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
-		   srcpos.o checks.o util.o
-dtc-objs	+= dtc-lexer.lex.o dtc-parser.tab.o
-
-# Source files need to get at the userspace version of libfdt_env.h to compile
-
-HOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt
-
-HOSTCFLAGS_checks.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_data.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_dtc.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_flattree.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_util.o := $(HOSTCFLAGS_DTC)
-
-HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
-
-# dependencies on generated files need to be listed explicitly
-$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
-
-# generated files need to be cleaned explicitly
-clean-files	:= dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h
scripts/dtc/Makefile.dtc deleted +0 -18
deleted file mode 100644
index bece49b355..0000000000
@@ -1,18 +0,0 @@
-# Makefile.dtc
-#
-# This is not a complete Makefile of itself.  Instead, it is designed to
-# be easily embeddable into other systems of Makefiles.
-#
-DTC_SRCS = \
-	checks.c \
-	data.c \
-	dtc.c \
-	flattree.c \
-	fstree.c \
-	livetree.c \
-	srcpos.c \
-	treesource.c \
-	util.c
-
-DTC_GEN_SRCS = dtc-lexer.lex.c dtc-parser.tab.c
-DTC_OBJS = $(DTC_SRCS:%.c=%.o) $(DTC_GEN_SRCS:%.c=%.o)
scripts/dtc/checks.c deleted +0 -849

849 lines not on this page · raw message

scripts/dtc/data.c deleted +0 -269

269 lines not on this page · raw message

scripts/dtc/dtc-lexer.l deleted +0 -311

311 lines not on this page · raw message

scripts/dtc/dtc-lexer.lex.c_shipped deleted +0 -2260

1,484 lines not on this page · raw message

scripts/dtc/dtc-parser.tab.c_shipped deleted +0 -2301

2,301 lines not on this page · raw message

scripts/dtc/dtc-parser.tab.h_shipped deleted +0 -123

123 lines not on this page · raw message

scripts/dtc/dtc-parser.y deleted +0 -519

519 lines not on this page · raw message

scripts/dtc/dtc.c deleted +0 -366

366 lines not on this page · raw message

scripts/dtc/dtc.h deleted +0 -285

285 lines not on this page · raw message

scripts/dtc/flattree.c deleted +0 -946

946 lines not on this page · raw message

scripts/dtc/fstree.c deleted +0 -90

90 lines not on this page · raw message

scripts/dtc/libfdt/Makefile.libfdt deleted +0 -11
deleted file mode 100644
index 098b3f36e6..0000000000

Lines of this file are not shown. View the raw message.

scripts/dtc/libfdt/fdt.c deleted +0 -251

251 lines not on this page · raw message

scripts/dtc/libfdt/fdt.h deleted +0 -111

111 lines not on this page · raw message

scripts/dtc/libfdt/fdt_empty_tree.c deleted +0 -84

84 lines not on this page · raw message

scripts/dtc/libfdt/fdt_ro.c deleted +0 -703

703 lines not on this page · raw message

scripts/dtc/libfdt/fdt_rw.c deleted +0 -491

491 lines not on this page · raw message

scripts/dtc/libfdt/fdt_strerror.c deleted +0 -102

102 lines not on this page · raw message

scripts/dtc/libfdt/fdt_sw.c deleted +0 -288

288 lines not on this page · raw message

scripts/dtc/libfdt/fdt_wip.c deleted +0 -139

139 lines not on this page · raw message

scripts/dtc/libfdt/libfdt.h deleted +0 -1833

1,833 lines not on this page · raw message

scripts/dtc/libfdt/libfdt_env.h deleted +0 -112

112 lines not on this page · raw message

scripts/dtc/libfdt/libfdt_internal.h deleted +0 -95

95 lines not on this page · raw message

scripts/dtc/livetree.c deleted +0 -980

980 lines not on this page · raw message

scripts/dtc/srcpos.c deleted +0 -302

302 lines not on this page · raw message

scripts/dtc/srcpos.h deleted +0 -118

118 lines not on this page · raw message

scripts/dtc/treesource.c deleted +0 -284

284 lines not on this page · raw message

scripts/dtc/update-dtc-source.sh deleted +0 -81

81 lines not on this page · raw message

scripts/dtc/util.c deleted +0 -473

473 lines not on this page · raw message

scripts/dtc/util.h deleted +0 -265

265 lines not on this page · raw message

scripts/dtc/version_gen.h deleted +0 -1
deleted file mode 100644
index bbbd96b1dc..0000000000

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.13.3

Part of the diff is not shown here. View the raw message.

author
#22 lore raw

cover REVERT Follow the Linux Kernel in building dtc as needed

In reply to Wolfgang Denk
Quoted 13 lines · Wolfgang Denk

This patch series reverts some patches that should never have been merged into mainline at all:

- They were applied in violation of the well established rule that ALL patches must be posted on the mailing list before, and given enough time for review by the community.
- Obviously, these patches have not been Acked-by: by anybody.
- They implement a solution that probably does not represent the majority of the developers who discussed this issue. They were applied cutting short the ongoing discussion, without giving a good, comprehensible reason. Alternative solutions were presented before, but this patch series ignores them.

Quoted 8 lines

U-Boot is a community project with an established and documented development process. No single person, not even a custodian or maintainer, shall have the power to push through any changes without or against the consent of the community. If we want to maintain these standards, we cannot accept this. We therefore have only one
choice: revert these patches now, and let them undergo the necessary review process on the mailing list, allowing for the usual grace period of two weeks. Sorry.

Well, NAK. When you passed the "benevolent dictator" hat over, you passed it over. I value your input, and I don't lightly over-rule feedback. So, lets summarize things:
- We need a modern device tree compiler.
- Everyone needs a modern device tree compiler, because everyone should be running 'make tests'.
- This is not the first, or second, or possibly even third time we've hit problems of people using different versions of dtc and seeing different results / problems.
- The Linux Kernel has avoided this problem for forever by just bundling the minimum required parts of dtc in order to build things.

So, I've imported the infrastructure to keep things in sync, and imported upstream dtc.

Now, the best argument I've heard against this is "bundling is bad". I don't disagree, and the best way to fix this problem would be for distributions to start shipping a new enough version here that the kernel can drop it out, just like they did for linux-firmware recently. A whole lot more people care about the kernel than they do about U-Boot, and that's a more viable path forward. It would even make some kernel folks happy.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170927/6031580e/attachment.sig>
#23 lore raw

cover REVERT Follow the Linux Kernel in building dtc as needed

Dear Tom,

Quoted 4 lines · In message <20170927143112.GT3112@bill-the-cat> you wrote:

Well, NAK. When you passed the "benevolent dictator" hat over, you passed it over. I value your input, and I don't lightly over-rule feedback. So, lets summarize things:

These are all technical arguments. You could have raised these in the ongoing discussion. If they are good, convincing arguments, you should have no problems to have them accepted.

What I'm complainiung about is not WHAT was commited, but HOW it was committed.

Marek wrote:

| I believe we have a well-established process of submitting patches,
| getting a review and then applying them. If the head maintainer doesn't
| follow the process, why should anyone else ?

You have a role model function. Please stick to the rules!

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
At the source of every error which is blamed on the computer you will
find at least two human errors, including the error of blaming it  on
the computer.
author
#24 lore raw

cover REVERT Follow the Linux Kernel in building dtc as needed

Quoted 11 lines · Wolfgang Denk

Dear Tom,

Quoted 4 lines · In message <20170927143112.GT3112@bill-the-cat> you wrote:

Well, NAK. When you passed the "benevolent dictator" hat over, you passed it over. I value your input, and I don't lightly over-rule feedback. So, lets summarize things:

These are all technical arguments. You could have raised these in the ongoing discussion. If they are good, convincing arguments, you should have no problems to have them accepted.

To which I did for some of them, and others I was going to follow up with, but left aside rather than further the thread.

Quoted 10 lines

What I'm complainiung about is not WHAT was commited, but HOW it was committed.

Marek wrote:

| I believe we have a well-established process of submitting patches,
| getting a review and then applying them. If the head maintainer doesn't
| follow the process, why should anyone else ?

You have a role model function. Please stick to the rules!

Right. And part of the job of the custodian is to, on occasion, put their foot down, on technical grounds, and say when we must do X. This happens from time to time anyways. It rarely happens between custodians, and I think this is occurrence number 2 in just over 5 years. And given the related issue of "everyone" being broken unless they have a new DTC installed, I didn't want to wait nearly so long try and convince Marek as I did with Albert and the unaligned access thing last time. Nor did I want to go with reverting the FDT changes so we can continue cycling around on what amounts to correcting the previous mistake of not just including dtc.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170927/2d51349b/attachment.sig>