integratorcp: QOM cast cleanup for icp_pic_state
Introduce type constant and use QOM cast. Fix indentation. Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
257ec289b2
commit
91b646264e
|
@ -271,15 +271,21 @@ static int integratorcm_init(SysBusDevice *dev)
|
||||||
/* Integrator/CP hardware emulation. */
|
/* Integrator/CP hardware emulation. */
|
||||||
/* Primary interrupt controller. */
|
/* Primary interrupt controller. */
|
||||||
|
|
||||||
typedef struct icp_pic_state
|
#define TYPE_INTEGRATOR_PIC "integrator_pic"
|
||||||
{
|
#define INTEGRATOR_PIC(obj) \
|
||||||
SysBusDevice busdev;
|
OBJECT_CHECK(icp_pic_state, (obj), TYPE_INTEGRATOR_PIC)
|
||||||
MemoryRegion iomem;
|
|
||||||
uint32_t level;
|
typedef struct icp_pic_state {
|
||||||
uint32_t irq_enabled;
|
/*< private >*/
|
||||||
uint32_t fiq_enabled;
|
SysBusDevice parent_obj;
|
||||||
qemu_irq parent_irq;
|
/*< public >*/
|
||||||
qemu_irq parent_fiq;
|
|
||||||
|
MemoryRegion iomem;
|
||||||
|
uint32_t level;
|
||||||
|
uint32_t irq_enabled;
|
||||||
|
uint32_t fiq_enabled;
|
||||||
|
qemu_irq parent_irq;
|
||||||
|
qemu_irq parent_fiq;
|
||||||
} icp_pic_state;
|
} icp_pic_state;
|
||||||
|
|
||||||
static void icp_pic_update(icp_pic_state *s)
|
static void icp_pic_update(icp_pic_state *s)
|
||||||
|
@ -374,16 +380,17 @@ static const MemoryRegionOps icp_pic_ops = {
|
||||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int icp_pic_init(SysBusDevice *dev)
|
static int icp_pic_init(SysBusDevice *sbd)
|
||||||
{
|
{
|
||||||
icp_pic_state *s = FROM_SYSBUS(icp_pic_state, dev);
|
DeviceState *dev = DEVICE(sbd);
|
||||||
|
icp_pic_state *s = INTEGRATOR_PIC(dev);
|
||||||
|
|
||||||
qdev_init_gpio_in(&dev->qdev, icp_pic_set_irq, 32);
|
qdev_init_gpio_in(dev, icp_pic_set_irq, 32);
|
||||||
sysbus_init_irq(dev, &s->parent_irq);
|
sysbus_init_irq(sbd, &s->parent_irq);
|
||||||
sysbus_init_irq(dev, &s->parent_fiq);
|
sysbus_init_irq(sbd, &s->parent_fiq);
|
||||||
memory_region_init_io(&s->iomem, OBJECT(s), &icp_pic_ops, s,
|
memory_region_init_io(&s->iomem, OBJECT(s), &icp_pic_ops, s,
|
||||||
"icp-pic", 0x00800000);
|
"icp-pic", 0x00800000);
|
||||||
sysbus_init_mmio(dev, &s->iomem);
|
sysbus_init_mmio(sbd, &s->iomem);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,13 +494,13 @@ static void integratorcp_init(QEMUMachineInitArgs *args)
|
||||||
sysbus_mmio_map((SysBusDevice *)dev, 0, 0x10000000);
|
sysbus_mmio_map((SysBusDevice *)dev, 0, 0x10000000);
|
||||||
|
|
||||||
cpu_pic = arm_pic_init_cpu(cpu);
|
cpu_pic = arm_pic_init_cpu(cpu);
|
||||||
dev = sysbus_create_varargs("integrator_pic", 0x14000000,
|
dev = sysbus_create_varargs(TYPE_INTEGRATOR_PIC, 0x14000000,
|
||||||
cpu_pic[ARM_PIC_CPU_IRQ],
|
cpu_pic[ARM_PIC_CPU_IRQ],
|
||||||
cpu_pic[ARM_PIC_CPU_FIQ], NULL);
|
cpu_pic[ARM_PIC_CPU_FIQ], NULL);
|
||||||
for (i = 0; i < 32; i++) {
|
for (i = 0; i < 32; i++) {
|
||||||
pic[i] = qdev_get_gpio_in(dev, i);
|
pic[i] = qdev_get_gpio_in(dev, i);
|
||||||
}
|
}
|
||||||
sysbus_create_simple("integrator_pic", 0xca000000, pic[26]);
|
sysbus_create_simple(TYPE_INTEGRATOR_PIC, 0xca000000, pic[26]);
|
||||||
sysbus_create_varargs("integrator_pit", 0x13000000,
|
sysbus_create_varargs("integrator_pit", 0x13000000,
|
||||||
pic[5], pic[6], pic[7], NULL);
|
pic[5], pic[6], pic[7], NULL);
|
||||||
sysbus_create_simple("pl031", 0x15000000, pic[8]);
|
sysbus_create_simple("pl031", 0x15000000, pic[8]);
|
||||||
|
@ -559,7 +566,7 @@ static void icp_pic_class_init(ObjectClass *klass, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo icp_pic_info = {
|
static const TypeInfo icp_pic_info = {
|
||||||
.name = "integrator_pic",
|
.name = TYPE_INTEGRATOR_PIC,
|
||||||
.parent = TYPE_SYS_BUS_DEVICE,
|
.parent = TYPE_SYS_BUS_DEVICE,
|
||||||
.instance_size = sizeof(icp_pic_state),
|
.instance_size = sizeof(icp_pic_state),
|
||||||
.class_init = icp_pic_class_init,
|
.class_init = icp_pic_class_init,
|
||||||
|
|
Loading…
Reference in a new issue