Lines Matching refs:node
88 struct node *build_node(struct property *proplist, struct node *children, in build_node()
91 struct node *new = xmalloc(sizeof(*new)); in build_node()
92 struct node *child; in build_node()
107 struct node *build_node_delete(struct srcpos *srcpos) in build_node_delete()
109 struct node *new = xmalloc(sizeof(*new)); in build_node_delete()
119 struct node *name_node(struct node *node, char *name) in name_node() argument
121 assert(node->name == NULL); in name_node()
123 node->name = name; in name_node()
125 return node; in name_node()
128 struct node *omit_node_if_unused(struct node *node) in omit_node_if_unused() argument
130 node->omit_if_unused = 1; in omit_node_if_unused()
132 return node; in omit_node_if_unused()
135 struct node *reference_node(struct node *node) in reference_node() argument
137 node->is_referenced = 1; in reference_node()
139 return node; in reference_node()
142 struct node *merge_nodes(struct node *old_node, struct node *new_node) in merge_nodes()
145 struct node *new_child, *old_child; in merge_nodes()
228 struct node * add_orphan_node(struct node *dt, struct node *new_node, char *ref) in add_orphan_node()
231 struct node *node; in add_orphan_node() local
251 node = build_node(p, new_node, NULL); in add_orphan_node()
252 name_node(node, name); in add_orphan_node()
254 add_child(dt, node); in add_orphan_node()
258 struct node *chain_node(struct node *first, struct node *list) in chain_node()
266 void add_property(struct node *node, struct property *prop) in add_property() argument
272 p = &node->proplist; in add_property()
279 void delete_property_by_name(struct node *node, char *name) in delete_property_by_name() argument
281 struct property *prop = node->proplist; in delete_property_by_name()
298 void add_child(struct node *parent, struct node *child) in add_child()
300 struct node **p; in add_child()
312 void delete_node_by_name(struct node *parent, char *name) in delete_node_by_name()
314 struct node *node = parent->children; in delete_node_by_name() local
316 while (node) { in delete_node_by_name()
317 if (streq(node->name, name)) { in delete_node_by_name()
318 delete_node(node); in delete_node_by_name()
321 node = node->next_sibling; in delete_node_by_name()
325 void delete_node(struct node *node) in delete_node() argument
328 struct node *child; in delete_node()
330 node->deleted = 1; in delete_node()
331 for_each_child(node, child) in delete_node()
333 for_each_property(node, prop) in delete_node()
335 delete_labels(&node->labels); in delete_node()
338 void append_to_property(struct node *node, in append_to_property() argument
345 p = get_property(node, name); in append_to_property()
354 add_property(node, p); in append_to_property()
399 struct node *tree, uint32_t boot_cpuid_phys) in build_dt_info()
416 const char *get_unitname(struct node *node) in get_unitname() argument
418 if (node->name[node->basenamelen] == '\0') in get_unitname()
421 return node->name + node->basenamelen + 1; in get_unitname()
424 struct property *get_property(struct node *node, const char *propname) in get_property() argument
428 for_each_property(node, prop) in get_property()
447 struct property *get_property_by_label(struct node *tree, const char *label, in get_property_by_label()
448 struct node **node) in get_property_by_label() argument
451 struct node *c; in get_property_by_label()
453 *node = tree; in get_property_by_label()
464 prop = get_property_by_label(c, label, node); in get_property_by_label()
469 *node = NULL; in get_property_by_label()
473 struct marker *get_marker_label(struct node *tree, const char *label, in get_marker_label()
474 struct node **node, struct property **prop) in get_marker_label() argument
478 struct node *c; in get_marker_label()
480 *node = tree; in get_marker_label()
491 m = get_marker_label(c, label, node, prop); in get_marker_label()
497 *node = NULL; in get_marker_label()
501 struct node *get_subnode(struct node *node, const char *nodename) in get_subnode() argument
503 struct node *child; in get_subnode()
505 for_each_child(node, child) in get_subnode()
512 struct node *get_node_by_path(struct node *tree, const char *path) in get_node_by_path()
515 struct node *child; in get_node_by_path()
538 struct node *get_node_by_label(struct node *tree, const char *label) in get_node_by_label()
540 struct node *child, *node; in get_node_by_label() local
550 node = get_node_by_label(child, label); in get_node_by_label()
551 if (node) in get_node_by_label()
552 return node; in get_node_by_label()
558 struct node *get_node_by_phandle(struct node *tree, cell_t phandle) in get_node_by_phandle()
560 struct node *child, *node; in get_node_by_phandle() local
574 node = get_node_by_phandle(child, phandle); in get_node_by_phandle()
575 if (node) in get_node_by_phandle()
576 return node; in get_node_by_phandle()
582 struct node *get_node_by_ref(struct node *tree, const char *ref) in get_node_by_ref()
584 struct node *target = tree; in get_node_by_ref()
619 cell_t get_node_phandle(struct node *root, struct node *node) in get_node_phandle() argument
624 if (phandle_is_valid(node->phandle)) in get_node_phandle()
625 return node->phandle; in get_node_phandle()
630 node->phandle = phandle; in get_node_phandle()
635 if (!get_property(node, "linux,phandle") in get_node_phandle()
637 add_property(node, build_property("linux,phandle", d, NULL)); in get_node_phandle()
639 if (!get_property(node, "phandle") in get_node_phandle()
641 add_property(node, build_property("phandle", d, NULL)); in get_node_phandle()
647 return node->phandle; in get_node_phandle()
650 uint32_t guess_boot_cpuid(struct node *tree) in guess_boot_cpuid()
652 struct node *cpus, *bootcpu; in guess_boot_cpuid()
732 static void sort_properties(struct node *node) in sort_properties() argument
737 for_each_property_withdel(node, prop) in sort_properties()
745 for_each_property_withdel(node, prop) in sort_properties()
750 node->proplist = tbl[0]; in sort_properties()
760 const struct node *a, *b; in cmp_subnode()
762 a = *((const struct node * const *)ax); in cmp_subnode()
763 b = *((const struct node * const *)bx); in cmp_subnode()
768 static void sort_subnodes(struct node *node) in sort_subnodes() argument
771 struct node *subnode, **tbl; in sort_subnodes()
773 for_each_child_withdel(node, subnode) in sort_subnodes()
781 for_each_child_withdel(node, subnode) in sort_subnodes()
786 node->children = tbl[0]; in sort_subnodes()
794 static void sort_node(struct node *node) in sort_node() argument
796 struct node *c; in sort_node()
798 sort_properties(node); in sort_node()
799 sort_subnodes(node); in sort_node()
800 for_each_child_withdel(node, c) in sort_node()
811 static struct node *build_and_name_child_node(struct node *parent, char *name) in build_and_name_child_node()
813 struct node *node; in build_and_name_child_node() local
815 node = build_node(NULL, NULL, NULL); in build_and_name_child_node()
816 name_node(node, xstrdup(name)); in build_and_name_child_node()
817 add_child(parent, node); in build_and_name_child_node()
819 return node; in build_and_name_child_node()
822 static struct node *build_root_node(struct node *dt, char *name) in build_root_node()
824 struct node *an; in build_root_node()
836 static bool any_label_tree(struct dt_info *dti, struct node *node) in any_label_tree() argument
838 struct node *c; in any_label_tree()
840 if (node->labels) in any_label_tree()
843 for_each_child(node, c) in any_label_tree()
851 struct node *an, struct node *node, in generate_label_tree_internal() argument
854 struct node *dt = dti->dt; in generate_label_tree_internal()
855 struct node *c; in generate_label_tree_internal()
860 if (node->labels) { in generate_label_tree_internal()
863 for_each_label(node->labels, l) { in generate_label_tree_internal()
876 data_copy_escape_string(node->fullpath, in generate_label_tree_internal()
877 strlen(node->fullpath)), in generate_label_tree_internal()
884 (void)get_node_phandle(dt, node); in generate_label_tree_internal()
887 for_each_child(node, c) in generate_label_tree_internal()
891 static bool any_fixup_tree(struct dt_info *dti, struct node *node) in any_fixup_tree() argument
893 struct node *c; in any_fixup_tree()
897 for_each_property(node, prop) { in any_fixup_tree()
905 for_each_child(node, c) { in any_fixup_tree()
913 static void add_fixup_entry(struct dt_info *dti, struct node *fn, in add_fixup_entry()
914 struct node *node, struct property *prop, in add_fixup_entry() argument
929 if (strchr(node->fullpath, ':') || strchr(prop->name, ':')) in add_fixup_entry()
933 node->fullpath, prop->name, m->offset); in add_fixup_entry()
940 struct node *fn, in generate_fixups_tree_internal()
941 struct node *node) in generate_fixups_tree_internal() argument
943 struct node *dt = dti->dt; in generate_fixups_tree_internal()
944 struct node *c; in generate_fixups_tree_internal()
947 struct node *refnode; in generate_fixups_tree_internal()
949 for_each_property(node, prop) { in generate_fixups_tree_internal()
954 add_fixup_entry(dti, fn, node, prop, m); in generate_fixups_tree_internal()
958 for_each_child(node, c) in generate_fixups_tree_internal()
962 static bool any_local_fixup_tree(struct dt_info *dti, struct node *node) in any_local_fixup_tree() argument
964 struct node *c; in any_local_fixup_tree()
968 for_each_property(node, prop) { in any_local_fixup_tree()
976 for_each_child(node, c) { in any_local_fixup_tree()
985 struct node *lfn, struct node *node, in add_local_fixup_entry() argument
987 struct node *refnode) in add_local_fixup_entry()
989 struct node *wn, *nwn; /* local fixup node, walk node, new */ in add_local_fixup_entry()
996 for (wn = node; wn; wn = wn->parent) in add_local_fixup_entry()
1003 for (wn = node, i = depth - 1; wn; wn = wn->parent, i--) in add_local_fixup_entry()
1021 struct node *lfn, in generate_local_fixups_tree_internal()
1022 struct node *node) in generate_local_fixups_tree_internal() argument
1024 struct node *dt = dti->dt; in generate_local_fixups_tree_internal()
1025 struct node *c; in generate_local_fixups_tree_internal()
1028 struct node *refnode; in generate_local_fixups_tree_internal()
1030 for_each_property(node, prop) { in generate_local_fixups_tree_internal()
1035 add_local_fixup_entry(dti, lfn, node, prop, m, refnode); in generate_local_fixups_tree_internal()
1039 for_each_child(node, c) in generate_local_fixups_tree_internal()