From: "Andreas Färber" <andreas.faerber@web.de>
To: "Alexander Graf" <agraf@suse.de>,
"Hervé Poussineau" <hpoussin@reactos.org>
Cc: qemu-devel Developers <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Fwd: [PATCH 1/5] i8259: qdev-ify creation
Date: Thu, 12 Jan 2012 01:04:01 +0100 [thread overview]
Message-ID: <4F0E2371.2010105@web.de> (raw)
In-Reply-To: <1309092433-4385-2-git-send-email-hpoussin@reactos.org>
[-- Attachment #1: Type: text/plain, Size: 2381 bytes --]
Alex,
I have this in my mailbox, but I'm still waiting for an SoB. Hervé?
Regards,
Andreas
-------- Original-Nachricht --------
Betreff: [PATCH 1/5] i8259: qdev-ify creation
Datum: Sun, 26 Jun 2011 14:47:09 +0200
Von: Hervé Poussineau <hpoussin@reactos.org>
An: andreas.faerber@web.de
Kopie (CC): Hervé Poussineau <hpoussin@reactos.org>
---
hw/i8259.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/hw/i8259.c b/hw/i8259.c
index 84d330d..59e8bd6 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -26,6 +26,7 @@
#include "isa.h"
#include "monitor.h"
#include "qemu-timer.h"
+#include "sysbus.h"
/* debug PIC */
//#define DEBUG_PIC
@@ -524,16 +525,60 @@ void irq_info(Monitor *mon)
qemu_irq *i8259_init(qemu_irq parent_irq)
{
- PicState2 *s;
+ DeviceState *dev;
+ dev = qdev_create(NULL, "i8259");
+ qdev_init_nofail(dev);
+ qdev_connect_gpio_out(dev, 0, parent_irq);
+
+ return dev->gpio_in;
+}
+
+typedef struct SysBusPicState2 {
+ SysBusDevice busdev;
+ PicState2 state;
+} SysBusPicState2;
+
+static void i8259_set_irq_sysbus(void *opaque, int line, int level)
+{
+ SysBusPicState2 *sysbus = opaque;
+ PicState2 *s = &sysbus->state;
+ i8259_set_irq(s, line, level);
+}
+
+static int i8259_sysbus_init(SysBusDevice *dev)
+{
+ SysBusPicState2 *sysbus = FROM_SYSBUS(SysBusPicState2, dev);
+ PicState2 *s = &sysbus->state;
+
+ if (isa_pic) {
+ return 1;
+ }
- s = qemu_mallocz(sizeof(PicState2));
pic_init1(0x20, 0x4d0, &s->pics[0]);
pic_init1(0xa0, 0x4d1, &s->pics[1]);
s->pics[0].elcr_mask = 0xf8;
s->pics[1].elcr_mask = 0xde;
- s->parent_irq = parent_irq;
s->pics[0].pics_state = s;
s->pics[1].pics_state = s;
isa_pic = s;
- return qemu_allocate_irqs(i8259_set_irq, s, 16);
+
+ qdev_init_gpio_in(&dev->qdev, i8259_set_irq_sysbus, 16);
+ qdev_init_gpio_out(&dev->qdev, &s->parent_irq, 1);
+ return 0;
+}
+
+static SysBusDeviceInfo i8259_sysbus_info = {
+ .qdev.name = "i8259",
+ .qdev.size = sizeof(SysBusPicState2),
+ .init = i8259_sysbus_init,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_END_OF_LIST()
+ },
+};
+
+static void i8259_register_devices(void)
+{
+ sysbus_register_withprop(&i8259_sysbus_info);
}
+
+device_init(i8259_register_devices)
--
1.7.5.4
[-- Attachment #2: Nachrichtenteil als Anhang --]
[-- Type: text/plain, Size: 0 bytes --]
next parent reply other threads:[~2012-01-12 0:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1309092433-4385-2-git-send-email-hpoussin@reactos.org>
2012-01-12 0:04 ` Andreas Färber [this message]
2012-01-12 7:35 ` [Qemu-devel] Fwd: [PATCH 1/5] i8259: qdev-ify creation Jan Kiszka
2012-01-12 7:58 ` [Qemu-devel] " Alexander Graf
2012-01-12 8:00 ` Jan Kiszka
2012-01-12 8:05 ` Alexander Graf
2012-01-12 8:09 ` Jan Kiszka
2012-01-12 8:18 ` Alexander Graf
2012-01-12 9:28 ` Jan Kiszka
2012-01-12 12:54 ` Andreas Färber
2012-01-12 13:08 ` Jan Kiszka
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=4F0E2371.2010105@web.de \
--to=andreas.faerber@web.de \
--cc=agraf@suse.de \
--cc=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.