From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 2/4] qdev/isa: add qdev support to i8042 (aka ps/2 kbd+mouse).
Date: Thu, 9 Jul 2009 15:02:38 +0200 [thread overview]
Message-ID: <1247144560-9014-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1247144560-9014-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/pckbd.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/hw/pckbd.c b/hw/pckbd.c
index d50cd6e..3f2023c 100644
--- a/hw/pckbd.c
+++ b/hw/pckbd.c
@@ -113,6 +113,7 @@
#define KBD_PENDING_AUX 2
typedef struct KBDState {
+ ISADevice dev;
uint8_t write_cmd; /* if non zero, write data to port 60 is expected */
uint8_t status;
uint8_t mode;
@@ -440,3 +441,40 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
#endif
qemu_register_reset(kbd_reset, s);
}
+
+static void i8042_initfn(ISADevice *dev)
+{
+ KBDState *s = DO_UPCAST(KBDState, dev, dev);
+
+ isa_init_irq(dev, &s->irq_kbd);
+ isa_init_irq(dev, &s->irq_mouse);
+
+ kbd_reset(s);
+ register_savevm("pckbd", 0, 3, kbd_save, kbd_load, s);
+
+ s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s);
+ s->mouse = ps2_mouse_init(kbd_update_aux_irq, s);
+#ifdef TARGET_I386
+ vmmouse_init(s->mouse);
+#endif
+ qemu_register_reset(kbd_reset, s);
+}
+
+static ISADeviceInfo i8042_info = {
+ .qdev.name = "i8042",
+ .qdev.size = sizeof(KBDState),
+ .qdev.no_user = 1,
+ .init = i8042_initfn,
+ .io[0].read = kbd_read_data,
+ .io[0].write = kbd_write_data,
+ .io[0].length = 1,
+ .io[1].read = kbd_read_status,
+ .io[1].write = kbd_write_command,
+ .io[1].length = 1,
+};
+
+static void i8042_register(void)
+{
+ isa_qdev_register(&i8042_info);
+}
+device_init(i8042_register)
--
1.6.2.5
next prev parent reply other threads:[~2009-07-09 13:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-09 13:02 [Qemu-devel] [PATCH 0/4] qdev: isa bus Gerd Hoffmann
2009-07-09 13:02 ` [Qemu-devel] [PATCH 1/4] qdev/isa: add isa bus support to qdev Gerd Hoffmann
2009-07-09 13:02 ` Gerd Hoffmann [this message]
2009-07-09 13:02 ` [Qemu-devel] [PATCH 3/4] qdev/isa: make the piix isa bridge register an isa bus Gerd Hoffmann
2009-07-09 13:02 ` [Qemu-devel] [PATCH 4/4] qdev/isa: make pc use qdev for i8042 setup Gerd Hoffmann
2009-07-09 14:18 ` [Qemu-devel] [PATCH 0/4] qdev: isa bus Paul Brook
-- strict thread matches above, loose matches on Subject: below --
2009-07-15 12:56 [Qemu-devel] [PATCH 0/4] qdev: add isa bus support Gerd Hoffmann
2009-07-15 12:56 ` [Qemu-devel] [PATCH 2/4] qdev/isa: add qdev support to i8042 (aka ps/2 kbd+mouse) Gerd Hoffmann
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=1247144560-9014-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).