aboutsummaryrefslogtreecommitdiff
path: root/hw/sysbus.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2011-08-28 16:22:17 +0000
committerPeter Maydell <peter.maydell@linaro.org>2011-08-28 16:22:17 +0000
commit46c305ef6b0d1ed6c85e863568fccc03caf7f75e (patch)
treea4fc37959569c26e6e1f86d61b332813801d1033 /hw/sysbus.c
parent9f94778c1603420e48d779a495e84eb82945cc75 (diff)
downloadqemu-46c305ef6b0d1ed6c85e863568fccc03caf7f75e.zip
qemu-46c305ef6b0d1ed6c85e863568fccc03caf7f75e.tar.gz
qemu-46c305ef6b0d1ed6c85e863568fccc03caf7f75e.tar.bz2
hw/sysbus: Add sysbus_mmio_get_region()
Add a sysbus_mmio_get_region() which allows users of sysbus devices to turn a (SysBusDevice*, mmioidx) tuple into a MemoryRegion*. This enables some useful simplifications of devices which pass through another device's mmio region (either directly or by implementing some kind of memory controller device). Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/sysbus.c')
-rw-r--r--hw/sysbus.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/sysbus.c b/hw/sysbus.c
index f39768b..c365d39 100644
--- a/hw/sysbus.c
+++ b/hw/sysbus.c
@@ -131,6 +131,11 @@ void sysbus_init_mmio_region(SysBusDevice *dev, MemoryRegion *memory)
dev->mmio[n].memory = memory;
}
+MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n)
+{
+ return dev->mmio[n].memory;
+}
+
void sysbus_init_ioports(SysBusDevice *dev, pio_addr_t ioport, pio_addr_t size)
{
pio_addr_t i;