mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
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 <aliguori@us.ibm.com>
This commit is contained in:
parent
40021f0888
commit
999e12bbe8
131 changed files with 2734 additions and 1297 deletions
40
hw/sysbus.c
40
hw/sysbus.c
|
@ -107,29 +107,24 @@ void sysbus_init_ioports(SysBusDevice *dev, pio_addr_t ioport, pio_addr_t size)
|
|||
|
||||
static int sysbus_device_init(DeviceState *dev, DeviceInfo *base)
|
||||
{
|
||||
SysBusDeviceInfo *info = container_of(base, SysBusDeviceInfo, qdev);
|
||||
SysBusDevice *sd = SYS_BUS_DEVICE(dev);
|
||||
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_GET_CLASS(sd);
|
||||
|
||||
return info->init(sysbus_from_qdev(dev));
|
||||
return sbc->init(sd);
|
||||
}
|
||||
|
||||
void sysbus_register_withprop(SysBusDeviceInfo *info)
|
||||
void sysbus_qdev_register_subclass(DeviceInfo *info, const char *parent)
|
||||
{
|
||||
info->qdev.init = sysbus_device_init;
|
||||
info->qdev.bus_info = &system_bus_info;
|
||||
info->init = sysbus_device_init;
|
||||
info->bus_info = &system_bus_info;
|
||||
|
||||
assert(info->qdev.size >= sizeof(SysBusDevice));
|
||||
qdev_register(&info->qdev);
|
||||
assert(info->size >= sizeof(SysBusDevice));
|
||||
qdev_register_subclass(info, parent);
|
||||
}
|
||||
|
||||
void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init)
|
||||
void sysbus_qdev_register(DeviceInfo *info)
|
||||
{
|
||||
SysBusDeviceInfo *info;
|
||||
|
||||
info = g_malloc0(sizeof(*info));
|
||||
info->qdev.name = g_strdup(name);
|
||||
info->qdev.size = size;
|
||||
info->init = init;
|
||||
sysbus_register_withprop(info);
|
||||
sysbus_qdev_register_subclass(info, TYPE_SYS_BUS_DEVICE);
|
||||
}
|
||||
|
||||
DeviceState *sysbus_create_varargs(const char *name,
|
||||
|
@ -258,3 +253,18 @@ MemoryRegion *sysbus_address_space(SysBusDevice *dev)
|
|||
{
|
||||
return get_system_memory();
|
||||
}
|
||||
|
||||
static TypeInfo sysbus_device_type_info = {
|
||||
.name = TYPE_SYS_BUS_DEVICE,
|
||||
.parent = TYPE_DEVICE,
|
||||
.instance_size = sizeof(SysBusDevice),
|
||||
.abstract = true,
|
||||
.class_size = sizeof(SysBusDeviceClass),
|
||||
};
|
||||
|
||||
static void sysbus_register(void)
|
||||
{
|
||||
type_register_static(&sysbus_device_type_info);
|
||||
}
|
||||
|
||||
device_init(sysbus_register);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue