mirror of https://gitee.com/openkylin/qemu.git
hw/gpio: QOM'ify pl061.c
* Merge the pl061_initfn into pl061_init * Drop the old SysBus init function and use instance_init Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Message-id: 1465815255-21776-7-git-send-email-zxq_yx_007@163.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
ebc116f8c3
commit
09e6fb3e36
|
@ -341,20 +341,6 @@ static const MemoryRegionOps pl061_ops = {
|
||||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int pl061_initfn(SysBusDevice *sbd)
|
|
||||||
{
|
|
||||||
DeviceState *dev = DEVICE(sbd);
|
|
||||||
PL061State *s = PL061(dev);
|
|
||||||
|
|
||||||
memory_region_init_io(&s->iomem, OBJECT(s), &pl061_ops, s, "pl061", 0x1000);
|
|
||||||
sysbus_init_mmio(sbd, &s->iomem);
|
|
||||||
sysbus_init_irq(sbd, &s->irq);
|
|
||||||
qdev_init_gpio_in(dev, pl061_set_irq, 8);
|
|
||||||
qdev_init_gpio_out(dev, s->out, 8);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pl061_luminary_init(Object *obj)
|
static void pl061_luminary_init(Object *obj)
|
||||||
{
|
{
|
||||||
PL061State *s = PL061(obj);
|
PL061State *s = PL061(obj);
|
||||||
|
@ -366,17 +352,23 @@ static void pl061_luminary_init(Object *obj)
|
||||||
static void pl061_init(Object *obj)
|
static void pl061_init(Object *obj)
|
||||||
{
|
{
|
||||||
PL061State *s = PL061(obj);
|
PL061State *s = PL061(obj);
|
||||||
|
DeviceState *dev = DEVICE(obj);
|
||||||
|
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
|
||||||
|
|
||||||
s->id = pl061_id;
|
s->id = pl061_id;
|
||||||
s->rsvd_start = 0x424;
|
s->rsvd_start = 0x424;
|
||||||
|
|
||||||
|
memory_region_init_io(&s->iomem, obj, &pl061_ops, s, "pl061", 0x1000);
|
||||||
|
sysbus_init_mmio(sbd, &s->iomem);
|
||||||
|
sysbus_init_irq(sbd, &s->irq);
|
||||||
|
qdev_init_gpio_in(dev, pl061_set_irq, 8);
|
||||||
|
qdev_init_gpio_out(dev, s->out, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pl061_class_init(ObjectClass *klass, void *data)
|
static void pl061_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
|
||||||
|
|
||||||
k->init = pl061_initfn;
|
|
||||||
dc->vmsd = &vmstate_pl061;
|
dc->vmsd = &vmstate_pl061;
|
||||||
dc->reset = &pl061_reset;
|
dc->reset = &pl061_reset;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue