microblaze: linux-user support.
[qemu] / hw / vmmouse.c
index c10c26e..c70e825 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU VMMouse emulation
- * 
+ *
  * Copyright (C) 2007 Anthony Liguori <anthony@codemonkey.ws>
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "vl.h"
+#include "hw.h"
+#include "console.h"
+#include "ps2.h"
+#include "pc.h"
 
 /* debug only vmmouse */
 //#define DEBUG_VMMOUSE
@@ -39,7 +42,6 @@
 
 #define VMMOUSE_QUEUE_SIZE     1024
 
-#define VMMOUSE_MAGIC          0x564D5868
 #define VMMOUSE_VERSION                0x3442554a
 
 #ifdef DEBUG_VMMOUSE
@@ -58,13 +60,6 @@ typedef struct _VMMouseState
     void *ps2_mouse;
 } VMMouseState;
 
-static uint32_t vmmouse_get_version(VMMouseState *s, uint32_t *magic)
-{
-    DPRINTF("vmmouse_get_version(%x)\n", *magic);
-    *magic = VMMOUSE_MAGIC;
-    return VMMOUSE_VERSION;
-}
-
 static uint32_t vmmouse_get_status(VMMouseState *s)
 {
     DPRINTF("vmmouse_get_status()\n");
@@ -201,15 +196,10 @@ static uint32_t vmmouse_ioport_read(void *opaque, uint32_t addr)
     uint16_t command;
 
     vmmouse_get_data(data);
-    if (data[0] != VMMOUSE_MAGIC)
-        goto error;
 
     command = data[2] & 0xFFFF;
 
     switch (command) {
-    case VMMOUSE_GETVERSION:
-        data[0] = vmmouse_get_version(s, &data[1]);
-        break;
     case VMMOUSE_STATUS:
         data[0] = vmmouse_get_status(s);
         break;
@@ -240,7 +230,6 @@ static uint32_t vmmouse_ioport_read(void *opaque, uint32_t addr)
         break;
     }
 
-error:
     vmmouse_set_data(data);
     return data[0];
 }
@@ -286,15 +275,14 @@ void *vmmouse_init(void *m)
     DPRINTF("vmmouse_init\n");
 
     s = qemu_mallocz(sizeof(VMMouseState));
-    if (!s)
-        return NULL;
 
     s->status = 0xffff;
     s->ps2_mouse = m;
 
-    register_ioport_read(0x5658, 1, 4, vmmouse_ioport_read, s);
+    vmport_register(VMMOUSE_STATUS, vmmouse_ioport_read, s);
+    vmport_register(VMMOUSE_COMMAND, vmmouse_ioport_read, s);
+    vmport_register(VMMOUSE_DATA, vmmouse_ioport_read, s);
     register_savevm("vmmouse", 0, 0, vmmouse_save, vmmouse_load, s);
 
     return s;
 }
-