aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-08-01 13:25:58 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-09-12 10:37:01 +0400
commit885f380f7bec732b3615d2698e493fab617d46de (patch)
tree9ff0e5622f5892bf5094fbe15bde2ad280e74d8d
parentd824da9dc136404e63b17914ec4bea0d018d3bb5 (diff)
downloadqemu-885f380f7bec732b3615d2698e493fab617d46de.zip
qemu-885f380f7bec732b3615d2698e493fab617d46de.tar.gz
qemu-885f380f7bec732b3615d2698e493fab617d46de.tar.bz2
vmmouse: replace DPRINTF with tracing
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-rw-r--r--hw/i386/trace-events10
-rw-r--r--hw/i386/vmmouse.c29
2 files changed, 24 insertions, 15 deletions
diff --git a/hw/i386/trace-events b/hw/i386/trace-events
index 04fd71b..53c02d7 100644
--- a/hw/i386/trace-events
+++ b/hw/i386/trace-events
@@ -121,3 +121,13 @@ x86_pic_interrupt(int irqn, int level) "PIC interrupt #%d level:%d"
# port92.c
port92_read(uint8_t val) "port92: read 0x%02x"
port92_write(uint8_t val) "port92: write 0x%02x"
+
+# vmmouse.c
+vmmouse_get_status(void) ""
+vmmouse_mouse_event(int x, int y, int dz, int buttons_state) "event: x=%d y=%d dz=%d state=%d"
+vmmouse_init(void) ""
+vmmouse_read_id(void) ""
+vmmouse_request_relative(void) ""
+vmmouse_request_absolute(void) ""
+vmmouse_disable(void) ""
+vmmouse_data(uint32_t size) "data: size=%" PRIu32
diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
index 6cd624b..99b84a3 100644
--- a/hw/i386/vmmouse.c
+++ b/hw/i386/vmmouse.c
@@ -32,6 +32,8 @@
#include "cpu.h"
#include "qom/object.h"
+#include "trace.h"
+
/* debug only vmmouse */
//#define DEBUG_VMMOUSE
@@ -50,12 +52,6 @@
#define VMMOUSE_RIGHT_BUTTON 0x10
#define VMMOUSE_MIDDLE_BUTTON 0x08
-#ifdef DEBUG_VMMOUSE
-#define DPRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...) do { } while (0)
-#endif
-
#define TYPE_VMMOUSE "vmmouse"
OBJECT_DECLARE_SIMPLE_TYPE(VMMouseState, VMMOUSE)
@@ -93,7 +89,8 @@ static void vmmouse_set_data(const uint32_t *data)
static uint32_t vmmouse_get_status(VMMouseState *s)
{
- DPRINTF("vmmouse_get_status()\n");
+ trace_vmmouse_get_status();
+
return (s->status << 16) | s->nb_queue;
}
@@ -105,8 +102,7 @@ static void vmmouse_mouse_event(void *opaque, int x, int y, int dz, int buttons_
if (s->nb_queue > (VMMOUSE_QUEUE_SIZE - 4))
return;
- DPRINTF("vmmouse_mouse_event(%d, %d, %d, %d)\n",
- x, y, dz, buttons_state);
+ trace_vmmouse_mouse_event(x, y, dz, buttons_state);
if ((buttons_state & MOUSE_EVENT_LBUTTON))
buttons |= VMMOUSE_LEFT_BUTTON;
@@ -160,7 +156,7 @@ static void vmmouse_update_handler(VMMouseState *s, int absolute)
static void vmmouse_read_id(VMMouseState *s)
{
- DPRINTF("vmmouse_read_id()\n");
+ trace_vmmouse_read_id();
if (s->nb_queue == VMMOUSE_QUEUE_SIZE)
return;
@@ -172,19 +168,22 @@ static void vmmouse_read_id(VMMouseState *s)
static void vmmouse_request_relative(VMMouseState *s)
{
- DPRINTF("vmmouse_request_relative()\n");
+ trace_vmmouse_request_relative();
+
vmmouse_update_handler(s, 0);
}
static void vmmouse_request_absolute(VMMouseState *s)
{
- DPRINTF("vmmouse_request_absolute()\n");
+ trace_vmmouse_request_absolute();
+
vmmouse_update_handler(s, 1);
}
static void vmmouse_disable(VMMouseState *s)
{
- DPRINTF("vmmouse_disable()\n");
+ trace_vmmouse_disable();
+
s->status = 0xffff;
vmmouse_remove_handler(s);
}
@@ -193,7 +192,7 @@ static void vmmouse_data(VMMouseState *s, uint32_t *data, uint32_t size)
{
int i;
- DPRINTF("vmmouse_data(%d)\n", size);
+ trace_vmmouse_data(size);
if (size == 0 || size > 6 || size > s->nb_queue) {
printf("vmmouse: driver requested too much data %d\n", size);
@@ -293,7 +292,7 @@ static void vmmouse_realizefn(DeviceState *dev, Error **errp)
{
VMMouseState *s = VMMOUSE(dev);
- DPRINTF("vmmouse_init\n");
+ trace_vmmouse_init();
if (!s->i8042) {
error_setg(errp, "'i8042' link is not set");