From c4a3d438e642e8692e6a94e7d4db75d75744e73f Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 11 Jun 2025 12:51:56 +0100 Subject: [dt] Allow for creation of standalone devices We will want to be able to create the console device as early as possible. Refactor devicetree probing to remove the assumption that a devicetree device must have a devicetree parent, and expose functions to allow a standalone device to be created given only the offset of a node within the tree. The full device path is no longer trivial to construct with this assumption removed. The full path is currently used only for debug messages. Remove the stored full path, use just the node name for debug messages, and ensure that the topology information previously visible in the full path is reconstructible from the combined debug output if needed. Signed-off-by: Michael Brown --- src/include/ipxe/devtree.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/include/ipxe/devtree.h') diff --git a/src/include/ipxe/devtree.h b/src/include/ipxe/devtree.h index 46d8b5d86..cdf173938 100644 --- a/src/include/ipxe/devtree.h +++ b/src/include/ipxe/devtree.h @@ -15,12 +15,12 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); /** A devicetree device */ struct dt_device { + /** Device name */ + const char *name; /** Generic device */ struct device dev; /** DMA device */ struct dma_device dma; - /** Device path */ - const char *path; /** Driver for this device */ struct dt_driver *driver; /** Driver-private data */ @@ -79,5 +79,7 @@ static inline void * dt_get_drvdata ( struct dt_device *dt ) { extern void * dt_ioremap ( struct dt_device *dt, unsigned int offset, unsigned int index, size_t len ); +extern int dt_probe_node ( struct device *parent, unsigned int offset ); +extern void dt_remove_node ( struct device *parent ); #endif /* _IPXE_DEVTREE_H */ -- cgit v1.2.3-55-g7522