]> git.proxmox.com Git - qemu.git/commitdiff
hw/sysbus: Add sysbus_mmio_get_region()
authorPeter Maydell <peter.maydell@linaro.org>
Sun, 28 Aug 2011 16:22:17 +0000 (16:22 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Sun, 28 Aug 2011 16:22:17 +0000 (16:22 +0000)
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>
hw/sysbus.c
hw/sysbus.h

index f39768b6a24d6a895e4249346fe2efddd5456de3..c365d39d24804186d397cbc78496e04fa4957da2 100644 (file)
@@ -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;
index b87c6c5aabdb2355f70296ff0fd8d5b001e16b29..aa3d3832775c2517aa5c1fbc6f97edb1697066ba 100644 (file)
@@ -50,6 +50,7 @@ void sysbus_init_mmio(SysBusDevice *dev, target_phys_addr_t size,
 void sysbus_init_mmio_cb2(SysBusDevice *dev,
                           mmio_mapfunc cb, mmio_mapfunc unmap);
 void sysbus_init_mmio_region(SysBusDevice *dev, MemoryRegion *memory);
+MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n);
 void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
 void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
 void sysbus_init_ioports(SysBusDevice *dev, pio_addr_t ioport, pio_addr_t size);