[fdt] Allow for the existence of multiple device trees

When running on a platform that uses FDT as its hardware description
mechanism, we are likely to have multiple device tree structures.  At
a minimum, there will be the device tree passed to us from the
previous boot stage (e.g. OpenSBI), and the device tree that we
construct to be passed to the booted operating system.

Update the internal FDT API to include an FDT pointer in all function
parameter lists.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-03-28 12:42:30 +00:00
parent 09fbebc084
commit 2399c79980
7 changed files with 120 additions and 109 deletions

View File

@@ -95,12 +95,18 @@ struct fdt {
};
extern struct image_tag fdt_image __image_tag;
extern struct fdt sysfdt;
extern int fdt_path ( const char *path, unsigned int *offset );
extern int fdt_alias ( const char *name, unsigned int *offset );
extern const char * fdt_string ( unsigned int offset, const char *name );
extern int fdt_u64 ( unsigned int offset, const char *name, uint64_t *value );
extern int fdt_mac ( unsigned int offset, struct net_device *netdev );
extern int register_fdt ( const struct fdt_header *hdr );
extern int fdt_path ( struct fdt *fdt, const char *path,
unsigned int *offset );
extern int fdt_alias ( struct fdt *fdt, const char *name,
unsigned int *offset );
extern const char * fdt_string ( struct fdt *fdt, unsigned int offset,
const char *name );
extern int fdt_u64 ( struct fdt *fdt, unsigned int offset, const char *name,
uint64_t *value );
extern int fdt_mac ( struct fdt *fdt, unsigned int offset,
struct net_device *netdev );
extern int fdt_parse ( struct fdt *fdt, const struct fdt_header *hdr );
#endif /* _IPXE_FDT_H */