summary refs log tree commit diff stats
path: root/hw/core
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2014-09-24 12:36:30 +0200
committerAlexander Graf <agraf@suse.de>2014-11-04 23:26:14 +0100
commit471a9bc14444e79bb826616becd2e5531e591d30 (patch)
tree37693aa15037729d55f5006d774499b6b5d07f3a /hw/core
parentb797318666dade9675a253d311125ae7b568e2f8 (diff)
downloadfocaccia-qemu-471a9bc14444e79bb826616becd2e5531e591d30.tar.gz
focaccia-qemu-471a9bc14444e79bb826616becd2e5531e591d30.zip
sysbus: Expose MMIO enumeration helper
Sysbus devices have a range of MMIO regions they expose. The exact number
of regions is device specific and internal information to the device model.

Expose whether a region exists via a public interface. That way our platform
bus enumeration code can dynamically determine how many regions exist.

Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/sysbus.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index 945dec53d0..84af59379d 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -110,6 +110,12 @@ void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq)
     qdev_connect_gpio_out_named(DEVICE(dev), SYSBUS_DEVICE_GPIO_IRQ, n, irq);
 }
 
+/* Check whether an MMIO region exists */
+bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n)
+{
+    return (n < dev->num_mmio);
+}
+
 static void sysbus_mmio_map_common(SysBusDevice *dev, int n, hwaddr addr,
                                    bool may_overlap, int priority)
 {