Signed-off-by: Hervé Poussineau <hpous...@reactos.org> --- hw/mips_fulong2e.c | 9 ++------- hw/vt82c686.c | 24 ++++++++++++++++++++++-- hw/vt82c686.h | 2 +- 3 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/hw/mips_fulong2e.c b/hw/mips_fulong2e.c index f52b8c5..3034a9c 100644 --- a/hw/mips_fulong2e.c +++ b/hw/mips_fulong2e.c @@ -262,7 +262,6 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, MemoryRegion *bios = g_new(MemoryRegion, 1); long bios_size; int64_t kernel_entry; - qemu_irq *i8259; qemu_irq *cpu_exit_irq; int via_devfn; PCIBus *pci_bus; @@ -331,23 +330,19 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); - /* Interrupt controller */ - /* The 8259 -> IP5 */ - i8259 = i8259_init(env->irq[5]); - /* North bridge, Bonito --> IP2 */ pci_bus = bonito_init((qemu_irq *)&(env->irq[2])); /* South bridge */ ide_drive_get(hd, MAX_IDE_BUS); - via_devfn = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0)); + via_devfn = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0), + env->irq[5]); if (via_devfn < 0) { fprintf(stderr, "vt82c686b_init error\n"); exit(1); } - isa_bus_irqs(i8259); vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1)); usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2)); usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3)); diff --git a/hw/vt82c686.c b/hw/vt82c686.c index 37c64d4..59941fc 100644 --- a/hw/vt82c686.c +++ b/hw/vt82c686.c @@ -41,6 +41,8 @@ typedef struct SuperIOConfig typedef struct VT82C686BState { PCIDevice dev; + ISABus bus; + qemu_irq *pic; SuperIOConfig superio_conf; } VT82C686BState; @@ -483,14 +485,28 @@ static const VMStateDescription vmstate_via = { } }; +static qemu_irq vt82c_bus_get_irq(ISABus *bus, int isairq) +{ + VT82C686BState *vt82c = container_of(bus, VT82C686BState, bus); + if (isairq < 0 || isairq >= 16) { + hw_error("isa irq %d invalid", isairq); + } + return vt82c->pic[isairq]; +} + +static ISABusOps vt82c_bus_ops = { + .get_irq = vt82c_bus_get_irq, +}; + /* init the PCI-to-ISA bridge */ static int vt82c686b_initfn(PCIDevice *d) { + VT82C686BState *vt82c = DO_UPCAST(VT82C686BState, dev, d); uint8_t *pci_conf; uint8_t *wmask; int i; - isa_bus_bridge_init(&d->qdev); + isa_bus_new(&vt82c->bus, &vt82c_bus_ops, &d->qdev); pci_conf = d->config; pci_config_set_prog_interface(pci_conf, 0x0); @@ -507,12 +523,16 @@ static int vt82c686b_initfn(PCIDevice *d) return 0; } -int vt82c686b_init(PCIBus *bus, int devfn) +int vt82c686b_init(PCIBus *bus, int devfn, qemu_irq parent_irq) { PCIDevice *d; + VT82C686BState *vt82c; d = pci_create_simple_multifunction(bus, devfn, true, "VT82C686B"); + vt82c = DO_UPCAST(VT82C686BState, dev, d); + vt82c->pic = i8259_init(parent_irq); + return d->devfn; } diff --git a/hw/vt82c686.h b/hw/vt82c686.h index e3270ca..1a026c2 100644 --- a/hw/vt82c686.h +++ b/hw/vt82c686.h @@ -2,7 +2,7 @@ #define HW_VT82C686_H /* vt82c686.c */ -int vt82c686b_init(PCIBus * bus, int devfn); +int vt82c686b_init(PCIBus *bus, int devfn, qemu_irq parent_irq); void vt82c686b_ac97_init(PCIBus *bus, int devfn); void vt82c686b_mc97_init(PCIBus *bus, int devfn); i2c_bus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, -- 1.7.5.4