Module Name: src
Committed By: skrll
Date: Sun Dec 22 12:38:24 UTC 2019
Modified Files:
src/external/gpl2/dtc/dist: data.c dtc-lexer.l dtc-parser.y dtc.h
fdtdump.c fdtput.c flattree.c srcpos.c util.h
src/external/gpl2/dtc/dist/tests: mangle-layout.c move_and_save.c
tests.h
Removed Files:
src/external/gpl2/dtc/dist/tests: mangle-layout.supp open_pack.supp
sw_tree1.supp tests.sh
Log Message:
Merge conflicts
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl2/dtc/dist/data.c \
src/external/gpl2/dtc/dist/dtc-lexer.l \
src/external/gpl2/dtc/dist/dtc-parser.y src/external/gpl2/dtc/dist/dtc.h \
src/external/gpl2/dtc/dist/fdtdump.c src/external/gpl2/dtc/dist/fdtput.c \
src/external/gpl2/dtc/dist/srcpos.c src/external/gpl2/dtc/dist/util.h
cvs rdiff -u -r1.4 -r1.5 src/external/gpl2/dtc/dist/flattree.c
cvs rdiff -u -r1.3 -r1.4 src/external/gpl2/dtc/dist/tests/mangle-layout.c \
src/external/gpl2/dtc/dist/tests/move_and_save.c \
src/external/gpl2/dtc/dist/tests/tests.h
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/gpl2/dtc/dist/tests/mangle-layout.supp \
src/external/gpl2/dtc/dist/tests/open_pack.supp \
src/external/gpl2/dtc/dist/tests/sw_tree1.supp \
src/external/gpl2/dtc/dist/tests/tests.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/gpl2/dtc/dist/data.c
diff -u src/external/gpl2/dtc/dist/data.c:1.3 src/external/gpl2/dtc/dist/data.c:1.4
--- src/external/gpl2/dtc/dist/data.c:1.3 Thu Jun 8 16:00:40 2017
+++ src/external/gpl2/dtc/dist/data.c Sun Dec 22 12:38:24 2019
@@ -1,23 +1,8 @@
-/* $NetBSD: data.c,v 1.3 2017/06/08 16:00:40 skrll Exp $ */
+/* $NetBSD: data.c,v 1.4 2019/12/22 12:38:24 skrll Exp $ */
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* (C) Copyright David Gibson <[email protected]>, IBM Corporation. 2005.
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
*/
#include "dtc.h"
@@ -76,7 +61,8 @@ struct data data_copy_escape_string(cons
struct data d;
char *q;
- d = data_grow_for(empty_data, len + 1);
+ d = data_add_marker(empty_data, TYPE_STRING, NULL);
+ d = data_grow_for(d, len + 1);
q = d.val;
while (i < len) {
@@ -96,6 +82,7 @@ struct data data_copy_file(FILE *f, size
{
struct data d = empty_data;
+ d = data_add_marker(d, TYPE_NONE, NULL);
while (!feof(f) && (d.len < maxlen)) {
size_t chunksize, ret;
Index: src/external/gpl2/dtc/dist/dtc-lexer.l
diff -u src/external/gpl2/dtc/dist/dtc-lexer.l:1.3 src/external/gpl2/dtc/dist/dtc-lexer.l:1.4
--- src/external/gpl2/dtc/dist/dtc-lexer.l:1.3 Thu Jun 8 16:00:40 2017
+++ src/external/gpl2/dtc/dist/dtc-lexer.l Sun Dec 22 12:38:24 2019
@@ -1,23 +1,8 @@
-/* $NetBSD: dtc-lexer.l,v 1.3 2017/06/08 16:00:40 skrll Exp $ */
+/* $NetBSD: dtc-lexer.l,v 1.4 2019/12/22 12:38:24 skrll Exp $ */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* (C) Copyright David Gibson <[email protected]>, IBM Corporation. 2005.
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
*/
%option noyywrap nounput noinput never-interactive
@@ -155,6 +140,13 @@ static void PRINTF(1, 2) lexical_error(c
return DT_DEL_NODE;
}
+<*>"/omit-if-no-ref/" {
+ DPRINT("Keyword: /omit-if-no-ref/\n");
+ DPRINT("<PROPNODENAME>\n");
+ BEGIN(PROPNODENAME);
+ return DT_OMIT_NO_REF;
+ }
+
<*>{LABEL}: {
DPRINT("Label: %s\n", yytext);
yylval.labelref = xstrdup(yytext);
@@ -208,14 +200,14 @@ static void PRINTF(1, 2) lexical_error(c
<*>\&{LABEL} { /* label reference */
DPRINT("Ref: %s\n", yytext+1);
yylval.labelref = xstrdup(yytext+1);
- return DT_REF;
+ return DT_LABEL_REF;
}
<*>"&{/"{PATHCHAR}*\} { /* new-style path reference */
yytext[yyleng-1] = '\0';
DPRINT("Ref: %s\n", yytext+2);
yylval.labelref = xstrdup(yytext+2);
- return DT_REF;
+ return DT_PATH_REF;
}
<BYTESTRING>[0-9a-fA-F]{2} {
Index: src/external/gpl2/dtc/dist/dtc-parser.y
diff -u src/external/gpl2/dtc/dist/dtc-parser.y:1.3 src/external/gpl2/dtc/dist/dtc-parser.y:1.4
--- src/external/gpl2/dtc/dist/dtc-parser.y:1.3 Thu Jun 8 16:00:40 2017
+++ src/external/gpl2/dtc/dist/dtc-parser.y Sun Dec 22 12:38:24 2019
@@ -1,23 +1,8 @@
-/* $NetBSD: dtc-parser.y,v 1.3 2017/06/08 16:00:40 skrll Exp $ */
+/* $NetBSD: dtc-parser.y,v 1.4 2019/12/22 12:38:24 skrll Exp $ */
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* (C) Copyright David Gibson <[email protected]>, IBM Corporation. 2005.
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
*/
%{
#include <stdio.h>
@@ -69,13 +54,15 @@ extern bool treesource_error;
%token DT_BITS
%token DT_DEL_PROP
%token DT_DEL_NODE
+%token DT_OMIT_NO_REF
%token <propnodename> DT_PROPNODENAME
%token <integer> DT_LITERAL
%token <integer> DT_CHAR_LITERAL
%token <byte> DT_BYTE
%token <data> DT_STRING
%token <labelref> DT_LABEL
-%token <labelref> DT_REF
+%token <labelref> DT_LABEL_REF
+%token <labelref> DT_PATH_REF
%token DT_INCBIN
%type <data> propdata
@@ -88,6 +75,7 @@ extern bool treesource_error;
%type <data> bytestring
%type <prop> propdef
%type <proplist> proplist
+%type <labelref> dt_ref
%type <node> devicetree
%type <node> nodedef
@@ -163,6 +151,8 @@ memreserve:
}
;
+dt_ref: DT_LABEL_REF | DT_PATH_REF;
+
devicetree:
'/' nodedef
{
@@ -172,8 +162,21 @@ devicetree:
{
$$ = merge_nodes($1, $3);
}
-
- | devicetree DT_LABEL DT_REF nodedef
+ | dt_ref nodedef
+ {
+ /*
+ * We rely on the rule being always:
+ * versioninfo plugindecl memreserves devicetree
+ * so $-1 is what we want (plugindecl)
+ */
+ if (!($<flags>-1 & DTSF_PLUGIN))
+ ERROR(&@2, "Label or path %s not found", $1);
+ $$ = add_orphan_node(
+ name_node(build_node(NULL, NULL, NULL),
+ ""),
+ $2, $1);
+ }
+ | devicetree DT_LABEL dt_ref nodedef
{
struct node *target = get_node_by_ref($1, $3);
@@ -184,17 +187,45 @@ devicetree:
ERROR(&@3, "Label or path %s not found", $3);
$$ = $1;
}
- | devicetree DT_REF nodedef
+ | devicetree DT_PATH_REF nodedef
+ {
+ /*
+ * We rely on the rule being always:
+ * versioninfo plugindecl memreserves devicetree
+ * so $-1 is what we want (plugindecl)
+ */
+ if ($<flags>-1 & DTSF_PLUGIN) {
+ add_orphan_node($1, $3, $2);
+ } else {
+ struct node *target = get_node_by_ref($1, $2);
+
+ if (target)
+ merge_nodes(target, $3);
+ else
+ ERROR(&@2, "Label or path %s not found", $2);
+ }
+ $$ = $1;
+ }
+ | devicetree DT_LABEL_REF nodedef
{
struct node *target = get_node_by_ref($1, $2);
- if (target)
+ if (target) {
merge_nodes(target, $3);
- else
- ERROR(&@2, "Label or path %s not found", $2);
+ } else {
+ /*
+ * We rely on the rule being always:
+ * versioninfo plugindecl memreserves devicetree
+ * so $-1 is what we want (plugindecl)
+ */
+ if ($<flags>-1 & DTSF_PLUGIN)
+ add_orphan_node($1, $3, $2);
+ else
+ ERROR(&@2, "Label or path %s not found", $2);
+ }
$$ = $1;
}
- | devicetree DT_DEL_NODE DT_REF ';'
+ | devicetree DT_DEL_NODE dt_ref ';'
{
struct node *target = get_node_by_ref($1, $3);
@@ -206,12 +237,24 @@ devicetree:
$$ = $1;
}
+ | devicetree DT_OMIT_NO_REF dt_ref ';'
+ {
+ struct node *target = get_node_by_ref($1, $3);
+
+ if (target)
+ omit_node_if_unused(target);
+ else
+ ERROR(&@3, "Label or path %s not found", $3);
+
+
+ $$ = $1;
+ }
;
nodedef:
'{' proplist subnodes '}' ';'
{
- $$ = build_node($2, $3);
+ $$ = build_node($2, $3, &@$);
}
;
@@ -229,11 +272,11 @@ proplist:
propdef:
DT_PROPNODENAME '=' propdata ';'
{
- $$ = build_property($1, $3);
+ $$ = build_property($1, $3, &@$);
}
| DT_PROPNODENAME ';'
{
- $$ = build_property($1, empty_data);
+ $$ = build_property($1, empty_data, &@$);
}
| DT_DEL_PROP DT_PROPNODENAME ';'
{
@@ -259,8 +302,9 @@ propdata:
{
$$ = data_merge($1, $3);
}
- | propdataprefix DT_REF
+ | propdataprefix dt_ref
{
+ $1 = data_add_marker($1, TYPE_STRING, $2);
$$ = data_add_marker($1, REF_PATH, $2);
}
| propdataprefix DT_INCBIN '(' DT_STRING ',' integer_prim ',' integer_prim ')'
@@ -314,22 +358,27 @@ arrayprefix:
DT_BITS DT_LITERAL '<'
{
unsigned long long bits;
+ enum markertype type = TYPE_UINT32;
bits = $2;
- if ((bits != 8) && (bits != 16) &&
- (bits != 32) && (bits != 64)) {
+ switch (bits) {
+ case 8: type = TYPE_UINT8; break;
+ case 16: type = TYPE_UINT16; break;
+ case 32: type = TYPE_UINT32; break;
+ case 64: type = TYPE_UINT64; break;
+ default:
ERROR(&@2, "Array elements must be"
" 8, 16, 32 or 64-bits");
bits = 32;
}
- $$.data = empty_data;
+ $$.data = data_add_marker(empty_data, type, NULL);
$$.bits = bits;
}
| '<'
{
- $$.data = empty_data;
+ $$.data = data_add_marker(empty_data, TYPE_UINT32, NULL);
$$.bits = 32;
}
| arrayprefix integer_prim
@@ -351,7 +400,7 @@ arrayprefix:
$$.data = data_append_integer($1.data, $2, $1.bits);
}
- | arrayprefix DT_REF
+ | arrayprefix dt_ref
{
uint64_t val = ~0ULL >> (64 - $1.bits);
@@ -473,7 +522,7 @@ integer_unary:
bytestring:
/* empty */
{
- $$ = empty_data;
+ $$ = data_add_marker(empty_data, TYPE_UINT8, NULL);
}
| bytestring DT_BYTE
{
@@ -508,7 +557,11 @@ subnode:
}
| DT_DEL_NODE DT_PROPNODENAME ';'
{
- $$ = name_node(build_node_delete(), $2);
+ $$ = name_node(build_node_delete(&@$), $2);
+ }
+ | DT_OMIT_NO_REF subnode
+ {
+ $$ = omit_node_if_unused($2);
}
| DT_LABEL subnode
{
Index: src/external/gpl2/dtc/dist/dtc.h
diff -u src/external/gpl2/dtc/dist/dtc.h:1.3 src/external/gpl2/dtc/dist/dtc.h:1.4
--- src/external/gpl2/dtc/dist/dtc.h:1.3 Thu Jun 8 16:00:40 2017
+++ src/external/gpl2/dtc/dist/dtc.h Sun Dec 22 12:38:24 2019
@@ -1,26 +1,11 @@
-/* $NetBSD: dtc.h,v 1.3 2017/06/08 16:00:40 skrll Exp $ */
+/* $NetBSD: dtc.h,v 1.4 2019/12/22 12:38:24 skrll Exp $ */
-#ifndef _DTC_H
-#define _DTC_H
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef DTC_H
+#define DTC_H
/*
* (C) Copyright David Gibson <[email protected]>, IBM Corporation. 2005.
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
*/
#include <stdio.h>
@@ -33,6 +18,7 @@
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
+#include <inttypes.h>
#include <libfdt_env.h>
#include <fdt.h>
@@ -59,6 +45,7 @@ extern int phandle_format; /* Use linux,
extern int generate_symbols; /* generate symbols for nodes with labels */
extern int generate_fixups; /* generate fixups */
extern int auto_label_aliases; /* auto generate labels -> aliases */
+extern int annotate; /* annotate .dts with input source location */
#define PHANDLE_LEGACY 0x1
#define PHANDLE_EPAPR 0x2
@@ -68,14 +55,22 @@ typedef uint32_t cell_t;
#define streq(a, b) (strcmp((a), (b)) == 0)
-#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
+#define strstarts(s, prefix) (strncmp((s), (prefix), strlen(prefix)) == 0)
+#define strprefixeq(a, n, b) (strlen(b) == (n) && (memcmp(a, b, n) == 0))
/* Data blobs */
enum markertype {
+ TYPE_NONE,
REF_PHANDLE,
REF_PATH,
LABEL,
+ TYPE_UINT8,
+ TYPE_UINT16,
+ TYPE_UINT32,
+ TYPE_UINT64,
+ TYPE_STRING,
};
+extern const char *markername(enum markertype markertype);
struct marker {
enum markertype type;
@@ -99,6 +94,8 @@ struct data {
for_each_marker(m) \
if ((m)->type == (t))
+size_t type_marker_length(struct marker *m);
+
void data_free(struct data d);
struct data data_grow_for(struct data d, int xlen);
@@ -135,6 +132,10 @@ struct label {
struct label *next;
};
+struct bus_type {
+ const char *name;
+};
+
struct property {
bool deleted;
char *name;
@@ -143,6 +144,7 @@ struct property {
struct property *next;
struct label *labels;
+ struct srcpos *srcpos;
};
struct node {
@@ -161,6 +163,10 @@ struct node {
int addr_cells, size_cells;
struct label *labels;
+ const struct bus_type *bus;
+ struct srcpos *srcpos;
+
+ bool omit_if_unused, is_referenced;
};
#define for_each_label_withdel(l0, l) \
@@ -187,16 +193,21 @@ struct node {
void add_label(struct label **labels, char *label);
void delete_labels(struct label **labels);
-struct property *build_property(char *name, struct data val);
+struct property *build_property(char *name, struct data val,
+ struct srcpos *srcpos);
struct property *build_property_delete(char *name);
struct property *chain_property(struct property *first, struct property *list);
struct property *reverse_properties(struct property *first);
-struct node *build_node(struct property *proplist, struct node *children);
-struct node *build_node_delete(void);
+struct node *build_node(struct property *proplist, struct node *children,
+ struct srcpos *srcpos);
+struct node *build_node_delete(struct srcpos *srcpos);
struct node *name_node(struct node *node, char *name);
+struct node *omit_node_if_unused(struct node *node);
+struct node *reference_node(struct node *node);
struct node *chain_node(struct node *first, struct node *list);
struct node *merge_nodes(struct node *old_node, struct node *new_node);
+struct node *add_orphan_node(struct node *old_node, struct node *new_node, char *ref);
void add_property(struct node *node, struct property *prop);
void delete_property_by_name(struct node *node, char *name);
@@ -205,11 +216,13 @@ void add_child(struct node *parent, stru
void delete_node_by_name(struct node *parent, char *name);
void delete_node(struct node *node);
void append_to_property(struct node *node,
- char *name, const void *data, int len);
+ char *name, const void *data, int len,
+ enum markertype type);
const char *get_unitname(struct node *node);
struct property *get_property(struct node *node, const char *propname);
cell_t propval_cell(struct property *prop);
+cell_t propval_cell_n(struct property *prop, int n);
struct property *get_property_by_label(struct node *tree, const char *label,
struct node **node);
struct marker *get_marker_label(struct node *tree, const char *label,
@@ -277,8 +290,12 @@ struct dt_info *dt_from_blob(const char
void dt_to_source(FILE *f, struct dt_info *dti);
struct dt_info *dt_from_source(const char *f);
+/* YAML source */
+
+void dt_to_yaml(FILE *f, struct dt_info *dti);
+
/* FS trees */
struct dt_info *dt_from_fs(const char *dirname);
-#endif /* _DTC_H */
+#endif /* DTC_H */
Index: src/external/gpl2/dtc/dist/fdtdump.c
diff -u src/external/gpl2/dtc/dist/fdtdump.c:1.3 src/external/gpl2/dtc/dist/fdtdump.c:1.4
--- src/external/gpl2/dtc/dist/fdtdump.c:1.3 Thu Jun 8 16:00:40 2017
+++ src/external/gpl2/dtc/dist/fdtdump.c Sun Dec 22 12:38:24 2019
@@ -1,5 +1,6 @@
-/* $NetBSD: fdtdump.c,v 1.3 2017/06/08 16:00:40 skrll Exp $ */
+/* $NetBSD: fdtdump.c,v 1.4 2019/12/22 12:38:24 skrll Exp $ */
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* fdtdump.c - Contributed by Pantelis Antoniou <pantelis.antoniou AT gmail.com>
*/
@@ -10,6 +11,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#include <inttypes.h>
#include <libfdt.h>
#include <libfdt_env.h>
@@ -65,23 +67,24 @@ static void dump_blob(void *blob, bool d
shift = 4;
printf("/dts-v1/;\n");
- printf("// magic:\t\t0x%x\n", fdt32_to_cpu(bph->magic));
- printf("// totalsize:\t\t0x%x (%d)\n", totalsize, totalsize);
- printf("// off_dt_struct:\t0x%x\n", off_dt);
- printf("// off_dt_strings:\t0x%x\n", off_str);
- printf("// off_mem_rsvmap:\t0x%x\n", off_mem_rsvmap);
- printf("// version:\t\t%d\n", version);
- printf("// last_comp_version:\t%d\n",
+ printf("// magic:\t\t0x%"PRIx32"\n", fdt32_to_cpu(bph->magic));
+ printf("// totalsize:\t\t0x%"PRIx32" (%"PRIu32")\n",
+ totalsize, totalsize);
+ printf("// off_dt_struct:\t0x%"PRIx32"\n", off_dt);
+ printf("// off_dt_strings:\t0x%"PRIx32"\n", off_str);
+ printf("// off_mem_rsvmap:\t0x%"PRIx32"\n", off_mem_rsvmap);
+ printf("// version:\t\t%"PRIu32"\n", version);
+ printf("// last_comp_version:\t%"PRIu32"\n",
fdt32_to_cpu(bph->last_comp_version));
if (version >= 2)
- printf("// boot_cpuid_phys:\t0x%x\n",
+ printf("// boot_cpuid_phys:\t0x%"PRIx32"\n",
fdt32_to_cpu(bph->boot_cpuid_phys));
if (version >= 3)
- printf("// size_dt_strings:\t0x%x\n",
+ printf("// size_dt_strings:\t0x%"PRIx32"\n",
fdt32_to_cpu(bph->size_dt_strings));
if (version >= 17)
- printf("// size_dt_struct:\t0x%x\n",
+ printf("// size_dt_struct:\t0x%"PRIx32"\n",
fdt32_to_cpu(bph->size_dt_struct));
printf("\n");
@@ -91,14 +94,14 @@ static void dump_blob(void *blob, bool d
if (addr == 0 && size == 0)
break;
- printf("/memreserve/ %#llx %#llx;\n",
- (unsigned long long)addr, (unsigned long long)size);
+ printf("/memreserve/ %#"PRIx64" %#"PRIx64";\n",
+ addr, size);
}
p = p_struct;
while ((tag = fdt32_to_cpu(GET_CELL(p))) != FDT_END) {
- dumpf("%04zx: tag: 0x%08x (%s)\n",
+ dumpf("%04"PRIxPTR": tag: 0x%08"PRIx32" (%s)\n",
(uintptr_t)p - blob_off - 4, tag, tagname(tag));
if (tag == FDT_BEGIN_NODE) {
@@ -127,7 +130,7 @@ static void dump_blob(void *blob, bool d
}
if (tag != FDT_PROP) {
- fprintf(stderr, "%*s ** Unknown tag 0x%08x\n", depth * shift, "", tag);
+ fprintf(stderr, "%*s ** Unknown tag 0x%08"PRIx32"\n", depth * shift, "", tag);
break;
}
sz = fdt32_to_cpu(GET_CELL(p));
@@ -138,8 +141,8 @@ static void dump_blob(void *blob, bool d
p = PALIGN(p + sz, 4);
- dumpf("%04zx: string: %s\n", (uintptr_t)s - blob_off, s);
- dumpf("%04zx: value\n", (uintptr_t)t - blob_off);
+ dumpf("%04"PRIxPTR": string: %s\n", (uintptr_t)s - blob_off, s);
+ dumpf("%04"PRIxPTR": value\n", (uintptr_t)t - blob_off);
printf("%*s%s", depth * shift, "", s);
utilfdt_print_data(t, sz);
printf(";\n");
@@ -165,7 +168,7 @@ static bool valid_header(char *p, off_t
if (len < sizeof(struct fdt_header) ||
fdt_magic(p) != FDT_MAGIC ||
fdt_version(p) > MAX_VERSION ||
- fdt_last_comp_version(p) >= MAX_VERSION ||
+ fdt_last_comp_version(p) > MAX_VERSION ||
fdt_totalsize(p) >= len ||
fdt_off_dt_struct(p) >= len ||
fdt_off_dt_strings(p) >= len)
@@ -181,8 +184,13 @@ int main(int argc, char *argv[])
char *buf;
bool debug = false;
bool scan = false;
- off_t len;
+ size_t len;
+ fprintf(stderr, "\n"
+"**** fdtdump is a low-level debugging tool, not meant for general use.\n"
+"**** If you want to decompile a dtb, you probably want\n"
+"**** dtc -I dtb -O dts <filename>\n\n"
+ );
while ((opt = util_getopt_long()) != EOF) {
switch (opt) {
case_USAGE_COMMON_FLAGS
@@ -199,7 +207,7 @@ int main(int argc, char *argv[])
usage("missing input filename");
file = argv[optind];
- buf = utilfdt_read_len(file, &len);
+ buf = utilfdt_read(file, &len);
if (!buf)
die("could not read: %s\n", file);
@@ -222,14 +230,14 @@ int main(int argc, char *argv[])
if (valid_header(p, this_len))
break;
if (debug)
- printf("%s: skipping fdt magic at offset %#zx\n",
+ printf("%s: skipping fdt magic at offset %#tx\n",
file, p - buf);
}
++p;
}
if (!p || endp - p < sizeof(struct fdt_header))
die("%s: could not locate fdt magic\n", file);
- printf("%s: found fdt at offset %#zx\n", file, p - buf);
+ printf("%s: found fdt at offset %#tx\n", file, p - buf);
buf = p;
} else if (!valid_header(buf, len))
die("%s: header is not valid\n", file);
Index: src/external/gpl2/dtc/dist/fdtput.c
diff -u src/external/gpl2/dtc/dist/fdtput.c:1.3 src/external/gpl2/dtc/dist/fdtput.c:1.4
--- src/external/gpl2/dtc/dist/fdtput.c:1.3 Thu Jun 8 16:00:40 2017
+++ src/external/gpl2/dtc/dist/fdtput.c Sun Dec 22 12:38:24 2019
@@ -1,22 +1,8 @@
-/* $NetBSD: fdtput.c,v 1.3 2017/06/08 16:00:40 skrll Exp $ */
+/* $NetBSD: fdtput.c,v 1.4 2019/12/22 12:38:24 skrll Exp $ */
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
*/
#include <assert.h>
@@ -132,7 +118,7 @@ static int encode_value(struct display_i
#define FDTALIGN(x) (((x) + (FDT_TAGSIZE) - 1) & ~((FDT_TAGSIZE) - 1))
-static char *_realloc_fdt(char *fdt, int delta)
+static char *realloc_fdt(char *fdt, int delta)
{
int new_sz = fdt_totalsize(fdt) + delta;
fdt = xrealloc(fdt, new_sz);
@@ -146,7 +132,7 @@ static char *realloc_node(char *fdt, con
/* FDT_BEGIN_NODE, node name in off_struct and FDT_END_NODE */
delta = sizeof(struct fdt_node_header) + FDTALIGN(strlen(name) + 1)
+ FDT_TAGSIZE;
- return _realloc_fdt(fdt, delta);
+ return realloc_fdt(fdt, delta);
}
static char *realloc_property(char *fdt, int nodeoffset,
@@ -163,7 +149,7 @@ static char *realloc_property(char *fdt,
/* actual value in off_struct */
delta += FDTALIGN(newlen) - FDTALIGN(oldlen);
- return _realloc_fdt(fdt, delta);
+ return realloc_fdt(fdt, delta);
}
static int store_key_value(char **blob, const char *node_name,
@@ -335,7 +321,7 @@ static int do_fdtput(struct display_info
char *node;
int len, ret = 0;
- blob = utilfdt_read(filename);
+ blob = utilfdt_read(filename, NULL);
if (!blob)
return -1;
Index: src/external/gpl2/dtc/dist/srcpos.c
diff -u src/external/gpl2/dtc/dist/srcpos.c:1.3 src/external/gpl2/dtc/dist/srcpos.c:1.4
--- src/external/gpl2/dtc/dist/srcpos.c:1.3 Thu Jun 8 16:00:40 2017
+++ src/external/gpl2/dtc/dist/srcpos.c Sun Dec 22 12:38:24 2019
@@ -1,22 +1,8 @@
-/* $NetBSD: srcpos.c,v 1.3 2017/06/08 16:00:40 skrll Exp $ */
+/* $NetBSD: srcpos.c,v 1.4 2019/12/22 12:38:24 skrll Exp $ */
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright 2007 Jon Loeliger, Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
*/
#define _GNU_SOURCE
@@ -35,6 +21,9 @@ struct search_path {
/* This is the list of directories that we search for source files */
static struct search_path *search_path_head, **search_path_tail;
+/* Detect infinite include recursion. */
+#define MAX_SRCFILE_DEPTH (100)
+static int srcfile_depth; /* = 0 */
static char *get_dirname(const char *path)
{
@@ -53,11 +42,51 @@ static char *get_dirname(const char *pat
FILE *depfile; /* = NULL */
struct srcfile_state *current_srcfile; /* = NULL */
+static char *initial_path; /* = NULL */
+static int initial_pathlen; /* = 0 */
+static bool initial_cpp = true;
-/* Detect infinite include recursion. */
-#define MAX_SRCFILE_DEPTH (100)
-static int srcfile_depth; /* = 0 */
+static void set_initial_path(char *fname)
+{
+ int i, len = strlen(fname);
+
+ xasprintf(&initial_path, "%s", fname);
+ initial_pathlen = 0;
+ for (i = 0; i != len; i++)
+ if (initial_path[i] == '/')
+ initial_pathlen++;
+}
+static char *shorten_to_initial_path(char *fname)
+{
+ char *p1, *p2, *prevslash1 = NULL;
+ int slashes = 0;
+
+ for (p1 = fname, p2 = initial_path; *p1 && *p2; p1++, p2++) {
+ if (*p1 != *p2)
+ break;
+ if (*p1 == '/') {
+ prevslash1 = p1;
+ slashes++;
+ }
+ }
+ p1 = prevslash1 + 1;
+ if (prevslash1) {
+ int diff = initial_pathlen - slashes, i, j;
+ int restlen = strlen(fname) - (p1 - fname);
+ char *res;
+
+ res = xmalloc((3 * diff) + restlen + 1);
+ for (i = 0, j = 0; i != diff; i++) {
+ res[j++] = '.';
+ res[j++] = '.';
+ res[j++] = '/';
+ }
+ strcpy(res + j, p1);
+ return res;
+ }
+ return NULL;
+}
/**
* Try to open a file in a given directory.
@@ -159,6 +188,9 @@ void srcfile_push(const char *fname)
srcfile->colno = 1;
current_srcfile = srcfile;
+
+ if (srcfile_depth == 1)
+ set_initial_path(srcfile->name);
}
bool srcfile_pop(void)
@@ -199,20 +231,6 @@ void srcfile_add_search_path(const char
search_path_tail = &node->next;
}
-/*
- * The empty source position.
- */
-
-struct srcpos srcpos_empty = {
- .first_line = 0,
- .first_column = 0,
- .last_line = 0,
- .last_column = 0,
- .file = NULL,
-};
-
-#define TAB_SIZE 8
-
void srcpos_update(struct srcpos *pos, const char *text, int len)
{
int i;
@@ -226,9 +244,6 @@ void srcpos_update(struct srcpos *pos, c
if (text[i] == '\n') {
current_srcfile->lineno++;
current_srcfile->colno = 1;
- } else if (text[i] == '\t') {
- current_srcfile->colno =
- FDTALIGN2(current_srcfile->colno, TAB_SIZE);
} else {
current_srcfile->colno++;
}
@@ -241,13 +256,35 @@ struct srcpos *
srcpos_copy(struct srcpos *pos)
{
struct srcpos *pos_new;
+ struct srcfile_state *srcfile_state;
+
+ if (!pos)
+ return NULL;
pos_new = xmalloc(sizeof(struct srcpos));
+ assert(pos->next == NULL);
memcpy(pos_new, pos, sizeof(struct srcpos));
+ /* allocate without free */
+ srcfile_state = xmalloc(sizeof(struct srcfile_state));
+ memcpy(srcfile_state, pos->file, sizeof(struct srcfile_state));
+ pos_new->file = srcfile_state;
+
return pos_new;
}
+struct srcpos *srcpos_extend(struct srcpos *pos, struct srcpos *newtail)
+{
+ struct srcpos *p;
+
+ if (!pos)
+ return newtail;
+
+ for (p = pos; p->next != NULL; p = p->next);
+ p->next = newtail;
+ return pos;
+}
+
char *
srcpos_string(struct srcpos *pos)
{
@@ -273,6 +310,68 @@ srcpos_string(struct srcpos *pos)
return pos_str;
}
+static char *
+srcpos_string_comment(struct srcpos *pos, bool first_line, int level)
+{
+ char *pos_str, *fname, *first, *rest;
+ bool fresh_fname = false;
+
+ if (!pos) {
+ if (level > 1) {
+ xasprintf(&pos_str, "<no-file>:<no-line>");
+ return pos_str;
+ } else {
+ return NULL;
+ }
+ }
+
+ if (!pos->file)
+ fname = "<no-file>";
+ else if (!pos->file->name)
+ fname = "<no-filename>";
+ else if (level > 1)
+ fname = pos->file->name;
+ else {
+ fname = shorten_to_initial_path(pos->file->name);
+ if (fname)
+ fresh_fname = true;
+ else
+ fname = pos->file->name;
+ }
+
+ if (level > 1)
+ xasprintf(&first, "%s:%d:%d-%d:%d", fname,
+ pos->first_line, pos->first_column,
+ pos->last_line, pos->last_column);
+ else
+ xasprintf(&first, "%s:%d", fname,
+ first_line ? pos->first_line : pos->last_line);
+
+ if (fresh_fname)
+ free(fname);
+
+ if (pos->next != NULL) {
+ rest = srcpos_string_comment(pos->next, first_line, level);
+ xasprintf(&pos_str, "%s, %s", first, rest);
+ free(first);
+ free(rest);
+ } else {
+ pos_str = first;
+ }
+
+ return pos_str;
+}
+
+char *srcpos_string_first(struct srcpos *pos, int level)
+{
+ return srcpos_string_comment(pos, true, level);
+}
+
+char *srcpos_string_last(struct srcpos *pos, int level)
+{
+ return srcpos_string_comment(pos, false, level);
+}
+
void srcpos_verror(struct srcpos *pos, const char *prefix,
const char *fmt, va_list va)
{
@@ -301,4 +400,9 @@ void srcpos_set_line(char *f, int l)
{
current_srcfile->name = f;
current_srcfile->lineno = l;
+
+ if (initial_cpp) {
+ initial_cpp = false;
+ set_initial_path(f);
+ }
}
Index: src/external/gpl2/dtc/dist/util.h
diff -u src/external/gpl2/dtc/dist/util.h:1.3 src/external/gpl2/dtc/dist/util.h:1.4
--- src/external/gpl2/dtc/dist/util.h:1.3 Thu Jun 8 16:00:40 2017
+++ src/external/gpl2/dtc/dist/util.h Sun Dec 22 12:38:24 2019
@@ -1,7 +1,8 @@
-/* $NetBSD: util.h,v 1.3 2017/06/08 16:00:40 skrll Exp $ */
+/* $NetBSD: util.h,v 1.4 2019/12/22 12:38:24 skrll Exp $ */
-#ifndef _UTIL_H
-#define _UTIL_H
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef UTIL_H
+#define UTIL_H
#include <stdarg.h>
#include <stdbool.h>
@@ -10,21 +11,6 @@
/*
* Copyright 2011 The Chromium Authors, All Rights Reserved.
* Copyright 2008 Jon Loeliger, Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
*/
#ifdef __GNUC__
@@ -39,6 +25,9 @@
#define FDTALIGN2(x, a) (((x) + (a) - 1) & ~((a) - 1))
#define PALIGN(p, a) ((void *)(FDTALIGN2((unsigned long)(p), (a))))
+#define stringify(s) stringify_(s)
+#define stringify_(s) #s
+
static inline void NORETURN PRINTF(1, 2) die(const char *str, ...)
{
va_list ap;
@@ -73,6 +62,8 @@ static inline void *xrealloc(void *p, si
extern char *xstrdup(const char *s);
extern int PRINTF(2, 3) xasprintf(char **strp, const char *fmt, ...);
+extern int PRINTF(2, 3) xasprintf_append(char **strp, const char *fmt, ...);
+extern int xavsprintf_append(char **strp, const char *fmt, va_list ap);
extern char *join_path(const char *path, const char *name);
/**
@@ -99,16 +90,10 @@ char get_escape_char(const char *s, int
* stderr.
*
* @param filename The filename to read, or - for stdin
- * @return Pointer to allocated buffer containing fdt, or NULL on error
- */
-char *utilfdt_read(const char *filename);
-
-/**
- * Like utilfdt_read(), but also passes back the size of the file read.
- *
* @param len If non-NULL, the amount of data we managed to read
+ * @return Pointer to allocated buffer containing fdt, or NULL on error
*/
-char *utilfdt_read_len(const char *filename, off_t *len);
+char *utilfdt_read(const char *filename, size_t *len);
/**
* Read a device tree file into a buffer. Does not report errors, but only
@@ -117,23 +102,17 @@ char *utilfdt_read_len(const char *filen
*
* @param filename The filename to read, or - for stdin
* @param buffp Returns pointer to buffer containing fdt
- * @return 0 if ok, else an errno value representing the error
- */
-int utilfdt_read_err(const char *filename, char **buffp);
-
-/**
- * Like utilfdt_read_err(), but also passes back the size of the file read.
- *
* @param len If non-NULL, the amount of data we managed to read
+ * @return 0 if ok, else an errno value representing the error
*/
-int utilfdt_read_err_len(const char *filename, char **buffp, off_t *len);
+int utilfdt_read_err(const char *filename, char **buffp, size_t *len);
/**
* Write a device tree buffer to a file. This will report any errors on
* stderr.
*
* @param filename The filename to write, or - for stdout
- * @param blob Poiner to buffer containing fdt
+ * @param blob Pointer to buffer containing fdt
* @return 0 if ok, -1 on error
*/
int utilfdt_write(const char *filename, const void *blob);
@@ -144,7 +123,7 @@ int utilfdt_write(const char *filename,
* an error message for the user.
*
* @param filename The filename to write, or - for stdout
- * @param blob Poiner to buffer containing fdt
+ * @param blob Pointer to buffer containing fdt
* @return 0 if ok, else an errno value representing the error
*/
int utilfdt_write_err(const char *filename, const void *blob);
@@ -264,4 +243,4 @@ void NORETURN util_usage(const char *err
case 'V': util_version(); \
case '?': usage("unknown option");
-#endif /* _UTIL_H */
+#endif /* UTIL_H */
Index: src/external/gpl2/dtc/dist/flattree.c
diff -u src/external/gpl2/dtc/dist/flattree.c:1.4 src/external/gpl2/dtc/dist/flattree.c:1.5
--- src/external/gpl2/dtc/dist/flattree.c:1.4 Thu Jun 8 17:24:10 2017
+++ src/external/gpl2/dtc/dist/flattree.c Sun Dec 22 12:38:24 2019
@@ -1,23 +1,8 @@
-/* $NetBSD: flattree.c,v 1.4 2017/06/08 17:24:10 skrll Exp $ */
+/* $NetBSD: flattree.c,v 1.5 2019/12/22 12:38:24 skrll Exp $ */
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* (C) Copyright David Gibson <[email protected]>, IBM Corporation. 2005.
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
*/
#include "dtc.h"
@@ -395,7 +380,7 @@ void dt_to_blob(FILE *f, struct dt_info
padlen = 0;
if (quiet < 1)
fprintf(stderr,
- "Warning: blob size %d >= minimum size %d\n",
+ "Warning: blob size %"PRIu32" >= minimum size %d\n",
fdt32_to_cpu(fdt.totalsize), minsize);
}
}
@@ -527,7 +512,7 @@ void dt_to_asm(FILE *f, struct dt_info *
fprintf(f, "/* Memory reserve map from source file */\n");
/*
- * Use .long on high and low halfs of u64s to avoid .quad
+ * Use .long on high and low halves of u64s to avoid .quad
* as it appears .quad isn't available in some assemblers.
*/
for (re = dti->reservelist; re; re = re->next) {
@@ -694,7 +679,7 @@ static struct property *flat_read_proper
val = flat_read_data(dtbuf, proplen);
- return build_property(name, val);
+ return build_property(name, val, NULL);
}
@@ -733,7 +718,7 @@ static char *nodename_from_path(const ch
plen = strlen(ppath);
- if (!strneq(ppath, cpath, plen))
+ if (!strstarts(cpath, ppath))
die("Path \"%s\" is not valid as a child of \"%s\"\n",
cpath, ppath);
@@ -752,7 +737,7 @@ static struct node *unflatten_tree(struc
char *flatname;
uint32_t val;
- node = build_node(NULL, NULL);
+ node = build_node(NULL, NULL, NULL);
flatname = flat_read_string(dtbuf);
Index: src/external/gpl2/dtc/dist/tests/mangle-layout.c
diff -u src/external/gpl2/dtc/dist/tests/mangle-layout.c:1.3 src/external/gpl2/dtc/dist/tests/mangle-layout.c:1.4
--- src/external/gpl2/dtc/dist/tests/mangle-layout.c:1.3 Thu Jun 8 16:00:40 2017
+++ src/external/gpl2/dtc/dist/tests/mangle-layout.c Sun Dec 22 12:38:24 2019
@@ -1,23 +1,10 @@
-/* $NetBSD: mangle-layout.c,v 1.3 2017/06/08 16:00:40 skrll Exp $ */
+/* $NetBSD: mangle-layout.c,v 1.4 2019/12/22 12:38:24 skrll Exp $ */
+// SPDX-License-Identifier: LGPL-2.1-or-later
/*
* libfdt - Flat Device Tree manipulation
* Testcase/tool for rearranging blocks of a dtb
* Copyright (C) 2006 David Gibson, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdlib.h>
@@ -46,13 +33,9 @@ static void expand_buf(struct bufstate *
static void new_header(struct bufstate *buf, int version, const void *fdt)
{
- int hdrsize;
+ int hdrsize = fdt_header_size_(version);
- if (version == 16)
- hdrsize = FDT_V16_SIZE;
- else if (version == 17)
- hdrsize = FDT_V17_SIZE;
- else
+ if ((version != 16) && (version != 17))
CONFIG("Bad version %d", version);
expand_buf(buf, hdrsize);
Index: src/external/gpl2/dtc/dist/tests/move_and_save.c
diff -u src/external/gpl2/dtc/dist/tests/move_and_save.c:1.3 src/external/gpl2/dtc/dist/tests/move_and_save.c:1.4
--- src/external/gpl2/dtc/dist/tests/move_and_save.c:1.3 Thu Jun 8 16:00:40 2017
+++ src/external/gpl2/dtc/dist/tests/move_and_save.c Sun Dec 22 12:38:24 2019
@@ -1,23 +1,10 @@
-/* $NetBSD: move_and_save.c,v 1.3 2017/06/08 16:00:40 skrll Exp $ */
+/* $NetBSD: move_and_save.c,v 1.4 2019/12/22 12:38:24 skrll Exp $ */
+// SPDX-License-Identifier: LGPL-2.1-or-later
/*
* libfdt - Flat Device Tree manipulation
* Basic testcase for read-only access
* Copyright (C) 2006 David Gibson, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdlib.h>
Index: src/external/gpl2/dtc/dist/tests/tests.h
diff -u src/external/gpl2/dtc/dist/tests/tests.h:1.3 src/external/gpl2/dtc/dist/tests/tests.h:1.4
--- src/external/gpl2/dtc/dist/tests/tests.h:1.3 Thu Jun 8 16:00:40 2017
+++ src/external/gpl2/dtc/dist/tests/tests.h Sun Dec 22 12:38:24 2019
@@ -1,25 +1,12 @@
-/* $NetBSD: tests.h,v 1.3 2017/06/08 16:00:40 skrll Exp $ */
+/* $NetBSD: tests.h,v 1.4 2019/12/22 12:38:24 skrll Exp $ */
-#ifndef _TESTS_H
-#define _TESTS_H
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#ifndef TESTS_H
+#define TESTS_H
/*
* libfdt - Flat Device Tree manipulation
* Testcase definitions
* Copyright (C) 2006 David Gibson, IBM Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define DEBUG
@@ -120,7 +107,21 @@ const void *check_getprop(void *fdt, int
})
#define check_getprop_string(fdt, nodeoffset, name, s) \
check_getprop((fdt), (nodeoffset), (name), strlen(s)+1, (s))
+
+/* Returns non-NULL if the property at poffset has the name in_name */
+const void *check_get_prop_offset(void *fdt, int poffset, const char *in_name,
+ int in_len, const void *in_val);
+#define check_get_prop_offset_cell(fdt, poffset, name, val) \
+ ({ \
+ fdt32_t x = cpu_to_fdt32(val); \
+ check_get_prop_offset(fdt, poffset, name, sizeof(x), &x); \
+ })
+
+const void *check_getprop_addrrange(void *fdt, int parent, int nodeoffset,
+ const char *name, int num);
+
int nodename_eq(const char *s1, const char *s2);
+void vg_prepare_blob(void *fdt, size_t bufsize);
void *load_blob(const char *filename);
void *load_blob_arg(int argc, char *argv[]);
void save_blob(const char *filename, void *blob);
@@ -128,4 +129,4 @@ void *open_blob_rw(void *blob);
#include "util.h"
-#endif /* _TESTS_H */
+#endif /* TESTS_H */