qemu-devel.nongnu.org archive mirror
 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 v3 14/16] i8259: add ad-hock variables to please future changes in isa_register_ioport()
Date: Sun,  2 Oct 2011 18:10:26 +0200	[thread overview]
Message-ID: <1317571828-9059-15-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1317571828-9059-1-git-send-email-hpoussin@reactos.org>

This patch should be reverted once i8259 is qdevified

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/i8259.c |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/hw/i8259.c b/hw/i8259.c
index e5323ff..9af2bbb 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -499,15 +499,40 @@ static const MemoryRegionOps pic_elcr_ioport_ops = {
     },
 };
 
+static BusState *qbus_find_recursive(BusState *bus, const char *name)
+{
+    DeviceState *dev;
+    BusState *child, *ret;
+
+    if (strcmp(bus->name, name) == 0) {
+        return bus;
+    }
+
+    QLIST_FOREACH(dev, &bus->children, sibling) {
+        QLIST_FOREACH(child, &dev->child_bus, sibling) {
+            ret = qbus_find_recursive(child, name);
+            if (ret) {
+                return ret;
+            }
+        }
+    }
+    return NULL;
+}
+
 /* XXX: add generic master/slave system */
 static void pic_init1(int io_addr, int elcr_addr, PicState *s)
 {
+    ISADevice dev;
+
+    memset(&dev, 0, sizeof(dev));
+    dev.qdev.parent_bus = qbus_find_recursive(sysbus_get_default(), "isa.0");
+
     memory_region_init_io(&s->base_io, &pic_base_ioport_ops, s, "pic", 2);
     memory_region_init_io(&s->elcr_io, &pic_elcr_ioport_ops, s, "elcr", 1);
 
-    isa_register_ioport(NULL, &s->base_io, io_addr);
+    isa_register_ioport(&dev, &s->base_io, io_addr);
     if (elcr_addr >= 0) {
-        isa_register_ioport(NULL, &s->elcr_io, elcr_addr);
+        isa_register_ioport(&dev, &s->elcr_io, elcr_addr);
     }
 
     vmstate_register(NULL, io_addr, &vmstate_pic, s);
-- 
1.7.6.3

  parent reply	other threads:[~2011-10-02 16:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-02 16:10 [Qemu-devel] [PATCH v3 00/16] ISA bus improvements Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 01/16] isa: rename isa_bus_new to isa_bus_bridge_init Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 02/16] isa: rework ISA bus internals, and add ISA bus ops structure Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 03/16] isa: correctly implement isa_address_space(), by calling a bus-specific function Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 04/16] audio: give ISA bus to sound cards, instead of PIC Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 05/16] pc: improve bus implementation of PIIX3 bridge Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 06/16] fulong2e: improve bus implementation of vt82c bridge Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 07/16] sun4u: improve bus implementation of EBus bridge Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 08/16] malta: improve bus implementation of PIIX4 bridge Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 09/16] isa: remove unused parameter to isa_bus_bridge_init() Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 10/16] isa: give bus to isa_create() and isa_try_create() methods Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 11/16] isa: use bus given in parameter to create device on specified ISA bus Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 12/16] isa: give bus to isa_get_irq() and isa_bus_irqs() Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 13/16] isa: use bus given in parameter to get/set irqs on specified ISA bus Hervé Poussineau
2011-10-02 16:10 ` Hervé Poussineau [this message]
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 15/16] isa: remove useless test in isa_register_ioport() Hervé Poussineau
2011-10-02 16:10 ` [Qemu-devel] [PATCH v3 16/16] isa: remove limitation of only one ISA bus 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=1317571828-9059-15-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).