Blame 0018-qxl-add-io_port_to_string.patch

Justin M. Forbes 13f703
>From cb29c060e51d2afcd9ba6ed6a115442473381d5a Mon Sep 17 00:00:00 2001
Justin M. Forbes 13f703
From: Alon Levy <alevy@redhat.com>
Justin M. Forbes 13f703
Date: Fri, 17 Jun 2011 14:42:09 +0200
Justin M. Forbes 13f703
Subject: [PATCH 18/25] qxl: add io_port_to_string
Justin M. Forbes 13f703
Justin M. Forbes 13f703
Signed-off-by: Alon Levy <alevy@redhat.com>
Justin M. Forbes 13f703
---
Justin M. Forbes 13f703
 hw/qxl.c |   40 +++++++++++++++++++++++++++++++++++++++-
Justin M. Forbes 13f703
 1 files changed, 39 insertions(+), 1 deletions(-)
Justin M. Forbes 13f703
Justin M. Forbes 13f703
diff --git a/hw/qxl.c b/hw/qxl.c
Justin M. Forbes 13f703
index 416bd48..6e66021 100644
Justin M. Forbes 13f703
--- a/hw/qxl.c
Justin M. Forbes 13f703
+++ b/hw/qxl.c
Justin M. Forbes 13f703
@@ -409,6 +409,43 @@ static const char *qxl_mode_to_string(int mode)
Justin M. Forbes 13f703
     return "INVALID";
Justin M. Forbes 13f703
 }
Justin M. Forbes 13f703
 
Justin M. Forbes 13f703
+static const char *io_port_to_string(uint32_t io_port)
Justin M. Forbes 13f703
+{
Justin M. Forbes 13f703
+    if (io_port >= QXL_IO_RANGE_SIZE) {
Justin M. Forbes 13f703
+        return "out of range";
Justin M. Forbes 13f703
+    }
Justin M. Forbes 13f703
+    static const char *io_port_to_string[QXL_IO_RANGE_SIZE + 1] = {
Justin M. Forbes 13f703
+        [QXL_IO_NOTIFY_CMD]             = "QXL_IO_NOTIFY_CMD",
Justin M. Forbes 13f703
+        [QXL_IO_NOTIFY_CURSOR]          = "QXL_IO_NOTIFY_CURSOR",
Justin M. Forbes 13f703
+        [QXL_IO_UPDATE_AREA]            = "QXL_IO_UPDATE_AREA",
Justin M. Forbes 13f703
+        [QXL_IO_UPDATE_IRQ]             = "QXL_IO_UPDATE_IRQ",
Justin M. Forbes 13f703
+        [QXL_IO_NOTIFY_OOM]             = "QXL_IO_NOTIFY_OOM",
Justin M. Forbes 13f703
+        [QXL_IO_RESET]                  = "QXL_IO_RESET",
Justin M. Forbes 13f703
+        [QXL_IO_SET_MODE]               = "QXL_IO_SET_MODE",
Justin M. Forbes 13f703
+        [QXL_IO_LOG]                    = "QXL_IO_LOG",
Justin M. Forbes 13f703
+        [QXL_IO_MEMSLOT_ADD]            = "QXL_IO_MEMSLOT_ADD",
Justin M. Forbes 13f703
+        [QXL_IO_MEMSLOT_DEL]            = "QXL_IO_MEMSLOT_DEL",
Justin M. Forbes 13f703
+        [QXL_IO_DETACH_PRIMARY]         = "QXL_IO_DETACH_PRIMARY",
Justin M. Forbes 13f703
+        [QXL_IO_ATTACH_PRIMARY]         = "QXL_IO_ATTACH_PRIMARY",
Justin M. Forbes 13f703
+        [QXL_IO_CREATE_PRIMARY]         = "QXL_IO_CREATE_PRIMARY",
Justin M. Forbes 13f703
+        [QXL_IO_DESTROY_PRIMARY]        = "QXL_IO_DESTROY_PRIMARY",
Justin M. Forbes 13f703
+        [QXL_IO_DESTROY_SURFACE_WAIT]   = "QXL_IO_DESTROY_SURFACE_WAIT",
Justin M. Forbes 13f703
+        [QXL_IO_DESTROY_ALL_SURFACES]   = "QXL_IO_DESTROY_ALL_SURFACES",
Justin M. Forbes 13f703
+#if SPICE_INTERFACE_QXL_MINOR >= 1
Justin M. Forbes 13f703
+        [QXL_IO_UPDATE_AREA_ASYNC]      = "QXL_IO_UPDATE_AREA_ASYNC",
Justin M. Forbes 13f703
+        [QXL_IO_MEMSLOT_ADD_ASYNC]      = "QXL_IO_MEMSLOT_ADD_ASYNC",
Justin M. Forbes 13f703
+        [QXL_IO_CREATE_PRIMARY_ASYNC]   = "QXL_IO_CREATE_PRIMARY_ASYNC",
Justin M. Forbes 13f703
+        [QXL_IO_DESTROY_PRIMARY_ASYNC]  = "QXL_IO_DESTROY_PRIMARY_ASYNC",
Justin M. Forbes 13f703
+        [QXL_IO_DESTROY_SURFACE_ASYNC]  = "QXL_IO_DESTROY_SURFACE_ASYNC",
Justin M. Forbes 13f703
+        [QXL_IO_DESTROY_ALL_SURFACES_ASYNC]
Justin M. Forbes 13f703
+                                        = "QXL_IO_DESTROY_ALL_SURFACES_ASYNC",
Justin M. Forbes 13f703
+        [QXL_IO_FLUSH_SURFACES_ASYNC]   = "QXL_IO_FLUSH_SURFACES_ASYNC",
Justin M. Forbes 13f703
+        [QXL_IO_FLUSH_RELEASE]          = "QXL_IO_FLUSH_RELEASE",
Justin M. Forbes 13f703
+#endif
Justin M. Forbes 13f703
+    };
Justin M. Forbes 13f703
+    return io_port_to_string[io_port];
Justin M. Forbes 13f703
+}
Justin M. Forbes 13f703
+
Justin M. Forbes 13f703
 /* called from spice server thread context only */
Justin M. Forbes 13f703
 static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)
Justin M. Forbes 13f703
 {
Justin M. Forbes 13f703
@@ -1005,7 +1042,8 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val)
Justin M. Forbes 13f703
     default:
Justin M. Forbes 13f703
         if (d->mode == QXL_MODE_NATIVE || d->mode == QXL_MODE_COMPAT)
Justin M. Forbes 13f703
             break;
Justin M. Forbes 13f703
-        dprint(d, 1, "%s: unexpected port 0x%x in vga mode\n", __FUNCTION__, io_port);
Justin M. Forbes 13f703
+        dprint(d, 1, "%s: unexpected port 0x%x (%s) in vga mode\n",
Justin M. Forbes 13f703
+            __func__, io_port, io_port_to_string(io_port));
Justin M. Forbes 13f703
         return;
Justin M. Forbes 13f703
     }
Justin M. Forbes 13f703
 
Justin M. Forbes 13f703
-- 
Justin M. Forbes 13f703
1.7.5.1
Justin M. Forbes 13f703