• Home
  • Raw
  • Download

Lines Matching refs:tree

53 void ufdt_destruct(struct ufdt *tree, struct ufdt_node_pool *pool) {  in ufdt_destruct()  argument
54 if (tree == NULL) return; in ufdt_destruct()
56 ufdt_node_destruct(tree->root, pool); in ufdt_destruct()
58 dto_free(tree->fdtps); in ufdt_destruct()
59 dto_free(tree->phandle_table.data); in ufdt_destruct()
60 dto_free(tree); in ufdt_destruct()
63 int ufdt_add_fdt(struct ufdt *tree, void *fdtp) { in ufdt_add_fdt() argument
68 int i = tree->num_used_fdtps; in ufdt_add_fdt()
69 if (i >= tree->mem_size_fdtps) { in ufdt_add_fdt()
70 int new_size = tree->mem_size_fdtps * 2; in ufdt_add_fdt()
74 dto_memcpy(new_fdtps, tree->fdtps, sizeof(void *) * tree->mem_size_fdtps); in ufdt_add_fdt()
75 dto_free(tree->fdtps); in ufdt_add_fdt()
77 tree->fdtps = new_fdtps; in ufdt_add_fdt()
78 tree->mem_size_fdtps = new_size; in ufdt_add_fdt()
81 tree->fdtps[i] = fdtp; in ufdt_add_fdt()
82 tree->num_used_fdtps = i + 1; in ufdt_add_fdt()
87 int ufdt_get_string_off(const struct ufdt *tree, const char *s) { in ufdt_get_string_off() argument
93 for (int i = 0; i < tree->num_used_fdtps; i++) { in ufdt_get_string_off()
94 void *fdt = tree->fdtps[i]; in ufdt_get_string_off()
166 void ufdt_print(struct ufdt *tree) { in ufdt_print() argument
167 ufdt_node_print(tree->root, 0); in ufdt_print()
170 struct ufdt_node *ufdt_get_node_by_path_len(struct ufdt *tree, const char *path, in ufdt_get_node_by_path_len() argument
191 ufdt_node_get_node_by_path(tree->root, "/aliases"); in ufdt_get_node_by_path_len()
205 ufdt_node_get_node_by_path_len(tree->root, alias_path, path_len); in ufdt_get_node_by_path_len()
210 return ufdt_node_get_node_by_path_len(tree->root, path, len); in ufdt_get_node_by_path_len()
213 struct ufdt_node *ufdt_get_node_by_path(struct ufdt *tree, const char *path) { in ufdt_get_node_by_path() argument
214 return ufdt_get_node_by_path_len(tree, path, dto_strlen(path)); in ufdt_get_node_by_path()
217 struct ufdt_node *ufdt_get_node_by_phandle(struct ufdt *tree, in ufdt_get_node_by_phandle() argument
224 int s = 0, e = tree->phandle_table.len; in ufdt_get_node_by_phandle()
227 uint32_t mid_phandle = tree->phandle_table.data[mid].phandle; in ufdt_get_node_by_phandle()
233 if (e - s > 0 && tree->phandle_table.data[s].phandle == phandle) { in ufdt_get_node_by_phandle()
234 res = tree->phandle_table.data[s].node; in ufdt_get_node_by_phandle()
275 struct ufdt_static_phandle_table build_phandle_table(struct ufdt *tree) { in build_phandle_table() argument
277 res.len = count_phandle_node(tree->root); in build_phandle_table()
280 set_phandle_table_entry(tree->root, res.data, &cur); in build_phandle_table()
306 static int _ufdt_get_property_nameoff(const struct ufdt *tree, const char *name, in _ufdt_get_property_nameoff() argument
315 res = ufdt_get_string_off(tree, name); in _ufdt_get_property_nameoff()
325 const struct ufdt *tree, void *fdtp, in _ufdt_output_property_to_fdt() argument
327 int nameoff = _ufdt_get_property_nameoff(tree, prop_node->name, dict); in _ufdt_output_property_to_fdt()
356 static int _ufdt_output_node_to_fdt(const struct ufdt *tree, void *fdtp, in _ufdt_output_node_to_fdt() argument
363 tree, fdtp, (const struct ufdt_node_fdt_prop *)node, dict); in _ufdt_output_node_to_fdt()
371 err = _ufdt_output_node_to_fdt(tree, fdtp, *it, dict); in _ufdt_output_node_to_fdt()
376 err = _ufdt_output_node_to_fdt(tree, fdtp, *it, dict); in _ufdt_output_node_to_fdt()
386 static int _ufdt_output_strtab_to_fdt(const struct ufdt *tree, void *fdt) { in _ufdt_output_strtab_to_fdt() argument
395 for (int i = 0; i < tree->num_used_fdtps; i++) { in _ufdt_output_strtab_to_fdt()
396 void *src_fdt = tree->fdtps[i]; in _ufdt_output_strtab_to_fdt()
416 int ufdt_to_fdt(const struct ufdt *tree, void *buf, int buf_size) { in ufdt_to_fdt() argument
417 if (tree->num_used_fdtps == 0) return -1; in ufdt_to_fdt()
425 int n_mem_rsv = fdt_num_mem_rsv(tree->fdtps[0]); in ufdt_to_fdt()
428 fdt_get_mem_rsv(tree->fdtps[0], i, &addr, &size); in ufdt_to_fdt()
435 err = _ufdt_output_strtab_to_fdt(tree, buf); in ufdt_to_fdt()
442 err = _ufdt_output_node_to_fdt(tree, buf, tree->root, &dict); in ufdt_to_fdt()