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

Function fdt_next_property

src/commonlib/device_tree.c:115–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115int fdt_next_property(const void *blob, uint32_t offset,
116 struct fdt_property *prop)
117{
118 struct fdt_header *header = (struct fdt_header *)blob;
119
120 // skip NOP tokens
121 offset += fdt_skip_nops(blob, offset);
122
123 uint32_t *ptr = (uint32_t *)(((uint8_t *)blob) + offset);
124
125 int index = 0;
126 if (be32toh(ptr[index++]) != FDT_TOKEN_PROPERTY)
127 return 0;
128
129 uint32_t size = be32toh(ptr[index++]);
130 uint32_t name_offset = be32toh(ptr[index++]);
131 name_offset += be32toh(header->strings_offset);
132
133 if (prop) {
134 prop->name = (char *)((uint8_t *)blob + name_offset);
135 prop->data = &ptr[index];
136 prop->size = size;
137 }
138
139 index += DIV_ROUND_UP(size, sizeof(uint32_t));
140
141 return index * sizeof(uint32_t);
142}
143
144/*
145 * fdt_next_node_name reads a node name

Callers 6

fdt_find_compatFunction · 0.85
fdt_skip_nodeFunction · 0.85
fdt_read_propFunction · 0.85
fdt_read_cell_propsFunction · 0.85
print_flat_nodeFunction · 0.85
fdt_unflatten_nodeFunction · 0.85

Calls 1

fdt_skip_nopsFunction · 0.85

Tested by

no test coverage detected