All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Cc: "Hervé Poussineau" <hpoussin@reactos.org>
Subject: [Qemu-devel] [PATCH 06/11] fulong2e: move pic initialization + ISA bus creation to south bridge
Date: Sun, 18 Sep 2011 16:56:38 +0200	[thread overview]
Message-ID: <1316357803-2366-7-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1316357803-2366-1-git-send-email-hpoussin@reactos.org>


Signed-off-by: Hervé Poussineau <hpoussin@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

  parent reply	other threads:[~2011-09-18 14:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-18 14:56 [Qemu-devel] [PATCH 00/11] ISA bus improvements Hervé Poussineau
2011-09-18 14:56 ` [Qemu-devel] [PATCH 01/11] isa: rename isa_bus_new to isa_bus_bridge_init Hervé Poussineau
2011-09-18 14:56 ` [Qemu-devel] [PATCH 02/11] isa: rework ISA bus internals, and add ISA bus ops structure Hervé Poussineau
2011-09-18 14:56 ` [Qemu-devel] [PATCH 03/11] isa: implement isa_address_space() as a method of ISA bus Hervé Poussineau
2011-09-18 14:56 ` [Qemu-devel] [PATCH 04/11] audio: give ISA bus to sound cards, instead of PIC Hervé Poussineau
2011-09-18 14:56 ` [Qemu-devel] [PATCH 05/11] pc: improve bus implementation of PIIX3 bridge Hervé Poussineau
2011-09-18 14:56 ` Hervé Poussineau [this message]
2011-09-18 14:56 ` [Qemu-devel] [PATCH 07/11] sun4u: improve bus implementation of EBus bridge Hervé Poussineau
2011-09-18 14:56 ` [Qemu-devel] [PATCH 08/11] malta: improve bus implementation of PIIX4 bridge Hervé Poussineau
2011-09-18 14:56 ` [Qemu-devel] [PATCH 09/11] isa: remove unused parameter to isa_bus_bridge_init() Hervé Poussineau
2011-09-18 14:56 ` [Qemu-devel] [PATCH 10/11] isa: give bus to isa_create() methods Hervé Poussineau
2011-09-18 14:56 ` [Qemu-devel] [PATCH 11/11] isa: remove limitation of only one ISA bus Hervé Poussineau
2011-09-18 19:21 ` [Qemu-devel] [PATCH 00/11] ISA bus improvements Jan Kiszka
2011-09-18 19:33   ` Hervé Poussineau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1316357803-2366-7-git-send-email-hpoussin@reactos.org \
    --to=hpoussin@reactos.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.