[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 03/18] hw: Replace isa_get_irq() by isa_bus_get_irq() when ISA
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 03/18] hw: Replace isa_get_irq() by isa_bus_get_irq() when ISABus is available |
Date: |
Wed, 15 Feb 2023 17:16:26 +0100 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/audio/cs4231a.c | 5 +++--
hw/audio/gus.c | 5 +++--
hw/audio/sb16.c | 7 ++++---
hw/block/fdc-isa.c | 5 +++--
include/hw/timer/i8254.h | 3 ++-
5 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c
index ec066fcd89..5c6d643732 100644
--- a/hw/audio/cs4231a.c
+++ b/hw/audio/cs4231a.c
@@ -668,16 +668,17 @@ static void cs4231a_initfn (Object *obj)
static void cs4231a_realizefn (DeviceState *dev, Error **errp)
{
ISADevice *d = ISA_DEVICE (dev);
+ ISABus *bus = isa_bus_from_device(d);
CSState *s = CS4231A (dev);
IsaDmaClass *k;
- s->isa_dma = isa_bus_get_dma(isa_bus_from_device(d), s->dma);
+ s->isa_dma = isa_bus_get_dma(bus, s->dma);
if (!s->isa_dma) {
error_setg(errp, "ISA controller does not support DMA");
return;
}
- s->pic = isa_get_irq(d, s->irq);
+ s->pic = isa_bus_get_irq(bus, s->irq);
k = ISADMA_GET_CLASS(s->isa_dma);
k->register_channel(s->isa_dma, s->dma, cs_dma_read, s);
diff --git a/hw/audio/gus.c b/hw/audio/gus.c
index 2a08a0f7d7..787345ce54 100644
--- a/hw/audio/gus.c
+++ b/hw/audio/gus.c
@@ -236,11 +236,12 @@ static const MemoryRegionPortio gus_portio_list2[] = {
static void gus_realizefn (DeviceState *dev, Error **errp)
{
ISADevice *d = ISA_DEVICE(dev);
+ ISABus *bus = isa_bus_from_device(d);
GUSState *s = GUS (dev);
IsaDmaClass *k;
struct audsettings as;
- s->isa_dma = isa_bus_get_dma(isa_bus_from_device(d), s->emu.gusdma);
+ s->isa_dma = isa_bus_get_dma(bus, s->emu.gusdma);
if (!s->isa_dma) {
error_setg(errp, "ISA controller does not support DMA");
return;
@@ -282,7 +283,7 @@ static void gus_realizefn (DeviceState *dev, Error **errp)
s->emu.himemaddr = s->himem;
s->emu.gusdatapos = s->emu.himemaddr + 1024 * 1024 + 32;
s->emu.opaque = s;
- s->pic = isa_get_irq(d, s->emu.gusirq);
+ s->pic = isa_bus_get_irq(bus, s->emu.gusirq);
AUD_set_active_out (s->voice, 1);
}
diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c
index ae745c7283..535ccccdc9 100644
--- a/hw/audio/sb16.c
+++ b/hw/audio/sb16.c
@@ -1398,17 +1398,18 @@ static void sb16_initfn (Object *obj)
static void sb16_realizefn (DeviceState *dev, Error **errp)
{
ISADevice *isadev = ISA_DEVICE (dev);
+ ISABus *bus = isa_bus_from_device(isadev);
SB16State *s = SB16 (dev);
IsaDmaClass *k;
- s->isa_hdma = isa_bus_get_dma(isa_bus_from_device(isadev), s->hdma);
- s->isa_dma = isa_bus_get_dma(isa_bus_from_device(isadev), s->dma);
+ s->isa_hdma = isa_bus_get_dma(bus, s->hdma);
+ s->isa_dma = isa_bus_get_dma(bus, s->dma);
if (!s->isa_dma || !s->isa_hdma) {
error_setg(errp, "ISA controller does not support DMA");
return;
}
- s->pic = isa_get_irq(isadev, s->irq);
+ s->pic = isa_bus_get_irq(bus, s->irq);
s->mixer_regs[0x80] = magic_of_irq (s->irq);
s->mixer_regs[0x81] = (1 << s->dma) | (1 << s->hdma);
diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c
index a5f07b668d..7ec075e470 100644
--- a/hw/block/fdc-isa.c
+++ b/hw/block/fdc-isa.c
@@ -86,6 +86,7 @@ static const MemoryRegionPortio fdc_portio_list[] = {
static void isabus_fdc_realize(DeviceState *dev, Error **errp)
{
ISADevice *isadev = ISA_DEVICE(dev);
+ ISABus *bus = isa_bus_from_device(isadev);
FDCtrlISABus *isa = ISA_FDC(dev);
FDCtrl *fdctrl = &isa->state;
Error *err = NULL;
@@ -94,11 +95,11 @@ static void isabus_fdc_realize(DeviceState *dev, Error
**errp)
isa->iobase, fdc_portio_list, fdctrl,
"fdc");
- fdctrl->irq = isa_get_irq(isadev, isa->irq);
+ fdctrl->irq = isa_bus_get_irq(bus, isa->irq);
fdctrl->dma_chann = isa->dma;
if (fdctrl->dma_chann != -1) {
IsaDmaClass *k;
- fdctrl->dma = isa_bus_get_dma(isa_bus_from_device(isadev), isa->dma);
+ fdctrl->dma = isa_bus_get_dma(bus, isa->dma);
if (!fdctrl->dma) {
error_setg(errp, "ISA controller does not support DMA");
return;
diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h
index 3e569f42b6..8402caad30 100644
--- a/include/hw/timer/i8254.h
+++ b/include/hw/timer/i8254.h
@@ -56,7 +56,8 @@ static inline ISADevice *i8254_pit_init(ISABus *bus, int
base, int isa_irq,
qdev_prop_set_uint32(dev, "iobase", base);
isa_realize_and_unref(d, bus, &error_fatal);
qdev_connect_gpio_out(dev, 0,
- isa_irq >= 0 ? isa_get_irq(d, isa_irq) : alt_irq);
+ isa_irq >= 0 ? isa_bus_get_irq(bus, isa_irq)
+ : alt_irq);
return d;
}
--
2.38.1
- [PATCH v2 00/18] hw/ide: Untangle ISA/PCI abuses of ide_init_ioport(), Philippe Mathieu-Daudé, 2023/02/15
- [PATCH v2 01/18] hw/isa: Rename isa_get_dma() -> isa_bus_get_dma(), Philippe Mathieu-Daudé, 2023/02/15
- [PATCH v2 02/18] hw/isa: Factor isa_bus_get_irq() out of isa_get_irq(), Philippe Mathieu-Daudé, 2023/02/15
- [PATCH v2 03/18] hw: Replace isa_get_irq() by isa_bus_get_irq() when ISABus is available,
Philippe Mathieu-Daudé <=
- [PATCH v2 04/18] hw/ide/piix: Expose output IRQ as properties for late object population, Philippe Mathieu-Daudé, 2023/02/15
- [PATCH v2 05/18] hw/i386/pc_piix: Wire PIIX3 IDE ouput IRQs to ISA bus IRQs 14/15, Philippe Mathieu-Daudé, 2023/02/15
- [PATCH v2 06/18] hw/isa/piix4: Wire PIIX4 IDE ouput IRQs to ISA bus IRQs 14/15, Philippe Mathieu-Daudé, 2023/02/15
- [PATCH v2 07/18] hw/ide/piix: Ensure IDE output IRQs are wired at realization, Philippe Mathieu-Daudé, 2023/02/15