Message ID | 20230704145012.49870-9-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw/timer/arm_timer: QOM'ify ARM_TIMER and correct sysbus/irq in ICP_PIT | expand |
On 7/4/23 16:50, Philippe Mathieu-Daudé wrote: > Extract arm_timer_reset_hold() before converting this model to > QOM/QDev in few commits. This will become our ResettableHoldPhase > handler. > > Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org> > --- > hw/timer/arm_timer.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c index 8dae845998..0d7fac4d78 100644 --- a/hw/timer/arm_timer.c +++ b/hw/timer/arm_timer.c @@ -172,13 +172,20 @@ static const VMStateDescription vmstate_arm_timer = { } }; +static void arm_timer_reset_hold(ArmTimer *s) +{ + s->limit = 0; + s->int_level = 0; + s->control = TIMER_CTRL_IE; +} + static ArmTimer *arm_timer_init(uint32_t freq) { ArmTimer *s; s = g_new0(ArmTimer, 1); s->freq = freq; - s->control = TIMER_CTRL_IE; + arm_timer_reset_hold(s); s->timer = ptimer_init(arm_timer_tick, s, PTIMER_POLICY_LEGACY); vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY, &vmstate_arm_timer, s);
Extract arm_timer_reset_hold() before converting this model to QOM/QDev in few commits. This will become our ResettableHoldPhase handler. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/timer/arm_timer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)