Lines Matching +full:prop +full:-
1 // SPDX-License-Identifier: GPL-2.0-or-later
19 if (streq(new->label, label)) { in add_label()
20 new->deleted = 0; in add_label()
26 new->label = label; in add_label()
27 new->next = *labels; in add_label()
36 label->deleted = 1; in delete_labels()
46 new->name = xstrdup(name); in build_property()
47 new->val = val; in build_property()
48 new->srcpos = srcpos_copy(srcpos); in build_property()
59 new->name = xstrdup(name); in build_property_delete()
60 new->deleted = 1; in build_property_delete()
67 assert(first->next == NULL); in chain_property()
69 first->next = list; in chain_property()
80 next = p->next; in reverse_properties()
81 p->next = head; in reverse_properties()
96 new->proplist = reverse_properties(proplist); in build_node()
97 new->children = children; in build_node()
98 new->srcpos = srcpos_copy(srcpos); in build_node()
101 child->parent = new; in build_node()
113 new->deleted = 1; in build_node_delete()
114 new->srcpos = srcpos_copy(srcpos); in build_node_delete()
121 assert(node->name == NULL); in name_node()
123 node->name = xstrdup(name); in name_node()
130 node->omit_if_unused = 1; in omit_node_if_unused()
137 node->is_referenced = 1; in reference_node()
148 old_node->deleted = 0; in merge_nodes()
151 for_each_label_withdel(new_node->labels, l) in merge_nodes()
152 add_label(&old_node->labels, l->label); in merge_nodes()
156 while (new_node->proplist) { in merge_nodes()
158 new_prop = new_node->proplist; in merge_nodes()
159 new_node->proplist = new_prop->next; in merge_nodes()
160 new_prop->next = NULL; in merge_nodes()
162 if (new_prop->deleted) { in merge_nodes()
163 delete_property_by_name(old_node, new_prop->name); in merge_nodes()
170 if (streq(old_prop->name, new_prop->name)) { in merge_nodes()
172 for_each_label_withdel(new_prop->labels, l) in merge_nodes()
173 add_label(&old_prop->labels, l->label); in merge_nodes()
175 old_prop->val = new_prop->val; in merge_nodes()
176 old_prop->deleted = 0; in merge_nodes()
177 free(old_prop->srcpos); in merge_nodes()
178 old_prop->srcpos = new_prop->srcpos; in merge_nodes()
192 while (new_node->children) { in merge_nodes()
194 new_child = new_node->children; in merge_nodes()
195 new_node->children = new_child->next_sibling; in merge_nodes()
196 new_child->parent = NULL; in merge_nodes()
197 new_child->next_sibling = NULL; in merge_nodes()
199 if (new_child->deleted) { in merge_nodes()
200 delete_node_by_name(old_node, new_child->name); in merge_nodes()
207 if (streq(old_child->name, new_child->name)) { in merge_nodes()
219 old_node->srcpos = srcpos_extend(old_node->srcpos, new_node->srcpos); in merge_nodes()
240 p = build_property("target-path", d, NULL); in add_orphan_node()
261 assert(first->next_sibling == NULL); in chain_node()
263 first->next_sibling = list; in chain_node()
267 void add_property(struct node *node, struct property *prop) in add_property() argument
271 prop->next = NULL; in add_property()
273 p = &node->proplist; in add_property()
275 p = &((*p)->next); in add_property()
277 *p = prop; in add_property()
282 struct property *prop = node->proplist; in delete_property_by_name() local
284 while (prop) { in delete_property_by_name()
285 if (streq(prop->name, name)) { in delete_property_by_name()
286 delete_property(prop); in delete_property_by_name()
289 prop = prop->next; in delete_property_by_name()
293 void delete_property(struct property *prop) in delete_property() argument
295 prop->deleted = 1; in delete_property()
296 delete_labels(&prop->labels); in delete_property()
303 child->next_sibling = NULL; in add_child()
304 child->parent = parent; in add_child()
306 p = &parent->children; in add_child()
308 p = &((*p)->next_sibling); in add_child()
315 struct node *node = parent->children; in delete_node_by_name()
318 if (streq(node->name, name)) { in delete_node_by_name()
322 node = node->next_sibling; in delete_node_by_name()
328 struct property *prop; in delete_node() local
331 node->deleted = 1; in delete_node()
334 for_each_property(node, prop) in delete_node()
335 delete_property(prop); in delete_node()
336 delete_labels(&node->labels); in delete_node()
348 d = data_add_marker(p->val, type, name); in append_to_property()
350 p->val = d; in append_to_property()
365 new->address = address; in build_reserve_entry()
366 new->size = size; in build_reserve_entry()
374 assert(first->next == NULL); in chain_reserve_entry()
376 first->next = list; in chain_reserve_entry()
385 new->next = NULL; in add_reserve_entry()
390 for (last = list; last->next; last = last->next) in add_reserve_entry()
393 last->next = new; in add_reserve_entry()
405 dti->dtsflags = dtsflags; in build_dt_info()
406 dti->reservelist = reservelist; in build_dt_info()
407 dti->dt = tree; in build_dt_info()
408 dti->boot_cpuid_phys = boot_cpuid_phys; in build_dt_info()
419 if (node->name[node->basenamelen] == '\0') in get_unitname()
422 return node->name + node->basenamelen + 1; in get_unitname()
427 struct property *prop; in get_property() local
429 for_each_property(node, prop) in get_property()
430 if (streq(prop->name, propname)) in get_property()
431 return prop; in get_property()
436 cell_t propval_cell(struct property *prop) in propval_cell() argument
438 assert(prop->val.len == sizeof(cell_t)); in propval_cell()
439 return fdt32_to_cpu(*((fdt32_t *)prop->val.val)); in propval_cell()
442 cell_t propval_cell_n(struct property *prop, unsigned int n) in propval_cell_n() argument
444 assert(prop->val.len / sizeof(cell_t) > n); in propval_cell_n()
445 return fdt32_to_cpu(*((fdt32_t *)prop->val.val + n)); in propval_cell_n()
451 struct property *prop; in get_property_by_label() local
456 for_each_property(tree, prop) { in get_property_by_label()
459 for_each_label(prop->labels, l) in get_property_by_label()
460 if (streq(l->label, label)) in get_property_by_label()
461 return prop; in get_property_by_label()
465 prop = get_property_by_label(c, label, node); in get_property_by_label()
466 if (prop) in get_property_by_label()
467 return prop; in get_property_by_label()
475 struct node **node, struct property **prop) in get_marker_label() argument
484 *prop = p; in get_marker_label()
485 m = p->val.markers; in get_marker_label()
487 if (streq(m->ref, label)) in get_marker_label()
492 m = get_marker_label(c, label, node, prop); in get_marker_label()
497 *prop = NULL; in get_marker_label()
507 if (streq(child->name, nodename)) in get_subnode()
519 if (tree->deleted) in get_node_by_path()
530 if (p && strprefixeq(path, (size_t)(p - path), child->name)) in get_node_by_path()
532 else if (!p && streq(path, child->name)) in get_node_by_path()
546 for_each_label(tree->labels, l) in get_node_by_label()
547 if (streq(l->label, label)) in get_node_by_label()
568 if (tree->phandle == phandle) { in get_node_by_phandle()
569 if (tree->deleted) in get_node_by_phandle()
601 buf = xstrndup(label, slash - label); in get_node_by_ref()
631 d = data_append_cell(d, node->phandle); in add_phandle_property()
640 if (phandle_is_valid(node->phandle)) in get_node_phandle()
641 return node->phandle; in get_node_phandle()
646 node->phandle = phandle; in get_node_phandle()
652 * be dealing with a self-referencing phandle, which will be in get_node_phandle()
655 return node->phandle; in get_node_phandle()
668 bootcpu = cpus->children; in guess_boot_cpuid()
673 if (!reg || (reg->val.len != sizeof(uint32_t))) in guess_boot_cpuid()
688 if (a->address < b->address) in cmp_reserve_info()
689 return -1; in cmp_reserve_info()
690 else if (a->address > b->address) in cmp_reserve_info()
692 else if (a->size < b->size) in cmp_reserve_info()
693 return -1; in cmp_reserve_info()
694 else if (a->size > b->size) in cmp_reserve_info()
705 for (ri = dti->reservelist; in sort_reserve_entries()
707 ri = ri->next) in sort_reserve_entries()
715 for (ri = dti->reservelist; in sort_reserve_entries()
717 ri = ri->next) in sort_reserve_entries()
722 dti->reservelist = tbl[0]; in sort_reserve_entries()
723 for (i = 0; i < (n-1); i++) in sort_reserve_entries()
724 tbl[i]->next = tbl[i+1]; in sort_reserve_entries()
725 tbl[n-1]->next = NULL; in sort_reserve_entries()
737 return strcmp(a->name, b->name); in cmp_prop()
743 struct property *prop, **tbl; in sort_properties() local
745 for_each_property_withdel(node, prop) in sort_properties()
753 for_each_property_withdel(node, prop) in sort_properties()
754 tbl[i++] = prop; in sort_properties()
758 node->proplist = tbl[0]; in sort_properties()
759 for (i = 0; i < (n-1); i++) in sort_properties()
760 tbl[i]->next = tbl[i+1]; in sort_properties()
761 tbl[n-1]->next = NULL; in sort_properties()
773 return strcmp(a->name, b->name); in cmp_subnode()
794 node->children = tbl[0]; in sort_subnodes()
795 for (i = 0; i < (n-1); i++) in sort_subnodes()
796 tbl[i]->next_sibling = tbl[i+1]; in sort_subnodes()
797 tbl[n-1]->next_sibling = NULL; in sort_subnodes()
815 sort_node(dti->dt); in sort_tree()
848 if (node->labels) in any_label_tree()
862 struct node *dt = dti->dt; in generate_label_tree_internal()
868 if (node->labels) { in generate_label_tree_internal()
871 for_each_label(node->labels, l) { in generate_label_tree_internal()
874 p = get_property(an, l->label); in generate_label_tree_internal()
877 " exists in /%s", l->label, in generate_label_tree_internal()
878 an->name); in generate_label_tree_internal()
883 p = build_property(l->label, in generate_label_tree_internal()
884 data_copy_escape_string(node->fullpath, in generate_label_tree_internal()
885 strlen(node->fullpath)), in generate_label_tree_internal()
902 struct property *prop; in any_fixup_tree() local
905 for_each_property(node, prop) { in any_fixup_tree()
906 m = prop->val.markers; in any_fixup_tree()
908 if (!get_node_by_ref(dti->dt, m->ref)) in any_fixup_tree()
922 struct node *node, struct property *prop, in add_fixup_entry() argument
927 /* m->ref can only be a REF_PHANDLE, but check anyway */ in add_fixup_entry()
928 assert(m->type == REF_PHANDLE); in add_fixup_entry()
932 if (strchr(m->ref, '/')) in add_fixup_entry()
934 m->ref); in add_fixup_entry()
937 if (strchr(node->fullpath, ':') || strchr(prop->name, ':')) in add_fixup_entry()
941 node->fullpath, prop->name, m->offset); in add_fixup_entry()
942 append_to_property(fn, m->ref, entry, strlen(entry) + 1, TYPE_STRING); in add_fixup_entry()
951 struct node *dt = dti->dt; in generate_fixups_tree_internal()
953 struct property *prop; in generate_fixups_tree_internal() local
957 for_each_property(node, prop) { in generate_fixups_tree_internal()
958 m = prop->val.markers; in generate_fixups_tree_internal()
960 refnode = get_node_by_ref(dt, m->ref); in generate_fixups_tree_internal()
962 add_fixup_entry(dti, fn, node, prop, m); in generate_fixups_tree_internal()
973 struct property *prop; in any_local_fixup_tree() local
976 for_each_property(node, prop) { in any_local_fixup_tree()
977 m = prop->val.markers; in any_local_fixup_tree()
979 if (get_node_by_ref(dti->dt, m->ref)) in any_local_fixup_tree()
994 struct property *prop, struct marker *m, in add_local_fixup_entry() argument
1004 for (wn = node; wn; wn = wn->parent) in add_local_fixup_entry()
1011 for (wn = node, i = depth - 1; wn; wn = wn->parent, i--) in add_local_fixup_entry()
1012 compp[i] = wn->name; in add_local_fixup_entry()
1024 value_32 = cpu_to_fdt32(m->offset); in add_local_fixup_entry()
1025 append_to_property(wn, prop->name, &value_32, sizeof(value_32), TYPE_UINT32); in add_local_fixup_entry()
1032 struct node *dt = dti->dt; in generate_local_fixups_tree_internal()
1034 struct property *prop; in generate_local_fixups_tree_internal() local
1038 for_each_property(node, prop) { in generate_local_fixups_tree_internal()
1039 m = prop->val.markers; in generate_local_fixups_tree_internal()
1041 refnode = get_node_by_ref(dt, m->ref); in generate_local_fixups_tree_internal()
1043 add_local_fixup_entry(dti, lfn, node, prop, m, refnode); in generate_local_fixups_tree_internal()
1053 if (!any_label_tree(dti, dti->dt)) in generate_label_tree()
1055 generate_label_tree_internal(dti, build_root_node(dti->dt, name), in generate_label_tree()
1056 dti->dt, allocph); in generate_label_tree()
1061 if (!any_fixup_tree(dti, dti->dt)) in generate_fixups_tree()
1063 generate_fixups_tree_internal(dti, build_root_node(dti->dt, name), in generate_fixups_tree()
1064 dti->dt); in generate_fixups_tree()
1069 if (!any_local_fixup_tree(dti, dti->dt)) in generate_local_fixups_tree()
1071 generate_local_fixups_tree_internal(dti, build_root_node(dti->dt, name), in generate_local_fixups_tree()
1072 dti->dt); in generate_local_fixups_tree()