diff options
Diffstat (limited to 'hw/arm_gic.c')
-rw-r--r-- | hw/arm_gic.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/hw/arm_gic.c b/hw/arm_gic.c index 2901f34..eee5b7c 100644 --- a/hw/arm_gic.c +++ b/hw/arm_gic.c @@ -60,10 +60,8 @@ typedef struct gic_irq_state typedef struct gic_state { - arm_pic_handler handler; uint32_t base; - void *parent; - int parent_irq; + qemu_irq parent_irq; int enabled; int cpu_enabled; @@ -88,7 +86,7 @@ static void gic_update(gic_state *s) s->current_pending = 1023; if (!s->enabled || !s->cpu_enabled) { - pic_set_irq_new(s->parent, s->parent_irq, 0); + qemu_irq_lower(s->parent_irq); return; } best_prio = 0x100; @@ -102,12 +100,12 @@ static void gic_update(gic_state *s) } } if (best_prio > s->priority_mask) { - pic_set_irq_new(s->parent, s->parent_irq, 0); + qemu_irq_lower(s->parent_irq); } else { s->current_pending = best_irq; if (best_prio < s->running_priority) { DPRINTF("Raised pending IRQ %d\n", best_irq); - pic_set_irq_new(s->parent, s->parent_irq, 1); + qemu_irq_raise(s->parent_irq); } } } @@ -150,7 +148,7 @@ static uint32_t gic_acknowledge_irq(gic_state *s) DPRINTF("ACK no pending IRQ\n"); return 1023; } - pic_set_irq_new(s->parent, s->parent_irq, 0); + qemu_irq_lower(s->parent_irq); s->last_active[new_irq] = s->running_irq; /* For level triggered interrupts we clear the pending bit while the interrupt is active. */ @@ -520,16 +518,16 @@ static void gic_reset(gic_state *s) s->cpu_enabled = 0; } -void *arm_gic_init(uint32_t base, void *parent, int parent_irq) +qemu_irq *arm_gic_init(uint32_t base, qemu_irq parent_irq) { gic_state *s; + qemu_irq *qi; int iomemtype; s = (gic_state *)qemu_mallocz(sizeof(gic_state)); if (!s) return NULL; - s->handler = gic_set_irq; - s->parent = parent; + qi = qemu_allocate_irqs(gic_set_irq, s, GIC_NIRQ); s->parent_irq = parent_irq; if (base != 0xffffffff) { iomemtype = cpu_register_io_memory(0, gic_cpu_readfn, @@ -543,5 +541,5 @@ void *arm_gic_init(uint32_t base, void *parent, int parent_irq) s->base = 0; } gic_reset(s); - return s; + return qi; } |