summaryrefslogtreecommitdiff
path: root/hw/sysbus.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-06-30 14:12:08 +0200
committerPaul Brook <paul@codesourcery.com>2009-07-09 13:07:03 +0100
commit10c4c98ab7dc18169b37b76f6ea5e60ebe65222b (patch)
tree94b41a4a26b82720cc8695b66cedbcf135d68669 /hw/sysbus.c
parent0aab0d3a4a62505ab7e79ee0a67fe3f04f6dae23 (diff)
qdev: replace bus_type enum with bus_info struct.
BusInfo is filled with name and size (pretty much like I did for DeviceInfo as well). There is also a function pointer to print bus-specific device information to the monitor. sysbus is hooked up there, I've also added a print function for PCI. Device creation is slightly modified as well: The device type search loop now also checks the bus type while scanning the list instead of complaining thereafter in case of a mismatch. This effectively gives each bus a private namespace for device names. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/sysbus.c')
-rw-r--r--hw/sysbus.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/hw/sysbus.c b/hw/sysbus.c
index ef3a7011e9..08f15e42fa 100644
--- a/hw/sysbus.c
+++ b/hw/sysbus.c
@@ -22,6 +22,14 @@
#include "sysemu.h"
#include "monitor.h"
+static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent);
+
+struct BusInfo system_bus_info = {
+ .name = "System",
+ .size = sizeof(BusState),
+ .print_dev = sysbus_dev_print,
+};
+
void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq)
{
assert(n >= 0 && n < dev->num_irq);
@@ -108,7 +116,7 @@ static void sysbus_device_init(DeviceState *dev, DeviceInfo *base)
void sysbus_register_withprop(SysBusDeviceInfo *info)
{
info->qdev.init = sysbus_device_init;
- info->qdev.bus_type = BUS_TYPE_SYSTEM;
+ info->qdev.bus_info = &system_bus_info;
assert(info->qdev.size >= sizeof(SysBusDevice));
qdev_register(&info->qdev);
@@ -153,7 +161,7 @@ DeviceState *sysbus_create_varargs(const char *name,
return dev;
}
-void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent)
+static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent)
{
SysBusDevice *s = sysbus_from_qdev(dev);
int i;