From 46c305ef6b0d1ed6c85e863568fccc03caf7f75e Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Sun, 28 Aug 2011 16:22:17 +0000 Subject: 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 --- hw/sysbus.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'hw/sysbus.c') diff --git a/hw/sysbus.c b/hw/sysbus.c index f39768b6a2..c365d39d24 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; -- cgit 1.4.1