summaryrefslogtreecommitdiffstats
path: root/scripts/dtc/livetree.c
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2018-11-28 19:37:35 -0500
committerRob Herring <robh@kernel.org>2018-11-28 19:37:35 -0500
commitc2e7075ca83036317cee4a564729eb82a5433169 (patch)
tree3172d34d5620eaa9066c0934410b4eeb33d37269 /scripts/dtc/livetree.c
parente8b1dee21420f871e300d46342f2c98a2e08158d (diff)
scripts/dtc: Update to upstream version v1.4.7-57-gf267e674d145
This adds the following commits from upstream: f267e674d145 checks: Fix crash with multiple source annotations 3616b9a811b6 checks: Use source position information for check failures 2bdbd07a1223 checks: Make each message output atomic a1eff70c02cf util: Add xa{v}sprintf_append functions 82a52ce4573b libfdt: Add a test for fdt_getprop_by_offset() 607b8586b383 PEP8 / Flake8 cleanups for setup.py f9c0a425b648 Remove broken objdir / srcdir support 5182b5e6f28c pylibfdt: Use common PREFIX variable d45bf1f5f2a6 Refine make tests_clean target 99284c4db9cb Refine pylibfdt_clean target a4629cfaedfb Refine libfdt_clean target 08380fc43aa2 tests: Use modern octal literals for Python 8113c00b99d3 pylibfdt: Allow switch to Python 3 via environment variable PYTHON 11738cf01f15 libfdt: Don't use memcpy to handle unaligned reads on ARM 86a288a73670 checks: Restructure check_msg to decrease indentation 5667e7ef9a9a annotations: add the annotation functionality 8e20ccf52f90 annotations: add positions ca930e20bb54 tests: Don't lose errors from make checkm 43366bb4eeee tests: Property count valgrind errors in wrapped tests 5062516fb8cb srcpos: Remove srcpos_empty a3143fafbf83 Revert "annotations: add positions" 403cc79f06a1 checks: Update SPI bus check for 'spi-slave' baa1d2cf7894 annotations: add positions ff2ad38f6a5a Merge remote-tracking branch 'origin/pr/18' aa7254d9cb17 libfdt: return correct value if #size-cells property is not present 49903aed7783 use ptrdiff_t modifier for printing pointer differences da2b691ccf68 treesource: Fix dts output for phandles in middle of a sequence of ints 8f8b77a0d62d tests: Wrap check_align() calls with base_run_test() 522d81d572f2 Fix dts output with a REF_PATH marker e45198c98359 Added test cases for target references 0fcffda15e9f Merge nodes with local target label references 1e4a0928f3b3 pylibfdt: Don't have setup.py depend on where it's invoked from ca399b14956f pylibfdt: Eliminate run_setup make function 98972f1b3e33 pylibfdt: Improved version extraction 7ba2be6cda5f pylibfdt: Don't silence setup.py when V=1 7691f9d39301 pylibfdt: Make SETUP make variable 855b9963def9 pylibfdt: Simpler CFLAGS handling 47cafbeeb977 pylibfdt: Link extension module with libfdt rather than rebuilding dd695d6afb19 pylibfdt: Correctly set build output directory 59327523d0d8 pylibfdt: We don't need include files from the base directory e84742aa7b93 checks: fix simple-bus compatible matching 8c59a97ce096 Fix missing labels when emitting dts format d448f9a5fd94 Revert dts output formatting changes of spaces around brackets Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'scripts/dtc/livetree.c')
-rw-r--r--scripts/dtc/livetree.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c
index 4ff0679e0062..7a2e6446a17b 100644
--- a/scripts/dtc/livetree.c
+++ b/scripts/dtc/livetree.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include "dtc.h" 21#include "dtc.h"
22#include "srcpos.h"
22 23
23/* 24/*
24 * Tree building functions 25 * Tree building functions
@@ -50,7 +51,8 @@ void delete_labels(struct label **labels)
50 label->deleted = 1; 51 label->deleted = 1;
51} 52}
52 53
53struct property *build_property(char *name, struct data val) 54struct property *build_property(char *name, struct data val,
55 struct srcpos *srcpos)
54{ 56{
55 struct property *new = xmalloc(sizeof(*new)); 57 struct property *new = xmalloc(sizeof(*new));
56 58
@@ -58,6 +60,7 @@ struct property *build_property(char *name, struct data val)
58 60
59 new->name = name; 61 new->name = name;
60 new->val = val; 62 new->val = val;
63 new->srcpos = srcpos_copy(srcpos);
61 64
62 return new; 65 return new;
63} 66}
@@ -97,7 +100,8 @@ struct property *reverse_properties(struct property *first)
97 return head; 100 return head;
98} 101}
99 102
100struct node *build_node(struct property *proplist, struct node *children) 103struct node *build_node(struct property *proplist, struct node *children,
104 struct srcpos *srcpos)
101{ 105{
102 struct node *new = xmalloc(sizeof(*new)); 106 struct node *new = xmalloc(sizeof(*new));
103 struct node *child; 107 struct node *child;
@@ -106,6 +110,7 @@ struct node *build_node(struct property *proplist, struct node *children)
106 110
107 new->proplist = reverse_properties(proplist); 111 new->proplist = reverse_properties(proplist);
108 new->children = children; 112 new->children = children;
113 new->srcpos = srcpos_copy(srcpos);
109 114
110 for_each_child(new, child) { 115 for_each_child(new, child) {
111 child->parent = new; 116 child->parent = new;
@@ -114,13 +119,14 @@ struct node *build_node(struct property *proplist, struct node *children)
114 return new; 119 return new;
115} 120}
116 121
117struct node *build_node_delete(void) 122struct node *build_node_delete(struct srcpos *srcpos)
118{ 123{
119 struct node *new = xmalloc(sizeof(*new)); 124 struct node *new = xmalloc(sizeof(*new));
120 125
121 memset(new, 0, sizeof(*new)); 126 memset(new, 0, sizeof(*new));
122 127
123 new->deleted = 1; 128 new->deleted = 1;
129 new->srcpos = srcpos_copy(srcpos);
124 130
125 return new; 131 return new;
126} 132}
@@ -183,6 +189,8 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node)
183 189
184 old_prop->val = new_prop->val; 190 old_prop->val = new_prop->val;
185 old_prop->deleted = 0; 191 old_prop->deleted = 0;
192 free(old_prop->srcpos);
193 old_prop->srcpos = new_prop->srcpos;
186 free(new_prop); 194 free(new_prop);
187 new_prop = NULL; 195 new_prop = NULL;
188 break; 196 break;
@@ -223,6 +231,8 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node)
223 add_child(old_node, new_child); 231 add_child(old_node, new_child);
224 } 232 }
225 233
234 old_node->srcpos = srcpos_extend(old_node->srcpos, new_node->srcpos);
235
226 /* The new node contents are now merged into the old node. Free 236 /* The new node contents are now merged into the old node. Free
227 * the new node. */ 237 * the new node. */
228 free(new_node); 238 free(new_node);
@@ -241,18 +251,18 @@ struct node * add_orphan_node(struct node *dt, struct node *new_node, char *ref)
241 if (ref[0] == '/') { 251 if (ref[0] == '/') {
242 d = data_append_data(d, ref, strlen(ref) + 1); 252 d = data_append_data(d, ref, strlen(ref) + 1);
243 253
244 p = build_property("target-path", d); 254 p = build_property("target-path", d, NULL);
245 } else { 255 } else {
246 d = data_add_marker(d, REF_PHANDLE, ref); 256 d = data_add_marker(d, REF_PHANDLE, ref);
247 d = data_append_integer(d, 0xffffffff, 32); 257 d = data_append_integer(d, 0xffffffff, 32);
248 258
249 p = build_property("target", d); 259 p = build_property("target", d, NULL);
250 } 260 }
251 261
252 xasprintf(&name, "fragment@%u", 262 xasprintf(&name, "fragment@%u",
253 next_orphan_fragment++); 263 next_orphan_fragment++);
254 name_node(new_node, "__overlay__"); 264 name_node(new_node, "__overlay__");
255 node = build_node(p, new_node); 265 node = build_node(p, new_node, NULL);
256 name_node(node, name); 266 name_node(node, name);
257 267
258 add_child(dt, node); 268 add_child(dt, node);
@@ -351,7 +361,7 @@ void append_to_property(struct node *node,
351 p->val = d; 361 p->val = d;
352 } else { 362 } else {
353 d = data_append_data(empty_data, data, len); 363 d = data_append_data(empty_data, data, len);
354 p = build_property(name, d); 364 p = build_property(name, d, NULL);
355 add_property(node, p); 365 add_property(node, p);
356 } 366 }
357} 367}
@@ -609,11 +619,11 @@ cell_t get_node_phandle(struct node *root, struct node *node)
609 619
610 if (!get_property(node, "linux,phandle") 620 if (!get_property(node, "linux,phandle")
611 && (phandle_format & PHANDLE_LEGACY)) 621 && (phandle_format & PHANDLE_LEGACY))
612 add_property(node, build_property("linux,phandle", d)); 622 add_property(node, build_property("linux,phandle", d, NULL));
613 623
614 if (!get_property(node, "phandle") 624 if (!get_property(node, "phandle")
615 && (phandle_format & PHANDLE_EPAPR)) 625 && (phandle_format & PHANDLE_EPAPR))
616 add_property(node, build_property("phandle", d)); 626 add_property(node, build_property("phandle", d, NULL));
617 627
618 /* If the node *does* have a phandle property, we must 628 /* If the node *does* have a phandle property, we must
619 * be dealing with a self-referencing phandle, which will be 629 * be dealing with a self-referencing phandle, which will be
@@ -787,7 +797,7 @@ static struct node *build_and_name_child_node(struct node *parent, char *name)
787{ 797{
788 struct node *node; 798 struct node *node;
789 799
790 node = build_node(NULL, NULL); 800 node = build_node(NULL, NULL, NULL);
791 name_node(node, xstrdup(name)); 801 name_node(node, xstrdup(name));
792 add_child(parent, node); 802 add_child(parent, node);
793 803
@@ -849,7 +859,8 @@ static void generate_label_tree_internal(struct dt_info *dti,
849 /* insert it */ 859 /* insert it */
850 p = build_property(l->label, 860 p = build_property(l->label,
851 data_copy_mem(node->fullpath, 861 data_copy_mem(node->fullpath,
852 strlen(node->fullpath) + 1)); 862 strlen(node->fullpath) + 1),
863 NULL);
853 add_property(an, p); 864 add_property(an, p);
854 } 865 }
855 866