pc: Generalize ISA IRQs to GSIs
The ISA bus IRQ range is 0..15. What isa_irq_handler and IsaIrqState are
actually dealing with are the Global System Interrupts. Refactor the
code to clarify this.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
diff --git a/hw/pc.c b/hw/pc.c
index ff081d9..9b68695 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -88,15 +88,15 @@
static struct e820_table e820_table;
struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};
-void isa_irq_handler(void *opaque, int n, int level)
+void gsi_handler(void *opaque, int n, int level)
{
- IsaIrqState *isa = (IsaIrqState *)opaque;
+ GSIState *s = opaque;
- DPRINTF("isa_irqs: %s irq %d\n", level? "raise" : "lower", n);
- if (n < 16) {
- qemu_set_irq(isa->i8259[n], level);
+ DPRINTF("pc: %s GSI %d\n", level ? "raising" : "lowering", n);
+ if (n < ISA_NUM_IRQS) {
+ qemu_set_irq(s->i8259_irq[n], level);
}
- qemu_set_irq(isa->ioapic[n], level);
+ qemu_set_irq(s->ioapic_irq[n], level);
}
static void ioport80_write(void *opaque, uint32_t addr, uint32_t data)
@@ -1125,7 +1125,7 @@
}
}
-void pc_basic_device_init(qemu_irq *isa_irq,
+void pc_basic_device_init(qemu_irq *gsi,
ISADevice **rtc_state,
bool no_vmport)
{
@@ -1144,8 +1144,8 @@
DeviceState *hpet = sysbus_try_create_simple("hpet", HPET_BASE, NULL);
if (hpet) {
- for (i = 0; i < 24; i++) {
- sysbus_connect_irq(sysbus_from_qdev(hpet), i, isa_irq[i]);
+ for (i = 0; i < GSI_NUM_PINS; i++) {
+ sysbus_connect_irq(sysbus_from_qdev(hpet), i, gsi[i]);
}
rtc_irq = qdev_get_gpio_in(hpet, 0);
}