Skip to content

Commit dfe0578

Browse files
committed
scripts/dtc: Update to upstream version v1.7.2-62-ga26ef6400bd8
This adds the following commits from upstream: a26ef6400bd8 Restore phandle references from __fixups__ node 05c524db44ff Restore phandle references from __local_fixups__ node db65a3a3f4f0 Restore labels from __symbols__ node 64330c682cac Improve type guessing when compiling to dts format cbb48690c697 Set DTSF_PLUGIN if needed when compiling from dtb ef3b1baf6370 Emit /plugin/ when compiling to .dts with DTSF_PLUGIN set 7c78c8542d73 Added empty node name check 14dd76b96732 fdtdump: Change FDT_PROP prob handling to ease future addition 9a1c801a1a3c Fix discarded const qualifiers 194ac9422ac9 libfdt: fdt_get_name: Add can_assume(VALID_DTB) check 39cae0bd0031 libfdt: Improve size savings in FDT_RO_PROBE slightly b12692473298 libfdt: libfdt_internal.h correct final comment in ASSUME block 7f3184a6c550 libfdt: Remove old MacOS strnlen workaround 9197f1ccd95c checks: Do not check overlays for alias paths e1284ee5dc20 livetree: Add only new data to fixup nodes instead of complete regeneration cba90ce82064 checks: Remove check for graph child addresses 763c6ab4189c livetree: Simplify append_to_property() 739403f22242 libfdt: Drop including string.h from libfdt_internal.h 1c6c51e51b29 Consider drive letters when checking for absolute paths on Windows. 617f3d9b60f7 ci: Add Cirrus CI configuration for FreeBSD testing 04f948e83fef ci: Add GitLab CI configuration for Linux builds e89680263137 ci: Tweaks to GitHub Actions setup 2ad738722b79 build: Add FreeBSD and non-GNU linker compatibility 4132ac08ba95 libfdt: Document most remaining functions 33e66ec845b8 tests: Add compatibility with uutils a0dd7b608102 fdtput: Use strtol() in preference to sscanf() 5b71660724d7 tests: Work around limitation in FreeBSD's printf(1) The graph_child_address check has been removed from upstream. Drop it from the makefiles. Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
1 parent e2bafe4 commit dfe0578

15 files changed

Lines changed: 631 additions & 139 deletions

File tree

Documentation/devicetree/bindings/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ DT_DOCS = $(patsubst $(srctree)/%,%,$(shell $(find_all_cmd)))
5656

5757
override DTC_FLAGS := \
5858
-Wno-avoid_unnecessary_addr_size \
59-
-Wno-graph_child_address \
6059
-Wno-unique_unit_address \
6160
-Wunique_unit_address_if_enabled
6261

scripts/Makefile.dtbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
105105
DTC_FLAGS += -Wno-unit_address_vs_reg \
106106
-Wno-avoid_unnecessary_addr_size \
107107
-Wno-alias_paths \
108-
-Wno-graph_child_address \
109108
-Wno-interrupt_map \
110109
-Wno-simple_bus_reg
111110
else

scripts/dtc/checks.c

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,14 @@ static void check_node_name_format(struct check *c, struct dt_info *dti,
340340
}
341341
ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars);
342342

343+
static void check_node_name_not_empty(struct check *c, struct dt_info *dti,
344+
struct node *node)
345+
{
346+
if (node->basenamelen == 0 && node->parent != NULL)
347+
FAIL(c, dti, node, "Empty node name");
348+
}
349+
ERROR(node_name_not_empty, check_node_name_not_empty, NULL, &node_name_chars);
350+
343351
static void check_node_name_vs_property_name(struct check *c,
344352
struct dt_info *dti,
345353
struct node *node)
@@ -718,11 +726,14 @@ static void check_alias_paths(struct check *c, struct dt_info *dti,
718726
continue;
719727
}
720728

721-
if (!prop->val.val || !get_node_by_path(dti->dt, prop->val.val)) {
729+
/* This check does not work for overlays with external paths */
730+
if (!(dti->dtsflags & DTSF_PLUGIN) &&
731+
(!prop->val.val || !get_node_by_path(dti->dt, prop->val.val))) {
722732
FAIL_PROP(c, dti, node, prop, "aliases property is not a valid node (%s)",
723733
prop->val.val);
724734
continue;
725735
}
736+
726737
if (strspn(prop->name, LOWERCASE DIGITS "-") != strlen(prop->name))
727738
FAIL(c, dti, node, "aliases property name must include only lowercase and '-'");
728739
}
@@ -1894,34 +1905,9 @@ static void check_graph_endpoint(struct check *c, struct dt_info *dti,
18941905
}
18951906
WARNING(graph_endpoint, check_graph_endpoint, NULL, &graph_nodes);
18961907

1897-
static void check_graph_child_address(struct check *c, struct dt_info *dti,
1898-
struct node *node)
1899-
{
1900-
int cnt = 0;
1901-
struct node *child;
1902-
1903-
if (node->bus != &graph_ports_bus && node->bus != &graph_port_bus)
1904-
return;
1905-
1906-
for_each_child(node, child) {
1907-
struct property *prop = get_property(child, "reg");
1908-
1909-
/* No error if we have any non-zero unit address */
1910-
if (prop && propval_cell(prop) != 0 )
1911-
return;
1912-
1913-
cnt++;
1914-
}
1915-
1916-
if (cnt == 1 && node->addr_cells != -1)
1917-
FAIL(c, dti, node, "graph node has single child node '%s', #address-cells/#size-cells are not necessary",
1918-
node->children->name);
1919-
}
1920-
WARNING(graph_child_address, check_graph_child_address, NULL, &graph_nodes, &graph_port, &graph_endpoint);
1921-
19221908
static struct check *check_table[] = {
19231909
&duplicate_node_names, &duplicate_property_names,
1924-
&node_name_chars, &node_name_format, &property_name_chars,
1910+
&node_name_chars, &node_name_format, &node_name_not_empty, &property_name_chars,
19251911
&name_is_string, &name_properties, &node_name_vs_property_name,
19261912

19271913
&duplicate_label,
@@ -2005,7 +1991,7 @@ static struct check *check_table[] = {
20051991

20061992
&alias_paths,
20071993

2008-
&graph_nodes, &graph_child_address, &graph_port, &graph_endpoint,
1994+
&graph_nodes, &graph_port, &graph_endpoint,
20091995

20101996
&always_fail,
20111997
};

scripts/dtc/dtc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,14 @@ int main(int argc, char *argv[])
338338
if (auto_label_aliases)
339339
generate_label_tree(dti, "aliases", false);
340340

341+
generate_labels_from_tree(dti, "__symbols__");
342+
341343
if (generate_symbols)
342344
generate_label_tree(dti, "__symbols__", true);
343345

346+
fixup_phandles(dti, "__fixups__");
347+
local_fixup_phandles(dti, "__local_fixups__");
348+
344349
if (generate_fixups) {
345350
generate_fixups_tree(dti, "__fixups__");
346351
generate_local_fixups_tree(dti, "__local_fixups__");

scripts/dtc/dtc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,12 @@ struct dt_info *build_dt_info(unsigned int dtsflags,
339339
struct reserve_info *reservelist,
340340
struct node *tree, uint32_t boot_cpuid_phys);
341341
void sort_tree(struct dt_info *dti);
342+
void generate_labels_from_tree(struct dt_info *dti, const char *name);
342343
void generate_label_tree(struct dt_info *dti, const char *name, bool allocph);
343344
void generate_fixups_tree(struct dt_info *dti, const char *name);
345+
void fixup_phandles(struct dt_info *dti, const char *name);
344346
void generate_local_fixups_tree(struct dt_info *dti, const char *name);
347+
void local_fixup_phandles(struct dt_info *dti, const char *name);
345348

346349
/* Checks */
347350

@@ -357,6 +360,9 @@ struct dt_info *dt_from_blob(const char *fname);
357360

358361
/* Tree source */
359362

363+
void property_add_marker(struct property *prop,
364+
enum markertype type, unsigned int offset, char *ref);
365+
void add_phandle_marker(struct dt_info *dti, struct property *prop, unsigned int offset);
360366
void dt_to_source(FILE *f, struct dt_info *dti);
361367
struct dt_info *dt_from_source(const char *f);
362368

scripts/dtc/flattree.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ struct dt_info *dt_from_blob(const char *fname)
807807
struct node *tree;
808808
uint32_t val;
809809
int flags = 0;
810+
unsigned int dtsflags = DTSF_V1;
810811

811812
f = srcfile_relative_open(fname, NULL);
812813

@@ -919,5 +920,8 @@ struct dt_info *dt_from_blob(const char *fname)
919920

920921
fclose(f);
921922

922-
return build_dt_info(DTSF_V1, reservelist, tree, boot_cpuid_phys);
923+
if (get_subnode(tree, "__fixups__") || get_subnode(tree, "__local_fixups__"))
924+
dtsflags |= DTSF_PLUGIN;
925+
926+
return build_dt_info(dtsflags, reservelist, tree, boot_cpuid_phys);
923927
}

scripts/dtc/libfdt/fdt_overlay.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off,
407407
const char *fixup_str = value;
408408
uint32_t path_len, name_len;
409409
uint32_t fixup_len;
410-
char *sep, *endptr;
410+
const char *sep;
411+
char *endptr;
411412
int poffset, ret;
412413

413414
fixup_end = memchr(value, '\0', len);

scripts/dtc/libfdt/fdt_ro.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
306306
const char *nameptr;
307307
int err;
308308

309-
if (((err = fdt_ro_probe_(fdt)) < 0)
310-
|| ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0))
309+
if (!can_assume(VALID_DTB) && (((err = fdt_ro_probe_(fdt)) < 0)
310+
|| ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0)))
311311
goto fail;
312312

313313
nameptr = nh->name;

0 commit comments

Comments
 (0)