From 999e12bbe85c5dcf49bef13bce4f97399c7105f4 Mon Sep 17 00:00:00 2001 From: Anthony Liguori Date: Tue, 24 Jan 2012 13:12:29 -0600 Subject: sysbus: apic: ioapic: convert to QEMU Object Model This converts three devices because apic and ioapic are subclasses of sysbus. Converting subclasses independently of their base class is prohibitively hard. Signed-off-by: Anthony Liguori --- hw/pl011.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'hw/pl011.c') diff --git a/hw/pl011.c b/hw/pl011.c index 1b05d76a78..088aa44a3b 100644 --- a/hw/pl011.c +++ b/hw/pl011.c @@ -278,22 +278,46 @@ static int pl011_init(SysBusDevice *dev, const unsigned char *id) return 0; } -static int pl011_init_arm(SysBusDevice *dev) +static int pl011_arm_init(SysBusDevice *dev) { return pl011_init(dev, pl011_id_arm); } -static int pl011_init_luminary(SysBusDevice *dev) +static int pl011_luminary_init(SysBusDevice *dev) { return pl011_init(dev, pl011_id_luminary); } +static void pl011_arm_class_init(ObjectClass *klass, void *data) +{ + SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); + + sdc->init = pl011_arm_init; +} + +static DeviceInfo pl011_arm_info = { + .name = "pl011", + .size = sizeof(pl011_state), + .class_init = pl011_arm_class_init, +}; + +static void pl011_luminary_class_init(ObjectClass *klass, void *data) +{ + SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); + + sdc->init = pl011_luminary_init; +} + +static DeviceInfo pl011_luminary_info = { + .name = "pl011_luminary", + .size = sizeof(pl011_state), + .class_init = pl011_luminary_class_init, +}; + static void pl011_register_devices(void) { - sysbus_register_dev("pl011", sizeof(pl011_state), - pl011_init_arm); - sysbus_register_dev("pl011_luminary", sizeof(pl011_state), - pl011_init_luminary); + sysbus_qdev_register(&pl011_arm_info); + sysbus_qdev_register(&pl011_luminary_info); } device_init(pl011_register_devices) -- cgit v1.2.3