From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5Inh-0002SA-KY for qemu-devel@nongnu.org; Sun, 18 Sep 2011 10:56:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5Ing-0007SC-AU for qemu-devel@nongnu.org; Sun, 18 Sep 2011 10:56:57 -0400 Received: from smtp5-g21.free.fr ([212.27.42.5]:56047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5Inf-0007Rs-KP for qemu-devel@nongnu.org; Sun, 18 Sep 2011 10:56:56 -0400 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 18 Sep 2011 16:56:38 +0200 Message-Id: <1316357803-2366-7-git-send-email-hpoussin@reactos.org> In-Reply-To: <1316357803-2366-1-git-send-email-hpoussin@reactos.org> References: <1316357803-2366-1-git-send-email-hpoussin@reactos.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 06/11] fulong2e: move pic initialization + ISA bus creation to south bridge List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Signed-off-by: Herv=C3=A9 Poussineau --- 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, c= onst char *boot_device, MemoryRegion *bios =3D 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); =20 - /* Interrupt controller */ - /* The 8259 -> IP5 */ - i8259 =3D i8259_init(env->irq[5]); - /* North bridge, Bonito --> IP2 */ pci_bus =3D bonito_init((qemu_irq *)&(env->irq[2])); =20 /* South bridge */ ide_drive_get(hd, MAX_IDE_BUS); =20 - via_devfn =3D vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0= )); + via_devfn =3D 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); } =20 - 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 =20 typedef struct VT82C686BState { PCIDevice dev; + ISABus bus; + qemu_irq *pic; SuperIOConfig superio_conf; } VT82C686BState; =20 @@ -483,14 +485,28 @@ static const VMStateDescription vmstate_via =3D { } }; =20 +static qemu_irq vt82c_bus_get_irq(ISABus *bus, int isairq) +{ + VT82C686BState *vt82c =3D container_of(bus, VT82C686BState, bus); + if (isairq < 0 || isairq >=3D 16) { + hw_error("isa irq %d invalid", isairq); + } + return vt82c->pic[isairq]; +} + +static ISABusOps vt82c_bus_ops =3D { + .get_irq =3D vt82c_bus_get_irq, +}; + /* init the PCI-to-ISA bridge */ static int vt82c686b_initfn(PCIDevice *d) { + VT82C686BState *vt82c =3D DO_UPCAST(VT82C686BState, dev, d); uint8_t *pci_conf; uint8_t *wmask; int i; =20 - isa_bus_bridge_init(&d->qdev); + isa_bus_new(&vt82c->bus, &vt82c_bus_ops, &d->qdev); =20 pci_conf =3D d->config; pci_config_set_prog_interface(pci_conf, 0x0); @@ -507,12 +523,16 @@ static int vt82c686b_initfn(PCIDevice *d) return 0; } =20 -int vt82c686b_init(PCIBus *bus, int devfn) +int vt82c686b_init(PCIBus *bus, int devfn, qemu_irq parent_irq) { PCIDevice *d; + VT82C686BState *vt82c; =20 d =3D pci_create_simple_multifunction(bus, devfn, true, "VT82C686B")= ; =20 + vt82c =3D DO_UPCAST(VT82C686BState, dev, d); + vt82c->pic =3D i8259_init(parent_irq); + return d->devfn; } =20 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 =20 /* 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, --=20 1.7.5.4