mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
Merge branch 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu
* 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu: qdev: Drop FROM_QBUS() macro isa: QOM'ify ISADevice isa: QOM'ify ISABus i8259: Convert PICCommonState to use QOM realizefn kvm/i8259: QOM'ify some more i8259: QOM'ify some more i8254: Convert PITCommonState to QOM realizefn kvm/i8254: QOM'ify some more i8254: QOM'ify some more isa: Use realizefn for ISADevice cs4231a: QOM'ify some more gus: QOM'ify some more
This commit is contained in:
commit
371a775dc1
53 changed files with 533 additions and 389 deletions
|
|
@ -201,7 +201,7 @@ static void qdev_applesmc_isa_reset(DeviceState *dev)
|
|||
applesmc_add_key(s, "MSSD", 1, "\0x3");
|
||||
}
|
||||
|
||||
static int applesmc_isa_init(ISADevice *dev)
|
||||
static void applesmc_isa_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
AppleSMCState *s = APPLE_SMC(dev);
|
||||
|
||||
|
|
@ -220,9 +220,7 @@ static int applesmc_isa_init(ISADevice *dev)
|
|||
}
|
||||
|
||||
QLIST_INIT(&s->data_def);
|
||||
qdev_applesmc_isa_reset(&dev->qdev);
|
||||
|
||||
return 0;
|
||||
qdev_applesmc_isa_reset(dev);
|
||||
}
|
||||
|
||||
static Property applesmc_isa_properties[] = {
|
||||
|
|
@ -235,8 +233,8 @@ static Property applesmc_isa_properties[] = {
|
|||
static void qdev_applesmc_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
|
||||
ic->init = applesmc_isa_init;
|
||||
|
||||
dc->realize = applesmc_isa_realize;
|
||||
dc->reset = qdev_applesmc_isa_reset;
|
||||
dc->props = applesmc_isa_properties;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,15 +35,15 @@ static const MemoryRegionOps debug_exit_ops = {
|
|||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
|
||||
static int debug_exit_initfn(ISADevice *dev)
|
||||
static void debug_exit_realizefn(DeviceState *d, Error **errp)
|
||||
{
|
||||
ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(dev);
|
||||
ISADevice *dev = ISA_DEVICE(d);
|
||||
ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(d);
|
||||
|
||||
memory_region_init_io(&isa->io, &debug_exit_ops, isa,
|
||||
TYPE_ISA_DEBUG_EXIT_DEVICE, isa->iosize);
|
||||
memory_region_add_subregion(isa_address_space_io(dev),
|
||||
isa->iobase, &isa->io);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Property debug_exit_properties[] = {
|
||||
|
|
@ -55,8 +55,8 @@ static Property debug_exit_properties[] = {
|
|||
static void debug_exit_class_initfn(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
|
||||
ic->init = debug_exit_initfn;
|
||||
|
||||
dc->realize = debug_exit_realizefn;
|
||||
dc->props = debug_exit_properties;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,9 +142,10 @@ static const MemoryRegionOps test_iomem_ops = {
|
|||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
|
||||
static int init_test_device(ISADevice *isa)
|
||||
static void testdev_realizefn(DeviceState *d, Error **errp)
|
||||
{
|
||||
PCTestdev *dev = TESTDEV(isa);
|
||||
ISADevice *isa = ISA_DEVICE(d);
|
||||
PCTestdev *dev = TESTDEV(d);
|
||||
MemoryRegion *mem = isa_address_space(isa);
|
||||
MemoryRegion *io = isa_address_space_io(isa);
|
||||
|
||||
|
|
@ -161,15 +162,13 @@ static int init_test_device(ISADevice *isa)
|
|||
memory_region_add_subregion(io, 0xe4, &dev->flush);
|
||||
memory_region_add_subregion(io, 0x2000, &dev->irq);
|
||||
memory_region_add_subregion(mem, 0xff000000, &dev->iomem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void testdev_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
ISADeviceClass *k = ISA_DEVICE_CLASS(klass);
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
k->init = init_test_device;
|
||||
dc->realize = testdev_realizefn;
|
||||
}
|
||||
|
||||
static const TypeInfo testdev_info = {
|
||||
|
|
|
|||
|
|
@ -86,14 +86,21 @@ static const MemoryRegionOps pvpanic_ops = {
|
|||
},
|
||||
};
|
||||
|
||||
static int pvpanic_isa_initfn(ISADevice *dev)
|
||||
static void pvpanic_isa_initfn(Object *obj)
|
||||
{
|
||||
PVPanicState *s = ISA_PVPANIC_DEVICE(obj);
|
||||
|
||||
memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1);
|
||||
}
|
||||
|
||||
static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp)
|
||||
{
|
||||
ISADevice *d = ISA_DEVICE(dev);
|
||||
PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
|
||||
static bool port_configured;
|
||||
FWCfgState *fw_cfg;
|
||||
|
||||
memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1);
|
||||
isa_register_ioport(dev, &s->io, s->ioport);
|
||||
isa_register_ioport(d, &s->io, s->ioport);
|
||||
|
||||
if (!port_configured) {
|
||||
fw_cfg = fw_cfg_find();
|
||||
|
|
@ -104,8 +111,6 @@ static int pvpanic_isa_initfn(ISADevice *dev)
|
|||
port_configured = true;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pvpanic_init(ISABus *bus)
|
||||
|
|
@ -122,9 +127,8 @@ static Property pvpanic_isa_properties[] = {
|
|||
static void pvpanic_isa_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
|
||||
|
||||
ic->init = pvpanic_isa_initfn;
|
||||
dc->realize = pvpanic_isa_realizefn;
|
||||
dc->no_user = 1;
|
||||
dc->props = pvpanic_isa_properties;
|
||||
}
|
||||
|
|
@ -133,6 +137,7 @@ static TypeInfo pvpanic_isa_info = {
|
|||
.name = TYPE_ISA_PVPANIC_DEVICE,
|
||||
.parent = TYPE_ISA_DEVICE,
|
||||
.instance_size = sizeof(PVPanicState),
|
||||
.instance_init = pvpanic_isa_initfn,
|
||||
.class_init = pvpanic_isa_class_init,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -38,17 +38,16 @@ typedef struct ISASGAState {
|
|||
ISADevice parent_obj;
|
||||
} ISASGAState;
|
||||
|
||||
static int sga_initfn(ISADevice *dev)
|
||||
static void sga_realizefn(DeviceState *dev, Error **errp)
|
||||
{
|
||||
rom_add_vga(SGABIOS_FILENAME);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sga_class_initfn(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
|
||||
ic->init = sga_initfn;
|
||||
|
||||
dc->realize = sga_realizefn;
|
||||
dc->desc = "Serial Graphics Adapter";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,25 +137,25 @@ static const MemoryRegionOps vmport_ops = {
|
|||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
|
||||
static int vmport_initfn(ISADevice *dev)
|
||||
static void vmport_realizefn(DeviceState *dev, Error **errp)
|
||||
{
|
||||
ISADevice *isadev = ISA_DEVICE(dev);
|
||||
VMPortState *s = VMPORT(dev);
|
||||
|
||||
memory_region_init_io(&s->io, &vmport_ops, s, "vmport", 1);
|
||||
isa_register_ioport(dev, &s->io, 0x5658);
|
||||
isa_register_ioport(isadev, &s->io, 0x5658);
|
||||
|
||||
port_state = s;
|
||||
/* Register some generic port commands */
|
||||
vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL);
|
||||
vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void vmport_class_initfn(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
|
||||
ic->init = vmport_initfn;
|
||||
|
||||
dc->realize = vmport_realizefn;
|
||||
dc->no_user = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue