From 1431b6a17e6546569e09bcf8fb7773c925658d8f Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Fri, 5 Jun 2009 15:52:04 +0100 Subject: Record device property types Record device property types, and provide a list of properties at device registration time. Add a "device" property type that holds a reference to annother device. Signed-off-by: Paul Brook --- hw/sysbus.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'hw/sysbus.c') diff --git a/hw/sysbus.c b/hw/sysbus.c index 13d81f541f..a1843088e3 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -21,11 +21,6 @@ #include "sysbus.h" #include "sysemu.h" -typedef struct { - DeviceInfo qdev; - sysbus_initfn init; -} SysBusDeviceInfo; - void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq) { assert(n >= 0 && n < dev->num_irq); @@ -109,12 +104,9 @@ static void sysbus_device_init(DeviceState *dev, DeviceInfo *base) info->init(sysbus_from_qdev(dev)); } -void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init) +void sysbus_register_withprop(const char *name, size_t size, + SysBusDeviceInfo *info) { - SysBusDeviceInfo *info; - - info = qemu_mallocz(sizeof(*info)); - info->init = init; info->qdev.init = sysbus_device_init; info->qdev.bus_type = BUS_TYPE_SYSTEM; @@ -122,6 +114,15 @@ void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init) qdev_register(name, size, &info->qdev); } +void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init) +{ + SysBusDeviceInfo *info; + + info = qemu_mallocz(sizeof(*info)); + info->init = init; + sysbus_register_withprop(name, size, info); +} + DeviceState *sysbus_create_varargs(const char *name, target_phys_addr_t addr, ...) { -- cgit v1.2.3