diff --git a/device_tree.c b/device_tree.c index d0378961f0..75412747b7 100644 --- a/device_tree.c +++ b/device_tree.c @@ -191,6 +191,13 @@ int qemu_devtree_setprop_phandle(void *fdt, const char *node_path, return qemu_devtree_setprop_cell(fdt, node_path, property, phandle); } +uint32_t qemu_devtree_alloc_phandle(void *fdt) +{ + static int phandle = 0x8000; + + return phandle++; +} + int qemu_devtree_nop_node(void *fdt, const char *node_path) { int r; diff --git a/device_tree.h b/device_tree.h index 5f76f40eeb..97af3454f7 100644 --- a/device_tree.h +++ b/device_tree.h @@ -27,6 +27,7 @@ int qemu_devtree_setprop_phandle(void *fdt, const char *node_path, const char *property, const char *target_node_path); uint32_t qemu_devtree_get_phandle(void *fdt, const char *path); +uint32_t qemu_devtree_alloc_phandle(void *fdt); int qemu_devtree_nop_node(void *fdt, const char *node_path); int qemu_devtree_add_subnode(void *fdt, const char *name);