diff options
author | Alexander Graf <agraf@suse.de> | 2014-09-24 13:06:57 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2014-11-04 23:26:14 +0100 |
commit | eb5722801c84f23428c50e2336d02e400ce55deb (patch) | |
tree | cff20750e2dfd11062cc39f54349cadc5c9c8902 /include | |
parent | f8833a37c0c6b22ddd57b45e48cfb0f97dbd5af4 (diff) |
sysbus: Add dynamic sysbus device search
Sysbus devices can be spawned by C code or dynamically via the command line.
In the latter case, we need to be able to find the dynamically created devices
to do things with them.
This patch adds a search helper that makes it easy to look for dynamically
spawned sysbus devices.
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/sysbus.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 9fb1782d7b..80529ffed8 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -57,6 +57,8 @@ struct SysBusDevice { pio_addr_t pio[QDEV_MAX_PIO]; }; +typedef int FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque); + void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory); MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n); void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p); @@ -72,6 +74,9 @@ void sysbus_add_io(SysBusDevice *dev, hwaddr addr, MemoryRegion *mem); MemoryRegion *sysbus_address_space(SysBusDevice *dev); +/* Call func for every dynamically created sysbus device in the system */ +void foreach_dynamic_sysbus_device(FindSysbusDeviceFunc *func, void *opaque); + /* Legacy helper function for creating devices. */ DeviceState *sysbus_create_varargs(const char *name, hwaddr addr, ...); |