qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 3/3] qdev: switch isa pic to generic irq allocation.
Date: Tue,  9 Jun 2009 13:01:01 +0200	[thread overview]
Message-ID: <1244545261-23679-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1244545261-23679-1-git-send-email-kraxel@redhat.com>


Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/i8259.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/hw/i8259.c b/hw/i8259.c
index 6c8b5c5..4f73acc 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -59,7 +59,6 @@ struct PicState2 {
     /* 0 is master pic, 1 is slave pic */
     /* XXX: better separation between the two pics */
     PicState pics[2];
-    qemu_irq parent_irq;
     void *irq_request_opaque;
     /* IOAPIC callback support */
     SetIRQFunc *alt_irq_func;
@@ -167,13 +166,13 @@ void pic_update_irq(PicState2 *s)
         }
         printf("pic: cpu_interrupt\n");
 #endif
-        qemu_irq_raise(s->parent_irq);
+        qemu_irq_raise(s->busdev.qdev.gpio_out[0]);
     }
 
 /* all targets should do this rather than acking the IRQ in the cpu */
 #if defined(TARGET_MIPS) || defined(TARGET_PPC) || defined(TARGET_ALPHA)
     else {
-        qemu_irq_lower(s->parent_irq);
+        qemu_irq_lower(s->busdev.qdev.gpio_out[0]);
     }
 #endif
 }
@@ -299,7 +298,7 @@ static void pic_ioport_write(void *opaque, uint32_t addr, uint32_t val)
             /* init */
             pic_reset(s);
             /* deassert a pending interrupt */
-            qemu_irq_lower(s->pics_state->parent_irq);
+            qemu_irq_lower(s->pics_state->busdev.qdev.gpio_out[0]);
             s->init_state = 1;
             s->init4 = val & 1;
             s->single_mode = val & 2;
@@ -560,13 +559,22 @@ static void i8259_initfn(SysBusDevice *sysdev)
     s->pics[1].elcr_mask = 0xde;
     s->pics[0].pics_state = s;
     s->pics[1].pics_state = s;
-    qdev_init_gpio_out(&sysdev->qdev, &s->parent_irq, 1);
-    qdev_init_gpio_in(&sysdev->qdev, i8259_set_irq, 16);
 }
 
+static SysBusDeviceInfo i8259_info = {
+    .qdev.name = "i8259",
+    .qdev.size = sizeof(PicState2),
+
+    .qdev.num_gpio_in  = 16,
+    .qdev.num_gpio_out = 1,
+    .qdev.irq          = i8259_set_irq,
+
+    .init      = i8259_initfn,
+};
+
 static void i8259_register(void)
 {
-    sysbus_register_dev("i8259", sizeof(PicState2), i8259_initfn);
+    sysbus_register_withprop(&i8259_info);
 }
 device_init(i8259_register);
 
-- 
1.6.2.2

  parent reply	other threads:[~2009-06-09 11:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 11:00 [Qemu-devel] [PATCH 1/3] qdev-ify isa pic Gerd Hoffmann
2009-06-09 11:01 ` [Qemu-devel] [PATCH 2/3] qdev: irq allocation in generic code Gerd Hoffmann
2009-06-09 11:01 ` Gerd Hoffmann [this message]
2009-06-09 15:01 ` [Qemu-devel] [PATCH 1/3] qdev-ify isa pic Paul Brook
2009-06-09 15:24   ` Gerd Hoffmann
2009-06-09 15:32     ` Paul Brook
2009-06-09 15:51       ` Gerd Hoffmann
2009-06-09 15:58         ` Paul Brook
2009-06-10  7:32           ` Gerd Hoffmann
2009-06-10  9:43             ` Filip Navara
2009-06-10  9:50               ` Gerd Hoffmann
2009-06-10 14:29                 ` Paul Brook

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=1244545261-23679-3-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --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).