hw: Replace isa_get_irq() by isa_bus_get_irq() when ISABus is available
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20230215161641.32663-4-philmd@linaro.org>
This commit is contained in:
parent
d2fbec575f
commit
8e7db8ab51
@ -668,16 +668,17 @@ static void cs4231a_initfn (Object *obj)
|
|||||||
static void cs4231a_realizefn (DeviceState *dev, Error **errp)
|
static void cs4231a_realizefn (DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
ISADevice *d = ISA_DEVICE (dev);
|
ISADevice *d = ISA_DEVICE (dev);
|
||||||
|
ISABus *bus = isa_bus_from_device(d);
|
||||||
CSState *s = CS4231A (dev);
|
CSState *s = CS4231A (dev);
|
||||||
IsaDmaClass *k;
|
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) {
|
if (!s->isa_dma) {
|
||||||
error_setg(errp, "ISA controller does not support DMA");
|
error_setg(errp, "ISA controller does not support DMA");
|
||||||
return;
|
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 = ISADMA_GET_CLASS(s->isa_dma);
|
||||||
k->register_channel(s->isa_dma, s->dma, cs_dma_read, s);
|
k->register_channel(s->isa_dma, s->dma, cs_dma_read, s);
|
||||||
|
|
||||||
|
@ -236,11 +236,12 @@ static const MemoryRegionPortio gus_portio_list2[] = {
|
|||||||
static void gus_realizefn (DeviceState *dev, Error **errp)
|
static void gus_realizefn (DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
ISADevice *d = ISA_DEVICE(dev);
|
ISADevice *d = ISA_DEVICE(dev);
|
||||||
|
ISABus *bus = isa_bus_from_device(d);
|
||||||
GUSState *s = GUS (dev);
|
GUSState *s = GUS (dev);
|
||||||
IsaDmaClass *k;
|
IsaDmaClass *k;
|
||||||
struct audsettings as;
|
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) {
|
if (!s->isa_dma) {
|
||||||
error_setg(errp, "ISA controller does not support DMA");
|
error_setg(errp, "ISA controller does not support DMA");
|
||||||
return;
|
return;
|
||||||
@ -282,7 +283,7 @@ static void gus_realizefn (DeviceState *dev, Error **errp)
|
|||||||
s->emu.himemaddr = s->himem;
|
s->emu.himemaddr = s->himem;
|
||||||
s->emu.gusdatapos = s->emu.himemaddr + 1024 * 1024 + 32;
|
s->emu.gusdatapos = s->emu.himemaddr + 1024 * 1024 + 32;
|
||||||
s->emu.opaque = s;
|
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);
|
AUD_set_active_out (s->voice, 1);
|
||||||
}
|
}
|
||||||
|
@ -1398,17 +1398,18 @@ static void sb16_initfn (Object *obj)
|
|||||||
static void sb16_realizefn (DeviceState *dev, Error **errp)
|
static void sb16_realizefn (DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
ISADevice *isadev = ISA_DEVICE (dev);
|
ISADevice *isadev = ISA_DEVICE (dev);
|
||||||
|
ISABus *bus = isa_bus_from_device(isadev);
|
||||||
SB16State *s = SB16 (dev);
|
SB16State *s = SB16 (dev);
|
||||||
IsaDmaClass *k;
|
IsaDmaClass *k;
|
||||||
|
|
||||||
s->isa_hdma = isa_bus_get_dma(isa_bus_from_device(isadev), s->hdma);
|
s->isa_hdma = isa_bus_get_dma(bus, s->hdma);
|
||||||
s->isa_dma = isa_bus_get_dma(isa_bus_from_device(isadev), s->dma);
|
s->isa_dma = isa_bus_get_dma(bus, s->dma);
|
||||||
if (!s->isa_dma || !s->isa_hdma) {
|
if (!s->isa_dma || !s->isa_hdma) {
|
||||||
error_setg(errp, "ISA controller does not support DMA");
|
error_setg(errp, "ISA controller does not support DMA");
|
||||||
return;
|
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[0x80] = magic_of_irq (s->irq);
|
||||||
s->mixer_regs[0x81] = (1 << s->dma) | (1 << s->hdma);
|
s->mixer_regs[0x81] = (1 << s->dma) | (1 << s->hdma);
|
||||||
|
@ -86,6 +86,7 @@ static const MemoryRegionPortio fdc_portio_list[] = {
|
|||||||
static void isabus_fdc_realize(DeviceState *dev, Error **errp)
|
static void isabus_fdc_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
ISADevice *isadev = ISA_DEVICE(dev);
|
ISADevice *isadev = ISA_DEVICE(dev);
|
||||||
|
ISABus *bus = isa_bus_from_device(isadev);
|
||||||
FDCtrlISABus *isa = ISA_FDC(dev);
|
FDCtrlISABus *isa = ISA_FDC(dev);
|
||||||
FDCtrl *fdctrl = &isa->state;
|
FDCtrl *fdctrl = &isa->state;
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
@ -94,11 +95,11 @@ static void isabus_fdc_realize(DeviceState *dev, Error **errp)
|
|||||||
isa->iobase, fdc_portio_list, fdctrl,
|
isa->iobase, fdc_portio_list, fdctrl,
|
||||||
"fdc");
|
"fdc");
|
||||||
|
|
||||||
fdctrl->irq = isa_get_irq(isadev, isa->irq);
|
fdctrl->irq = isa_bus_get_irq(bus, isa->irq);
|
||||||
fdctrl->dma_chann = isa->dma;
|
fdctrl->dma_chann = isa->dma;
|
||||||
if (fdctrl->dma_chann != -1) {
|
if (fdctrl->dma_chann != -1) {
|
||||||
IsaDmaClass *k;
|
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) {
|
if (!fdctrl->dma) {
|
||||||
error_setg(errp, "ISA controller does not support DMA");
|
error_setg(errp, "ISA controller does not support DMA");
|
||||||
return;
|
return;
|
||||||
|
@ -56,7 +56,8 @@ static inline ISADevice *i8254_pit_init(ISABus *bus, int base, int isa_irq,
|
|||||||
qdev_prop_set_uint32(dev, "iobase", base);
|
qdev_prop_set_uint32(dev, "iobase", base);
|
||||||
isa_realize_and_unref(d, bus, &error_fatal);
|
isa_realize_and_unref(d, bus, &error_fatal);
|
||||||
qdev_connect_gpio_out(dev, 0,
|
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;
|
return d;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user