Lines Matching refs:dtb_node
65 static int _dtb_node_get_dtb_nodes_list(struct dtb_node *dtb_node_head, struct dtb_node *dtb_node, … in _dtb_node_get_dtb_nodes_list() argument
89 dtb_node->parent = dtb_node_head; in _dtb_node_get_dtb_nodes_list()
90 dtb_node->sibling = NULL; in _dtb_node_get_dtb_nodes_list()
91 dtb_node->name = fdt_get_name(current_fdt, node_off, &node_name_sz); in _dtb_node_get_dtb_nodes_list()
96 dtb_node->path = (const char *)paths_buf.cur; in _dtb_node_get_dtb_nodes_list()
99 strncpy(paths_buf.cur, (char *)dtb_node->name, node_name_sz); in _dtb_node_get_dtb_nodes_list()
103 dtb_node->level = dtb_node_head->level + 1; in _dtb_node_get_dtb_nodes_list()
107 dtb_node->path = NULL; in _dtb_node_get_dtb_nodes_list()
112 dtb_node->handle = fdt_get_phandle(current_fdt, node_off); in _dtb_node_get_dtb_nodes_list()
113 dtb_node->properties = (struct dtb_property *)malloc(sizeof(struct dtb_property)); in _dtb_node_get_dtb_nodes_list()
114 dtb_node->child = (struct dtb_node *)malloc(sizeof(struct dtb_node)); in _dtb_node_get_dtb_nodes_list()
116 if (dtb_node->properties == NULL || dtb_node->child == NULL) in _dtb_node_get_dtb_nodes_list()
121 dtb_fwnode_init(dtb_node); in _dtb_node_get_dtb_nodes_list()
123 fdt_exec_status = _dtb_node_get_dtb_properties_list(dtb_node->properties, node_off); in _dtb_node_get_dtb_nodes_list()
126 free(dtb_node->properties); in _dtb_node_get_dtb_nodes_list()
127 dtb_node->properties = NULL; in _dtb_node_get_dtb_nodes_list()
134 … fdt_exec_status = _dtb_node_get_dtb_nodes_list(dtb_node, dtb_node->child, dtb_node->path); in _dtb_node_get_dtb_nodes_list()
137 free(dtb_node->child); in _dtb_node_get_dtb_nodes_list()
138 dtb_node->child = NULL; in _dtb_node_get_dtb_nodes_list()
148 dtb_node->sibling = (struct dtb_node *)malloc(sizeof(struct dtb_node)); in _dtb_node_get_dtb_nodes_list()
149 if (dtb_node->sibling == NULL) in _dtb_node_get_dtb_nodes_list()
153 dtb_node = dtb_node->sibling; in _dtb_node_get_dtb_nodes_list()
154 dtb_node->level--; in _dtb_node_get_dtb_nodes_list()
166 struct dtb_node *dtb_node_get_dtb_list(void *fdt) in dtb_node_get_dtb_list()
169 struct dtb_node *dtb_node_head = NULL; in dtb_node_get_dtb_list()
179 if ((dtb_node_head = (struct dtb_node *)malloc(sizeof(struct dtb_node))) == NULL) in dtb_node_get_dtb_list()
245 dtb_node_head->child = (struct dtb_node *)malloc(sizeof(struct dtb_node)); in dtb_node_get_dtb_list()
279 static void _dtb_node_free_dtb_node(struct dtb_node *dtb_node) in _dtb_node_free_dtb_node() argument
281 struct dtb_node *dtb_node_last; in _dtb_node_free_dtb_node()
285 while (dtb_node != NULL) in _dtb_node_free_dtb_node()
287 dtb_property = dtb_node->properties; in _dtb_node_free_dtb_node()
295 _dtb_node_free_dtb_node(dtb_node->child); in _dtb_node_free_dtb_node()
297 dtb_node_last = dtb_node; in _dtb_node_free_dtb_node()
298 dtb_node = dtb_node->sibling; in _dtb_node_free_dtb_node()
303 void dtb_node_free_dtb_list(struct dtb_node *dtb_node_head) in dtb_node_free_dtb_list()
380 static void _dtb_node_printf_dtb_node_info(struct dtb_node *dtb_node) in _dtb_node_printf_dtb_node_info() argument
385 while (dtb_node != NULL) in _dtb_node_printf_dtb_node_info()
389 rt_kputs(dtb_node->name); in _dtb_node_printf_dtb_node_info()
393 dtb_property = dtb_node->properties; in _dtb_node_printf_dtb_node_info()
449 _dtb_node_printf_dtb_node_info(dtb_node->child); in _dtb_node_printf_dtb_node_info()
450 dtb_node = dtb_node->sibling; in _dtb_node_printf_dtb_node_info()
458 void dtb_node_get_dts_dump(struct dtb_node *dtb_node_head) in dtb_node_get_dts_dump()
474 …tatic void _dtb_node_get_enum_dtb_node(struct dtb_node *dtb_node, void (callback(struct dtb_node *… in _dtb_node_get_enum_dtb_node() argument
476 while (dtb_node != NULL) in _dtb_node_get_enum_dtb_node()
478 callback(dtb_node); in _dtb_node_get_enum_dtb_node()
479 _dtb_node_get_enum_dtb_node(dtb_node->child, callback); in _dtb_node_get_enum_dtb_node()
480 dtb_node = dtb_node->sibling; in _dtb_node_get_enum_dtb_node()
484 void dtb_node_get_enum_dtb_node(struct dtb_node *dtb_node_head, void (callback(struct dtb_node *dtb… in dtb_node_get_enum_dtb_node() argument
494 struct dtb_node *dtb_node_get_dtb_node_by_name_DFS(struct dtb_node *dtb_node, const char *nodename) in dtb_node_get_dtb_node_by_name_DFS() argument
496 struct dtb_node *dtb_node_child; in dtb_node_get_dtb_node_by_name_DFS()
498 while (dtb_node != NULL) in dtb_node_get_dtb_node_by_name_DFS()
500 if (!strcmp(nodename, dtb_node->name)) in dtb_node_get_dtb_node_by_name_DFS()
502 return dtb_node; in dtb_node_get_dtb_node_by_name_DFS()
505 dtb_node_child = dtb_node_get_dtb_node_by_name_DFS(dtb_node->child, nodename); in dtb_node_get_dtb_node_by_name_DFS()
511 dtb_node = dtb_node->sibling; in dtb_node_get_dtb_node_by_name_DFS()
517 struct dtb_node *dtb_node_get_dtb_node_by_name_BFS(struct dtb_node *dtb_node, const char *nodename) in dtb_node_get_dtb_node_by_name_BFS() argument
519 if (dtb_node != NULL) in dtb_node_get_dtb_node_by_name_BFS()
521 struct dtb_node *dtb_node_child, *dtb_node_head = dtb_node; in dtb_node_get_dtb_node_by_name_BFS()
523 while (dtb_node != NULL) in dtb_node_get_dtb_node_by_name_BFS()
525 if (!strcmp(nodename, dtb_node->name)) in dtb_node_get_dtb_node_by_name_BFS()
527 return dtb_node; in dtb_node_get_dtb_node_by_name_BFS()
529 dtb_node = dtb_node->sibling; in dtb_node_get_dtb_node_by_name_BFS()
532 dtb_node = dtb_node_head; in dtb_node_get_dtb_node_by_name_BFS()
534 while (dtb_node != NULL) in dtb_node_get_dtb_node_by_name_BFS()
536 dtb_node_child = dtb_node_get_dtb_node_by_name_BFS(dtb_node->child, nodename); in dtb_node_get_dtb_node_by_name_BFS()
542 dtb_node = dtb_node->sibling; in dtb_node_get_dtb_node_by_name_BFS()
549 struct dtb_node *dtb_node_get_dtb_node_by_path(struct dtb_node *dtb_node, const char *pathname) in dtb_node_get_dtb_node_by_path() argument
556 if (pathname == NULL || dtb_node == NULL) in dtb_node_get_dtb_node_by_path()
568 if (dtb_node->parent == NULL || !strcmp(dtb_node->path, "/")) in dtb_node_get_dtb_node_by_path()
570 dtb_node = dtb_node->child; in dtb_node_get_dtb_node_by_path()
589 while (dtb_node != NULL) in dtb_node_get_dtb_node_by_path()
591 if (!strcmp(dtb_node->name, node_name)) in dtb_node_get_dtb_node_by_path()
595 dtb_node = dtb_node->sibling; in dtb_node_get_dtb_node_by_path()
597 if (dtb_node == NULL) in dtb_node_get_dtb_node_by_path()
602 dtb_node = dtb_node->child; in dtb_node_get_dtb_node_by_path()
616 while (dtb_node != NULL) in dtb_node_get_dtb_node_by_path()
618 if (!strcmp(dtb_node->name, node_name)) in dtb_node_get_dtb_node_by_path()
620 return dtb_node; in dtb_node_get_dtb_node_by_path()
622 dtb_node = dtb_node->sibling; in dtb_node_get_dtb_node_by_path()
628 struct dtb_node *dtb_node_get_dtb_node_by_phandle_DFS(struct dtb_node *dtb_node, phandle handle) in dtb_node_get_dtb_node_by_phandle_DFS() argument
630 struct dtb_node *dtb_node_child; in dtb_node_get_dtb_node_by_phandle_DFS()
632 while (dtb_node != NULL) in dtb_node_get_dtb_node_by_phandle_DFS()
634 if (dtb_node->handle == handle) in dtb_node_get_dtb_node_by_phandle_DFS()
636 return dtb_node; in dtb_node_get_dtb_node_by_phandle_DFS()
639 dtb_node_child = dtb_node_get_dtb_node_by_phandle_DFS(dtb_node->child, handle); in dtb_node_get_dtb_node_by_phandle_DFS()
645 dtb_node = dtb_node->sibling; in dtb_node_get_dtb_node_by_phandle_DFS()
651 struct dtb_node *dtb_node_get_dtb_node_by_phandle_BFS(struct dtb_node *dtb_node, phandle handle) in dtb_node_get_dtb_node_by_phandle_BFS() argument
653 if (dtb_node != NULL) in dtb_node_get_dtb_node_by_phandle_BFS()
655 struct dtb_node *dtb_node_child, *dtb_node_head = dtb_node; in dtb_node_get_dtb_node_by_phandle_BFS()
657 while (dtb_node != NULL) in dtb_node_get_dtb_node_by_phandle_BFS()
659 if (dtb_node->handle == handle) in dtb_node_get_dtb_node_by_phandle_BFS()
661 return dtb_node; in dtb_node_get_dtb_node_by_phandle_BFS()
663 dtb_node = dtb_node->sibling; in dtb_node_get_dtb_node_by_phandle_BFS()
666 dtb_node = dtb_node_head; in dtb_node_get_dtb_node_by_phandle_BFS()
668 while (dtb_node != NULL) in dtb_node_get_dtb_node_by_phandle_BFS()
670 dtb_node_child = dtb_node_get_dtb_node_by_phandle_BFS(dtb_node->child, handle); in dtb_node_get_dtb_node_by_phandle_BFS()
676 dtb_node = dtb_node->sibling; in dtb_node_get_dtb_node_by_phandle_BFS()
683 void dtb_node_get_dtb_node_cells(struct dtb_node *dtb_node, int *addr_cells, int *size_cells) in dtb_node_get_dtb_node_cells() argument
685 if (dtb_node != NULL && addr_cells != NULL && size_cells != NULL) in dtb_node_get_dtb_node_cells()
692 while ((dtb_node = dtb_node->parent) != NULL) in dtb_node_get_dtb_node_cells()
694 dtb_property = dtb_node->properties; in dtb_node_get_dtb_node_cells()
724 struct dtb_memreserve *dtb_node_get_dtb_memreserve(struct dtb_node *dtb_node, int *memreserve_size) in dtb_node_get_dtb_memreserve() argument
726 if (dtb_node != NULL && memreserve_size != NULL) in dtb_node_get_dtb_memreserve()
728 struct dtb_node *dtb_node_root = dtb_node; in dtb_node_get_dtb_memreserve()
747 rt_bool_t dtb_node_get_dtb_node_status(const struct dtb_node *dtb_node) in dtb_node_get_dtb_node_status() argument
749 if (dtb_node != NULL) in dtb_node_get_dtb_node_status()
751 char *status = dtb_node_get_dtb_node_property_value(dtb_node, "status", NULL); in dtb_node_get_dtb_node_status()
763 rt_bool_t dtb_node_get_dtb_node_compatible_match(const struct dtb_node *dtb_node, const char *compa… in dtb_node_get_dtb_node_compatible_match() argument
765 if (dtb_node != NULL) in dtb_node_get_dtb_node_compatible_match()
772 for_each_property_string(dtb_node, "compatible", str_ptr, prop_sz) in dtb_node_get_dtb_node_compatible_match()