mirror of https://gitee.com/openkylin/qemu.git
cadence_gem: QOMify Cadence GEM
The sysbus_init_irq() call will eventually depend on a property so it needs to be in the realize function. Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 486595809cf416d18a750aafbcfa1c81d7160c59.1469727764.git.alistair.francis@xilinx.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
5b262bb697
commit
bcb39a65f1
|
@ -1214,24 +1214,30 @@ static NetClientInfo net_gem_info = {
|
||||||
.link_status_changed = gem_set_link,
|
.link_status_changed = gem_set_link,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int gem_init(SysBusDevice *sbd)
|
static void gem_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(sbd);
|
|
||||||
CadenceGEMState *s = CADENCE_GEM(dev);
|
CadenceGEMState *s = CADENCE_GEM(dev);
|
||||||
|
|
||||||
|
sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq);
|
||||||
|
|
||||||
|
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||||
|
|
||||||
|
s->nic = qemu_new_nic(&net_gem_info, &s->conf,
|
||||||
|
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gem_init(Object *obj)
|
||||||
|
{
|
||||||
|
CadenceGEMState *s = CADENCE_GEM(obj);
|
||||||
|
DeviceState *dev = DEVICE(obj);
|
||||||
|
|
||||||
DB_PRINT("\n");
|
DB_PRINT("\n");
|
||||||
|
|
||||||
gem_init_register_masks(s);
|
gem_init_register_masks(s);
|
||||||
memory_region_init_io(&s->iomem, OBJECT(s), &gem_ops, s,
|
memory_region_init_io(&s->iomem, OBJECT(s), &gem_ops, s,
|
||||||
"enet", sizeof(s->regs));
|
"enet", sizeof(s->regs));
|
||||||
sysbus_init_mmio(sbd, &s->iomem);
|
|
||||||
sysbus_init_irq(sbd, &s->irq);
|
|
||||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
|
||||||
|
|
||||||
s->nic = qemu_new_nic(&net_gem_info, &s->conf,
|
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
|
||||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const VMStateDescription vmstate_cadence_gem = {
|
static const VMStateDescription vmstate_cadence_gem = {
|
||||||
|
@ -1257,9 +1263,8 @@ static Property gem_properties[] = {
|
||||||
static void gem_class_init(ObjectClass *klass, void *data)
|
static void gem_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
|
|
||||||
|
|
||||||
sdc->init = gem_init;
|
dc->realize = gem_realize;
|
||||||
dc->props = gem_properties;
|
dc->props = gem_properties;
|
||||||
dc->vmsd = &vmstate_cadence_gem;
|
dc->vmsd = &vmstate_cadence_gem;
|
||||||
dc->reset = gem_reset;
|
dc->reset = gem_reset;
|
||||||
|
@ -1269,6 +1274,7 @@ static const TypeInfo gem_info = {
|
||||||
.name = TYPE_CADENCE_GEM,
|
.name = TYPE_CADENCE_GEM,
|
||||||
.parent = TYPE_SYS_BUS_DEVICE,
|
.parent = TYPE_SYS_BUS_DEVICE,
|
||||||
.instance_size = sizeof(CadenceGEMState),
|
.instance_size = sizeof(CadenceGEMState),
|
||||||
|
.instance_init = gem_init,
|
||||||
.class_init = gem_class_init,
|
.class_init = gem_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue