Lines Matching full:node
100 struct node *build_node(struct property *proplist, struct node *children) in build_node()
102 struct node *new = xmalloc(sizeof(*new)); in build_node()
103 struct node *child; in build_node()
117 struct node *build_node_delete(void) in build_node_delete()
119 struct node *new = xmalloc(sizeof(*new)); in build_node_delete()
128 struct node *name_node(struct node *node, char *name) in name_node() argument
130 assert(node->name == NULL); in name_node()
132 node->name = name; in name_node()
134 return node; in name_node()
137 struct node *merge_nodes(struct node *old_node, struct node *new_node) in merge_nodes()
140 struct node *new_child, *old_child; in merge_nodes()
145 /* Add new node labels to old node */ in merge_nodes()
149 /* Move properties from the new node to the old node. If there in merge_nodes()
178 /* if no collision occurred, add property to the old node. */ in merge_nodes()
183 /* Move the override child nodes into the primary node. If in merge_nodes()
186 /* Pop the child node off the list */ in merge_nodes()
207 /* if no collision occurred, add child to the old node. */ in merge_nodes()
212 /* The new node contents are now merged into the old node. Free in merge_nodes()
213 * the new node. */ in merge_nodes()
219 struct node * add_orphan_node(struct node *dt, struct node *new_node, char *ref) in add_orphan_node()
222 struct node *node; in add_orphan_node() local
235 node = build_node(p, new_node); in add_orphan_node()
236 name_node(node, name); in add_orphan_node()
238 add_child(dt, node); in add_orphan_node()
242 struct node *chain_node(struct node *first, struct node *list) in chain_node()
250 void add_property(struct node *node, struct property *prop) in add_property() argument
256 p = &node->proplist; in add_property()
263 void delete_property_by_name(struct node *node, char *name) in delete_property_by_name() argument
265 struct property *prop = node->proplist; in delete_property_by_name()
282 void add_child(struct node *parent, struct node *child) in add_child()
284 struct node **p; in add_child()
296 void delete_node_by_name(struct node *parent, char *name) in delete_node_by_name()
298 struct node *node = parent->children; in delete_node_by_name() local
300 while (node) { in delete_node_by_name()
301 if (streq(node->name, name)) { in delete_node_by_name()
302 delete_node(node); in delete_node_by_name()
305 node = node->next_sibling; in delete_node_by_name()
309 void delete_node(struct node *node) in delete_node() argument
312 struct node *child; in delete_node()
314 node->deleted = 1; in delete_node()
315 for_each_child(node, child) in delete_node()
317 for_each_property(node, prop) in delete_node()
319 delete_labels(&node->labels); in delete_node()
322 void append_to_property(struct node *node, in append_to_property() argument
328 p = get_property(node, name); in append_to_property()
335 add_property(node, p); in append_to_property()
380 struct node *tree, uint32_t boot_cpuid_phys) in build_dt_info()
397 const char *get_unitname(struct node *node) in get_unitname() argument
399 if (node->name[node->basenamelen] == '\0') in get_unitname()
402 return node->name + node->basenamelen + 1; in get_unitname()
405 struct property *get_property(struct node *node, const char *propname) in get_property() argument
409 for_each_property(node, prop) in get_property()
428 struct property *get_property_by_label(struct node *tree, const char *label, in get_property_by_label()
429 struct node **node) in get_property_by_label() argument
432 struct node *c; in get_property_by_label()
434 *node = tree; in get_property_by_label()
445 prop = get_property_by_label(c, label, node); in get_property_by_label()
450 *node = NULL; in get_property_by_label()
454 struct marker *get_marker_label(struct node *tree, const char *label, in get_marker_label()
455 struct node **node, struct property **prop) in get_marker_label() argument
459 struct node *c; in get_marker_label()
461 *node = tree; in get_marker_label()
472 m = get_marker_label(c, label, node, prop); in get_marker_label()
478 *node = NULL; in get_marker_label()
482 struct node *get_subnode(struct node *node, const char *nodename) in get_subnode() argument
484 struct node *child; in get_subnode()
486 for_each_child(node, child) in get_subnode()
493 struct node *get_node_by_path(struct node *tree, const char *path) in get_node_by_path()
496 struct node *child; in get_node_by_path()
520 struct node *get_node_by_label(struct node *tree, const char *label) in get_node_by_label()
522 struct node *child, *node; in get_node_by_label() local
532 node = get_node_by_label(child, label); in get_node_by_label()
533 if (node) in get_node_by_label()
534 return node; in get_node_by_label()
540 struct node *get_node_by_phandle(struct node *tree, cell_t phandle) in get_node_by_phandle()
542 struct node *child, *node; in get_node_by_phandle() local
556 node = get_node_by_phandle(child, phandle); in get_node_by_phandle()
557 if (node) in get_node_by_phandle()
558 return node; in get_node_by_phandle()
564 struct node *get_node_by_ref(struct node *tree, const char *ref) in get_node_by_ref()
574 cell_t get_node_phandle(struct node *root, struct node *node) in get_node_phandle() argument
578 if ((node->phandle != 0) && (node->phandle != -1)) in get_node_phandle()
579 return node->phandle; in get_node_phandle()
584 node->phandle = phandle; in get_node_phandle()
586 if (!get_property(node, "linux,phandle") in get_node_phandle()
588 add_property(node, in get_node_phandle()
592 if (!get_property(node, "phandle") in get_node_phandle()
594 add_property(node, in get_node_phandle()
598 /* If the node *does* have a phandle property, we must in get_node_phandle()
602 return node->phandle; in get_node_phandle()
605 uint32_t guess_boot_cpuid(struct node *tree) in guess_boot_cpuid()
607 struct node *cpus, *bootcpu; in guess_boot_cpuid()
623 /* FIXME: Sanity check node? */ in guess_boot_cpuid()
687 static void sort_properties(struct node *node) in sort_properties() argument
692 for_each_property_withdel(node, prop) in sort_properties()
700 for_each_property_withdel(node, prop) in sort_properties()
705 node->proplist = tbl[0]; in sort_properties()
715 const struct node *a, *b; in cmp_subnode()
717 a = *((const struct node * const *)ax); in cmp_subnode()
718 b = *((const struct node * const *)bx); in cmp_subnode()
723 static void sort_subnodes(struct node *node) in sort_subnodes() argument
726 struct node *subnode, **tbl; in sort_subnodes()
728 for_each_child_withdel(node, subnode) in sort_subnodes()
736 for_each_child_withdel(node, subnode) in sort_subnodes()
741 node->children = tbl[0]; in sort_subnodes()
749 static void sort_node(struct node *node) in sort_node() argument
751 struct node *c; in sort_node()
753 sort_properties(node); in sort_node()
754 sort_subnodes(node); in sort_node()
755 for_each_child_withdel(node, c) in sort_node()
766 static struct node *build_and_name_child_node(struct node *parent, char *name) in build_and_name_child_node()
768 struct node *node; in build_and_name_child_node() local
770 node = build_node(NULL, NULL); in build_and_name_child_node()
771 name_node(node, xstrdup(name)); in build_and_name_child_node()
772 add_child(parent, node); in build_and_name_child_node()
774 return node; in build_and_name_child_node()
777 static struct node *build_root_node(struct node *dt, char *name) in build_root_node()
779 struct node *an; in build_root_node()
786 die("Could not build root node /%s\n", name); in build_root_node()
791 static bool any_label_tree(struct dt_info *dti, struct node *node) in any_label_tree() argument
793 struct node *c; in any_label_tree()
795 if (node->labels) in any_label_tree()
798 for_each_child(node, c) in any_label_tree()
806 struct node *an, struct node *node, in generate_label_tree_internal() argument
809 struct node *dt = dti->dt; in generate_label_tree_internal()
810 struct node *c; in generate_label_tree_internal()
815 if (node->labels) { in generate_label_tree_internal()
817 /* now add the label in the node */ in generate_label_tree_internal()
818 for_each_label(node->labels, l) { in generate_label_tree_internal()
831 data_copy_mem(node->fullpath, in generate_label_tree_internal()
832 strlen(node->fullpath) + 1)); in generate_label_tree_internal()
836 /* force allocation of a phandle for this node */ in generate_label_tree_internal()
838 (void)get_node_phandle(dt, node); in generate_label_tree_internal()
841 for_each_child(node, c) in generate_label_tree_internal()
845 static bool any_fixup_tree(struct dt_info *dti, struct node *node) in any_fixup_tree() argument
847 struct node *c; in any_fixup_tree()
851 for_each_property(node, prop) { in any_fixup_tree()
859 for_each_child(node, c) { in any_fixup_tree()
867 static void add_fixup_entry(struct dt_info *dti, struct node *fn, in add_fixup_entry()
868 struct node *node, struct property *prop, in add_fixup_entry() argument
877 if (strchr(node->fullpath, ':') || strchr(prop->name, ':')) in add_fixup_entry()
881 node->fullpath, prop->name, m->offset); in add_fixup_entry()
888 struct node *fn, in generate_fixups_tree_internal()
889 struct node *node) in generate_fixups_tree_internal() argument
891 struct node *dt = dti->dt; in generate_fixups_tree_internal()
892 struct node *c; in generate_fixups_tree_internal()
895 struct node *refnode; in generate_fixups_tree_internal()
897 for_each_property(node, prop) { in generate_fixups_tree_internal()
902 add_fixup_entry(dti, fn, node, prop, m); in generate_fixups_tree_internal()
906 for_each_child(node, c) in generate_fixups_tree_internal()
910 static bool any_local_fixup_tree(struct dt_info *dti, struct node *node) in any_local_fixup_tree() argument
912 struct node *c; in any_local_fixup_tree()
916 for_each_property(node, prop) { in any_local_fixup_tree()
924 for_each_child(node, c) { in any_local_fixup_tree()
933 struct node *lfn, struct node *node, in add_local_fixup_entry() argument
935 struct node *refnode) in add_local_fixup_entry()
937 struct node *wn, *nwn; /* local fixup node, walk node, new */ in add_local_fixup_entry()
944 for (wn = node; wn; wn = wn->parent) in add_local_fixup_entry()
951 for (wn = node, i = depth - 1; wn; wn = wn->parent, i--) in add_local_fixup_entry()
956 /* if no node exists, create it */ in add_local_fixup_entry()
969 struct node *lfn, in generate_local_fixups_tree_internal()
970 struct node *node) in generate_local_fixups_tree_internal() argument
972 struct node *dt = dti->dt; in generate_local_fixups_tree_internal()
973 struct node *c; in generate_local_fixups_tree_internal()
976 struct node *refnode; in generate_local_fixups_tree_internal()
978 for_each_property(node, prop) { in generate_local_fixups_tree_internal()
983 add_local_fixup_entry(dti, lfn, node, prop, m, refnode); in generate_local_fixups_tree_internal()
987 for_each_child(node, c) in generate_local_fixups_tree_internal()