[fdt] Remove concept of a device tree cursor

Refactor device tree traversal to operate on the basis of describing
the token at a given offset, with no separate notion of a device tree
cursor.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-04-14 11:33:27 +01:00
parent b1125007ca
commit d462aeb0ca
3 changed files with 165 additions and 124 deletions

View File

@@ -108,9 +108,27 @@ struct fdt {
int ( * realloc ) ( struct fdt *fdt, size_t len );
};
/** A device tree token descriptor */
struct fdt_descriptor {
/** Offset within structure block */
unsigned int offset;
/** Next offset within structure block */
unsigned int next;
/** Node or property name (if applicable) */
const char *name;
/** Property data (if applicable) */
const void *data;
/** Length of property data (if applicable) */
size_t len;
/** Depth change */
int depth;
};
extern struct image_tag fdt_image __image_tag;
extern struct fdt sysfdt;
extern int fdt_describe ( struct fdt *fdt, unsigned int offset,
struct fdt_descriptor *desc );
extern int fdt_path ( struct fdt *fdt, const char *path,
unsigned int *offset );
extern int fdt_alias ( struct fdt *fdt, const char *name,