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

Function fdt_read_prop

src/commonlib/device_tree.c:205–219  ·  view source on GitHub ↗

* fdt_read_prop reads a property inside a node * * @params blob address of FDT * @params node_offset offset to the node to read the property from * @params prop_name name of the property to read * @params fdt_prop property is saved inside this parameter * * @returns Either 0 if no property has been found or an offset that points to the location * of the property

Source from the content-addressed store, hash-verified

203 * of the property
204 */
205u32 fdt_read_prop(const void *blob, u32 node_offset, const char *prop_name,
206 struct fdt_property *fdt_prop)
207{
208 u32 offset = node_offset;
209
210 offset += fdt_next_node_name(blob, offset, NULL); // skip node name
211
212 size_t size;
213 while ((size = fdt_next_property(blob, offset, fdt_prop))) {
214 if (strcmp(fdt_prop->name, prop_name) == 0)
215 return offset;
216 offset += size;
217 }
218 return 0; // property not found
219}
220
221/*
222 * fdt_read_reg_prop reads the reg property inside a node

Callers 4

start_mainFunction · 0.85
fdt_read_reg_propFunction · 0.85
fdt_read_alias_propFunction · 0.85

Calls 3

fdt_next_node_nameFunction · 0.85
fdt_next_propertyFunction · 0.85
strcmpFunction · 0.50

Tested by 1