aboutsummaryrefslogtreecommitdiff
path: root/hw/isa
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-02-09 11:55:03 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2023-02-27 22:29:02 +0100
commitd2fbec575f652dc35239c5b026f7ebabc548beb1 (patch)
treebe47d0668f694fe727eb1ee63409d533a3f9d761 /hw/isa
parentdc8d6cf2033c813ade9863a926f2d71a22edd249 (diff)
hw/isa: Factor isa_bus_get_irq() out of isa_get_irq()
isa_get_irq() was added in commit 3a38d437ca ("Add isa_reserve_irq()" Fri Aug 14 11:36:15 2009) as: a temporary interface to be used to allocate ISA IRQs for devices which have not yet been converted to qdev, and for special cases which are not suited for qdev conversions, such as the 'ferr'. We still use it 14 years later, using the global 'isabus' singleton. In order to get rid of such *temporary* interface, extract isa_bus_get_irq() which can take any ISABus* object. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20230215161641.32663-3-philmd@linaro.org>
Diffstat (limited to 'hw/isa')
-rw-r--r--hw/isa/isa-bus.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index 80d8fb4c5b..a289eccfb1 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -72,6 +72,13 @@ void isa_bus_register_input_irqs(ISABus *bus, qemu_irq *irqs_in)
bus->irqs_in = irqs_in;
}
+qemu_irq isa_bus_get_irq(ISABus *bus, unsigned irqnum)
+{
+ assert(irqnum < ISA_NUM_IRQS);
+ assert(bus->irqs_in);
+ return bus->irqs_in[irqnum];
+}
+
/*
* isa_get_irq() returns the corresponding input qemu_irq entry for the i8259.
*
@@ -81,14 +88,13 @@ void isa_bus_register_input_irqs(ISABus *bus, qemu_irq *irqs_in)
qemu_irq isa_get_irq(ISADevice *dev, unsigned isairq)
{
assert(!dev || ISA_BUS(qdev_get_parent_bus(DEVICE(dev))) == isabus);
- assert(isairq < ISA_NUM_IRQS);
- return isabus->irqs_in[isairq];
+ return isa_bus_get_irq(isabus, isairq);
}
void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, unsigned isairq)
{
- qemu_irq irq = isa_get_irq(isadev, isairq);
- qdev_connect_gpio_out(DEVICE(isadev), gpioirq, irq);
+ qemu_irq input_irq = isa_get_irq(isadev, isairq);
+ qdev_connect_gpio_out(DEVICE(isadev), gpioirq, input_irq);
}
void isa_bus_dma(ISABus *bus, IsaDma *dma8, IsaDma *dma16)