Lines Matching refs: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()
219 struct node *chain_node(struct node *first, struct node *list) in chain_node()
227 void add_property(struct node *node, struct property *prop) in add_property() argument
233 p = &node->proplist; in add_property()
240 void delete_property_by_name(struct node *node, char *name) in delete_property_by_name() argument
242 struct property *prop = node->proplist; in delete_property_by_name()
259 void add_child(struct node *parent, struct node *child) in add_child()
261 struct node **p; in add_child()
273 void delete_node_by_name(struct node *parent, char *name) in delete_node_by_name()
275 struct node *node = parent->children; in delete_node_by_name() local
277 while (node) { in delete_node_by_name()
278 if (!strcmp(node->name, name)) { in delete_node_by_name()
279 delete_node(node); in delete_node_by_name()
282 node = node->next_sibling; in delete_node_by_name()
286 void delete_node(struct node *node) in delete_node() argument
289 struct node *child; in delete_node()
291 node->deleted = 1; in delete_node()
292 for_each_child(node, child) in delete_node()
294 for_each_property(node, prop) in delete_node()
296 delete_labels(&node->labels); in delete_node()
299 void append_to_property(struct node *node, in append_to_property() argument
305 p = get_property(node, name); in append_to_property()
312 add_property(node, p); in append_to_property()
357 struct node *tree, uint32_t boot_cpuid_phys) in build_dt_info()
374 const char *get_unitname(struct node *node) in get_unitname() argument
376 if (node->name[node->basenamelen] == '\0') in get_unitname()
379 return node->name + node->basenamelen + 1; in get_unitname()
382 struct property *get_property(struct node *node, const char *propname) in get_property() argument
386 for_each_property(node, prop) in get_property()
399 struct property *get_property_by_label(struct node *tree, const char *label, in get_property_by_label()
400 struct node **node) in get_property_by_label() argument
403 struct node *c; in get_property_by_label()
405 *node = tree; in get_property_by_label()
416 prop = get_property_by_label(c, label, node); in get_property_by_label()
421 *node = NULL; in get_property_by_label()
425 struct marker *get_marker_label(struct node *tree, const char *label, in get_marker_label()
426 struct node **node, struct property **prop) in get_marker_label() argument
430 struct node *c; in get_marker_label()
432 *node = tree; in get_marker_label()
443 m = get_marker_label(c, label, node, prop); in get_marker_label()
449 *node = NULL; in get_marker_label()
453 struct node *get_subnode(struct node *node, const char *nodename) in get_subnode() argument
455 struct node *child; in get_subnode()
457 for_each_child(node, child) in get_subnode()
464 struct node *get_node_by_path(struct node *tree, const char *path) in get_node_by_path()
467 struct node *child; in get_node_by_path()
490 struct node *get_node_by_label(struct node *tree, const char *label) in get_node_by_label()
492 struct node *child, *node; in get_node_by_label() local
502 node = get_node_by_label(child, label); in get_node_by_label()
503 if (node) in get_node_by_label()
504 return node; in get_node_by_label()
510 struct node *get_node_by_phandle(struct node *tree, cell_t phandle) in get_node_by_phandle()
512 struct node *child, *node; in get_node_by_phandle() local
523 node = get_node_by_phandle(child, phandle); in get_node_by_phandle()
524 if (node) in get_node_by_phandle()
525 return node; in get_node_by_phandle()
531 struct node *get_node_by_ref(struct node *tree, const char *ref) in get_node_by_ref()
541 cell_t get_node_phandle(struct node *root, struct node *node) in get_node_phandle() argument
545 if ((node->phandle != 0) && (node->phandle != -1)) in get_node_phandle()
546 return node->phandle; in get_node_phandle()
551 node->phandle = phandle; in get_node_phandle()
553 if (!get_property(node, "linux,phandle") in get_node_phandle()
555 add_property(node, in get_node_phandle()
559 if (!get_property(node, "phandle") in get_node_phandle()
561 add_property(node, in get_node_phandle()
569 return node->phandle; in get_node_phandle()
572 uint32_t guess_boot_cpuid(struct node *tree) in guess_boot_cpuid()
574 struct node *cpus, *bootcpu; in guess_boot_cpuid()
654 static void sort_properties(struct node *node) in sort_properties() argument
659 for_each_property_withdel(node, prop) in sort_properties()
667 for_each_property_withdel(node, prop) in sort_properties()
672 node->proplist = tbl[0]; in sort_properties()
682 const struct node *a, *b; in cmp_subnode()
684 a = *((const struct node * const *)ax); in cmp_subnode()
685 b = *((const struct node * const *)bx); in cmp_subnode()
690 static void sort_subnodes(struct node *node) in sort_subnodes() argument
693 struct node *subnode, **tbl; in sort_subnodes()
695 for_each_child_withdel(node, subnode) in sort_subnodes()
703 for_each_child_withdel(node, subnode) in sort_subnodes()
708 node->children = tbl[0]; in sort_subnodes()
716 static void sort_node(struct node *node) in sort_node() argument
718 struct node *c; in sort_node()
720 sort_properties(node); in sort_node()
721 sort_subnodes(node); in sort_node()
722 for_each_child_withdel(node, c) in sort_node()
733 static struct node *build_and_name_child_node(struct node *parent, char *name) in build_and_name_child_node()
735 struct node *node; in build_and_name_child_node() local
737 node = build_node(NULL, NULL); in build_and_name_child_node()
738 name_node(node, xstrdup(name)); in build_and_name_child_node()
739 add_child(parent, node); in build_and_name_child_node()
741 return node; in build_and_name_child_node()
744 static struct node *build_root_node(struct node *dt, char *name) in build_root_node()
746 struct node *an; in build_root_node()
758 static bool any_label_tree(struct dt_info *dti, struct node *node) in any_label_tree() argument
760 struct node *c; in any_label_tree()
762 if (node->labels) in any_label_tree()
765 for_each_child(node, c) in any_label_tree()
773 struct node *an, struct node *node, in generate_label_tree_internal() argument
776 struct node *dt = dti->dt; in generate_label_tree_internal()
777 struct node *c; in generate_label_tree_internal()
782 if (node->labels) { in generate_label_tree_internal()
785 for_each_label(node->labels, l) { in generate_label_tree_internal()
798 data_copy_mem(node->fullpath, in generate_label_tree_internal()
799 strlen(node->fullpath) + 1)); in generate_label_tree_internal()
805 (void)get_node_phandle(dt, node); in generate_label_tree_internal()
808 for_each_child(node, c) in generate_label_tree_internal()
812 static bool any_fixup_tree(struct dt_info *dti, struct node *node) in any_fixup_tree() argument
814 struct node *c; in any_fixup_tree()
818 for_each_property(node, prop) { in any_fixup_tree()
826 for_each_child(node, c) { in any_fixup_tree()
834 static void add_fixup_entry(struct dt_info *dti, struct node *fn, in add_fixup_entry()
835 struct node *node, struct property *prop, in add_fixup_entry() argument
844 if (strchr(node->fullpath, ':') || strchr(prop->name, ':')) in add_fixup_entry()
848 node->fullpath, prop->name, m->offset); in add_fixup_entry()
853 struct node *fn, in generate_fixups_tree_internal()
854 struct node *node) in generate_fixups_tree_internal() argument
856 struct node *dt = dti->dt; in generate_fixups_tree_internal()
857 struct node *c; in generate_fixups_tree_internal()
860 struct node *refnode; in generate_fixups_tree_internal()
862 for_each_property(node, prop) { in generate_fixups_tree_internal()
867 add_fixup_entry(dti, fn, node, prop, m); in generate_fixups_tree_internal()
871 for_each_child(node, c) in generate_fixups_tree_internal()
875 static bool any_local_fixup_tree(struct dt_info *dti, struct node *node) in any_local_fixup_tree() argument
877 struct node *c; in any_local_fixup_tree()
881 for_each_property(node, prop) { in any_local_fixup_tree()
889 for_each_child(node, c) { in any_local_fixup_tree()
898 struct node *lfn, struct node *node, in add_local_fixup_entry() argument
900 struct node *refnode) in add_local_fixup_entry()
902 struct node *wn, *nwn; /* local fixup node, walk node, new */ in add_local_fixup_entry()
909 for (wn = node; wn; wn = wn->parent) in add_local_fixup_entry()
916 for (wn = node, i = depth - 1; wn; wn = wn->parent, i--) in add_local_fixup_entry()
934 struct node *lfn, in generate_local_fixups_tree_internal()
935 struct node *node) in generate_local_fixups_tree_internal() argument
937 struct node *dt = dti->dt; in generate_local_fixups_tree_internal()
938 struct node *c; in generate_local_fixups_tree_internal()
941 struct node *refnode; in generate_local_fixups_tree_internal()
943 for_each_property(node, prop) { in generate_local_fixups_tree_internal()
948 add_local_fixup_entry(dti, lfn, node, prop, m, refnode); in generate_local_fixups_tree_internal()
952 for_each_child(node, c) in generate_local_fixups_tree_internal()