qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] vmmouse: replace PROP_PTR property with gpio pin to i8042
Date: Sat,  4 Feb 2012 09:03:32 +0100	[thread overview]
Message-ID: <1328342612-25826-4-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1328342612-25826-1-git-send-email-pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/pc.c      |    7 +++----
 hw/pc.h      |    1 -
 hw/pckbd.c   |    7 +++++--
 hw/vmmouse.c |   11 +++--------
 4 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index 7f3aa65..76787c7 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1181,13 +1181,12 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
     if (!no_vmport) {
         vmport_init(isa_bus);
         vmmouse = isa_try_create(isa_bus, "vmmouse");
+        qdev_init_nofail(&vmmouse->qdev);
+        qdev_connect_gpio_out(DEVICE(vmmouse), 0,
+                              qdev_get_gpio_in(DEVICE(i8042), 0));
     } else {
         vmmouse = NULL;
     }
-    if (vmmouse) {
-        qdev_prop_set_ptr(&vmmouse->qdev, "ps2_mouse", i8042);
-        qdev_init_nofail(&vmmouse->qdev);
-    }
     port92 = isa_create_simple(isa_bus, "port92");
     port92_init(port92, &a20_line[1]);
 
diff --git a/hw/pc.h b/hw/pc.h
index c666ec9..5602549 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -121,7 +121,6 @@ void i8042_init(qemu_irq kbd_irq, qemu_irq mouse_irq, uint32_t io_base);
 void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
                    MemoryRegion *region, ram_addr_t size,
                    target_phys_addr_t mask);
-void i8042_isa_mouse_fake_event(void *opaque);
 void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out);
 
 /* pc.c */
diff --git a/hw/pckbd.c b/hw/pckbd.c
index b4c53be..ea8ff73 100644
--- a/hw/pckbd.c
+++ b/hw/pckbd.c
@@ -433,12 +433,14 @@ typedef struct ISAKBDState {
     MemoryRegion io[2];
 } ISAKBDState;
 
-void i8042_isa_mouse_fake_event(void *opaque)
+static void i8042_isa_mouse_fake_event(void *opaque, int n, int level)
 {
     ISADevice *dev = opaque;
     KBDState *s = &(DO_UPCAST(ISAKBDState, dev, dev)->kbd);
 
-    ps2_mouse_fake_event(s->mouse);
+    if (level) {
+        ps2_mouse_fake_event(s->mouse);
+    }
 }
 
 void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out)
@@ -482,6 +484,7 @@ static int i8042_initfn(ISADevice *dev)
     ISAKBDState *isa_s = DO_UPCAST(ISAKBDState, dev, dev);
     KBDState *s = &isa_s->kbd;
 
+    qdev_init_gpio_in(DEVICE(dev), i8042_isa_mouse_fake_event, 1);
     isa_init_irq(dev, &s->irq_kbd, 1);
     isa_init_irq(dev, &s->irq_mouse, 12);
 
diff --git a/hw/vmmouse.c b/hw/vmmouse.c
index fda4f89..0272e7e 100644
--- a/hw/vmmouse.c
+++ b/hw/vmmouse.c
@@ -60,7 +60,7 @@ typedef struct _VMMouseState
     uint16_t status;
     uint8_t absolute;
     QEMUPutMouseEntry *entry;
-    void *ps2_mouse;
+    qemu_irq ps2_mouse_event;
 } VMMouseState;
 
 static uint32_t vmmouse_get_status(VMMouseState *s)
@@ -99,7 +99,7 @@ static void vmmouse_mouse_event(void *opaque, int x, int y, int dz, int buttons_
 
     /* need to still generate PS2 events to notify driver to
        read from queue */
-    i8042_isa_mouse_fake_event(s->ps2_mouse);
+    qemu_set_irq(s->ps2_mouse_event, 1);
 }
 
 static void vmmouse_remove_handler(VMMouseState *s)
@@ -264,6 +264,7 @@ static int vmmouse_initfn(ISADevice *dev)
 
     DPRINTF("vmmouse_init\n");
 
+    qdev_init_gpio_out(DEVICE(dev), &s->ps2_mouse_event, 1);
     vmport_register(VMMOUSE_STATUS, vmmouse_ioport_read, s);
     vmport_register(VMMOUSE_COMMAND, vmmouse_ioport_read, s);
     vmport_register(VMMOUSE_DATA, vmmouse_ioport_read, s);
@@ -271,11 +272,6 @@ static int vmmouse_initfn(ISADevice *dev)
     return 0;
 }
 
-static Property vmmouse_properties[] = {
-    DEFINE_PROP_PTR("ps2_mouse", VMMouseState, ps2_mouse),
-    DEFINE_PROP_END_OF_LIST(),
-};
-
 static void vmmouse_class_initfn(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -284,7 +280,6 @@ static void vmmouse_class_initfn(ObjectClass *klass, void *data)
     dc->no_user = 1;
     dc->reset = vmmouse_reset;
     dc->vmsd = &vmstate_vmmouse;
-    dc->props = vmmouse_properties;
 }
 
 static TypeInfo vmmouse_info = {
-- 
1.7.7.6

  parent reply	other threads:[~2012-02-04  8:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-04  8:03 [Qemu-devel] [PATCH 0/3] Remove PROP_PTR, part 2/4 Paolo Bonzini
2012-02-04  8:03 ` [Qemu-devel] [PATCH 1/3] smbus: fix writes Paolo Bonzini
2012-02-04  8:03 ` [Qemu-devel] [PATCH 2/3] smbus_eeprom: remove PTR property Paolo Bonzini
2012-02-04  8:03 ` Paolo Bonzini [this message]
2012-02-04 13:03   ` [Qemu-devel] [PATCH 3/3] vmmouse: replace PROP_PTR property with gpio pin to i8042 Gerhard Wiesinger
2012-02-04 13:15     ` Paolo Bonzini
2012-02-07 12:39   ` Juan Quintela
2012-02-07 12:54     ` Paolo Bonzini
2012-02-09  0:48   ` 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=1328342612-25826-4-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@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).