Message ID | 20220404154658.565020-3-peter.maydell@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | hw/arm: Make exynos4210 use TYPE_SPLIT_IRQ | expand |
On [2022 Apr 04] Mon 16:46:42, Peter Maydell wrote: > Now we have removed the only use of TYPE_EXYNOS4210_IRQ_GATE we can > delete the device entirely. > > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> > --- > hw/intc/exynos4210_gic.c | 107 --------------------------------------- > 1 file changed, 107 deletions(-) > > diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c > index bc73d1f1152..794f6b5ac72 100644 > --- a/hw/intc/exynos4210_gic.c > +++ b/hw/intc/exynos4210_gic.c > @@ -373,110 +373,3 @@ static void exynos4210_gic_register_types(void) > } > > type_init(exynos4210_gic_register_types) > - > -/* IRQ OR Gate struct. > - * > - * This device models an OR gate. There are n_in input qdev gpio lines and one > - * output sysbus IRQ line. The output IRQ level is formed as OR between all > - * gpio inputs. > - */ > - > -#define TYPE_EXYNOS4210_IRQ_GATE "exynos4210.irq_gate" > -OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210IRQGateState, EXYNOS4210_IRQ_GATE) > - > -struct Exynos4210IRQGateState { > - SysBusDevice parent_obj; > - > - uint32_t n_in; /* inputs amount */ > - uint32_t *level; /* input levels */ > - qemu_irq out; /* output IRQ */ > -}; > - > -static Property exynos4210_irq_gate_properties[] = { > - DEFINE_PROP_UINT32("n_in", Exynos4210IRQGateState, n_in, 1), > - DEFINE_PROP_END_OF_LIST(), > -}; > - > -static const VMStateDescription vmstate_exynos4210_irq_gate = { > - .name = "exynos4210.irq_gate", > - .version_id = 2, > - .minimum_version_id = 2, > - .fields = (VMStateField[]) { > - VMSTATE_VBUFFER_UINT32(level, Exynos4210IRQGateState, 1, NULL, n_in), > - VMSTATE_END_OF_LIST() > - } > -}; > - > -/* Process a change in IRQ input. */ > -static void exynos4210_irq_gate_handler(void *opaque, int irq, int level) > -{ > - Exynos4210IRQGateState *s = (Exynos4210IRQGateState *)opaque; > - uint32_t i; > - > - assert(irq < s->n_in); > - > - s->level[irq] = level; > - > - for (i = 0; i < s->n_in; i++) { > - if (s->level[i] >= 1) { > - qemu_irq_raise(s->out); > - return; > - } > - } > - > - qemu_irq_lower(s->out); > -} > - > -static void exynos4210_irq_gate_reset(DeviceState *d) > -{ > - Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(d); > - > - memset(s->level, 0, s->n_in * sizeof(*s->level)); > -} > - > -/* > - * IRQ Gate initialization. > - */ > -static void exynos4210_irq_gate_init(Object *obj) > -{ > - Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(obj); > - SysBusDevice *sbd = SYS_BUS_DEVICE(obj); > - > - sysbus_init_irq(sbd, &s->out); > -} > - > -static void exynos4210_irq_gate_realize(DeviceState *dev, Error **errp) > -{ > - Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(dev); > - > - /* Allocate general purpose input signals and connect a handler to each of > - * them */ > - qdev_init_gpio_in(dev, exynos4210_irq_gate_handler, s->n_in); > - > - s->level = g_malloc0(s->n_in * sizeof(*s->level)); > -} > - > -static void exynos4210_irq_gate_class_init(ObjectClass *klass, void *data) > -{ > - DeviceClass *dc = DEVICE_CLASS(klass); > - > - dc->reset = exynos4210_irq_gate_reset; > - dc->vmsd = &vmstate_exynos4210_irq_gate; > - device_class_set_props(dc, exynos4210_irq_gate_properties); > - dc->realize = exynos4210_irq_gate_realize; > -} > - > -static const TypeInfo exynos4210_irq_gate_info = { > - .name = TYPE_EXYNOS4210_IRQ_GATE, > - .parent = TYPE_SYS_BUS_DEVICE, > - .instance_size = sizeof(Exynos4210IRQGateState), > - .instance_init = exynos4210_irq_gate_init, > - .class_init = exynos4210_irq_gate_class_init, > -}; > - > -static void exynos4210_irq_gate_register_types(void) > -{ > - type_register_static(&exynos4210_irq_gate_info); > -} > - > -type_init(exynos4210_irq_gate_register_types) > -- > 2.25.1 > >
diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c index bc73d1f1152..794f6b5ac72 100644 --- a/hw/intc/exynos4210_gic.c +++ b/hw/intc/exynos4210_gic.c @@ -373,110 +373,3 @@ static void exynos4210_gic_register_types(void) } type_init(exynos4210_gic_register_types) - -/* IRQ OR Gate struct. - * - * This device models an OR gate. There are n_in input qdev gpio lines and one - * output sysbus IRQ line. The output IRQ level is formed as OR between all - * gpio inputs. - */ - -#define TYPE_EXYNOS4210_IRQ_GATE "exynos4210.irq_gate" -OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210IRQGateState, EXYNOS4210_IRQ_GATE) - -struct Exynos4210IRQGateState { - SysBusDevice parent_obj; - - uint32_t n_in; /* inputs amount */ - uint32_t *level; /* input levels */ - qemu_irq out; /* output IRQ */ -}; - -static Property exynos4210_irq_gate_properties[] = { - DEFINE_PROP_UINT32("n_in", Exynos4210IRQGateState, n_in, 1), - DEFINE_PROP_END_OF_LIST(), -}; - -static const VMStateDescription vmstate_exynos4210_irq_gate = { - .name = "exynos4210.irq_gate", - .version_id = 2, - .minimum_version_id = 2, - .fields = (VMStateField[]) { - VMSTATE_VBUFFER_UINT32(level, Exynos4210IRQGateState, 1, NULL, n_in), - VMSTATE_END_OF_LIST() - } -}; - -/* Process a change in IRQ input. */ -static void exynos4210_irq_gate_handler(void *opaque, int irq, int level) -{ - Exynos4210IRQGateState *s = (Exynos4210IRQGateState *)opaque; - uint32_t i; - - assert(irq < s->n_in); - - s->level[irq] = level; - - for (i = 0; i < s->n_in; i++) { - if (s->level[i] >= 1) { - qemu_irq_raise(s->out); - return; - } - } - - qemu_irq_lower(s->out); -} - -static void exynos4210_irq_gate_reset(DeviceState *d) -{ - Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(d); - - memset(s->level, 0, s->n_in * sizeof(*s->level)); -} - -/* - * IRQ Gate initialization. - */ -static void exynos4210_irq_gate_init(Object *obj) -{ - Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(obj); - SysBusDevice *sbd = SYS_BUS_DEVICE(obj); - - sysbus_init_irq(sbd, &s->out); -} - -static void exynos4210_irq_gate_realize(DeviceState *dev, Error **errp) -{ - Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(dev); - - /* Allocate general purpose input signals and connect a handler to each of - * them */ - qdev_init_gpio_in(dev, exynos4210_irq_gate_handler, s->n_in); - - s->level = g_malloc0(s->n_in * sizeof(*s->level)); -} - -static void exynos4210_irq_gate_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - - dc->reset = exynos4210_irq_gate_reset; - dc->vmsd = &vmstate_exynos4210_irq_gate; - device_class_set_props(dc, exynos4210_irq_gate_properties); - dc->realize = exynos4210_irq_gate_realize; -} - -static const TypeInfo exynos4210_irq_gate_info = { - .name = TYPE_EXYNOS4210_IRQ_GATE, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(Exynos4210IRQGateState), - .instance_init = exynos4210_irq_gate_init, - .class_init = exynos4210_irq_gate_class_init, -}; - -static void exynos4210_irq_gate_register_types(void) -{ - type_register_static(&exynos4210_irq_gate_info); -} - -type_init(exynos4210_irq_gate_register_types)
Now we have removed the only use of TYPE_EXYNOS4210_IRQ_GATE we can delete the device entirely. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- hw/intc/exynos4210_gic.c | 107 --------------------------------------- 1 file changed, 107 deletions(-)