[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 <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-06-11 12:51:56 +01:00
parent b5fb7353fa
commit c4a3d438e6
2 changed files with 56 additions and 61 deletions

View File

@@ -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 */