MCPcopy Create free account
hub / github.com/coreboot/coreboot / fdt_unflatten_node

Function fdt_unflatten_node

src/commonlib/device_tree.c:679–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

677}
678
679static int fdt_unflatten_node(const void *blob, uint32_t start_offset,
680 struct device_tree *tree,
681 struct device_tree_node **new_node)
682{
683 struct list_node *last;
684 int offset = start_offset;
685 const char *name;
686 int size;
687
688 size = fdt_next_node_name(blob, offset, &name);
689 if (!size)
690 return 0;
691 offset += size;
692
693 struct device_tree_node *node = alloc_node();
694 *new_node = node;
695 node->name = name;
696
697 struct fdt_property fprop;
698 last = &node->properties;
699 while ((size = fdt_next_property(blob, offset, &fprop))) {
700 struct device_tree_property *prop = alloc_prop();
701 prop->prop = fprop;
702
703 if (dt_prop_is_phandle(prop)) {
704 node->phandle = be32dec(prop->prop.data);
705 if (node->phandle > tree->max_phandle)
706 tree->max_phandle = node->phandle;
707 }
708
709 list_insert_after(&prop->list_node, last);
710 last = &prop->list_node;
711
712 offset += size;
713 }
714
715 struct device_tree_node *child;
716 last = &node->children;
717 while ((size = fdt_unflatten_node(blob, offset, tree, &child))) {
718 list_insert_after(&child->list_node, last);
719 last = &child->list_node;
720
721 offset += size;
722 }
723
724 return offset - start_offset + sizeof(uint32_t);
725}
726
727static int fdt_unflatten_map_entry(const void *blob, uint32_t offset,
728 struct device_tree_reserve_map_entry **new)

Callers 1

fdt_unflattenFunction · 0.85

Calls 6

fdt_next_node_nameFunction · 0.85
alloc_nodeFunction · 0.85
fdt_next_propertyFunction · 0.85
alloc_propFunction · 0.85
dt_prop_is_phandleFunction · 0.85
list_insert_afterFunction · 0.85

Tested by

no test coverage detected