Update Changelog with new Xscale platforms and vmsvga.
[qemu] / hw / vmware_vga.c
index dda45df..6cae25c 100644 (file)
@@ -21,7 +21,9 @@
  * 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 "pci.h"
 
 #define VERBOSE
 #define EMBED_STDVGA
@@ -226,18 +228,19 @@ enum {
 #ifdef VERBOSE
 # define GUEST_OS_BASE         0x5001
 static const char *vmsvga_guest_id[] = {
-    [0x0] = "Dos",
-    [0x1] = "Windows 3.1",
-    [0x2] = "Windows 95",
-    [0x3] = "Windows 98",
-    [0x4] = "Windows ME",
-    [0x5] = "Windows NT",
-    [0x6] = "Windows 2000",
-    [0x7] = "Linux",
-    [0x8] = "OS/2",
-    [0x9] = "Unknown",
-    [0xa] = "BSD",
-    [0xb] = "Whistler",
+    [0x00 ... 0x15] = "an unknown OS",
+    [0x00] = "Dos",
+    [0x01] = "Windows 3.1",
+    [0x02] = "Windows 95",
+    [0x03] = "Windows 98",
+    [0x04] = "Windows ME",
+    [0x05] = "Windows NT",
+    [0x06] = "Windows 2000",
+    [0x07] = "Linux",
+    [0x08] = "OS/2",
+    [0x0a] = "BSD",
+    [0x0b] = "Whistler",
+    [0x15] = "Windows 2003",
 };
 #endif
 
@@ -459,7 +462,7 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s,
 static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s)
 {
     if (!s->config || !s->enable)
-        return 0;
+        return 1;
     return (s->cmd->next_cmd == s->cmd->stop);
 }
 
@@ -619,7 +622,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address)
         return SVGA_MAX_WIDTH;
 
     case SVGA_REG_MAX_HEIGHT:
-        return SVGA_MAX_WIDTH;
+        return SVGA_MAX_HEIGHT;
 
     case SVGA_REG_DEPTH:
         return s->depth;
@@ -727,7 +730,8 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value)
         break;
 
     case SVGA_REG_ENABLE:
-        s->enable = s->config = value & s->config;
+        s->enable = value;
+        s->config &= !!value;
         s->width = -1;
         s->height = -1;
         s->invalidated = 1;
@@ -770,7 +774,7 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value)
             if (s->cmd->max < s->cmd->min + 10 * 1024)
                 break;
         }
-        s->config = value;
+        s->config = !!value;
         break;
 
     case SVGA_REG_SYNC:
@@ -902,14 +906,14 @@ static void vmsvga_reset(struct vmsvga_state_s *s)
         s->wblue  = 0x0000f800;
         break;
     case 24:
-        s->wred   = 0x000000ff;
+        s->wred   = 0x00ff0000;
         s->wgreen = 0x0000ff00;
-        s->wblue  = 0x00ff0000;
+        s->wblue  = 0x000000ff;
         break;
     case 32:
-        s->wred   = 0x000000ff;
+        s->wred   = 0x00ff0000;
         s->wgreen = 0x0000ff00;
-        s->wblue  = 0x00ff0000;
+        s->wblue  = 0x000000ff;
         break;
     }
     s->syncing = 0;
@@ -928,6 +932,8 @@ static void vmsvga_invalidate_display(void *opaque)
     s->invalidated = 1;
 }
 
+/* save the vga display in a PPM image even if no display is
+   available */
 static void vmsvga_screen_dump(void *opaque, const char *filename)
 {
     struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
@@ -938,7 +944,9 @@ static void vmsvga_screen_dump(void *opaque, const char *filename)
         return;
     }
 
-    /* TODO */
+    if (s->depth == 32) {
+        ppm_save(filename, s->vram, s->width, s->height, s->ds->linesize);
+    }
 }
 
 #ifdef DIRECT_VRAM
@@ -1020,41 +1028,41 @@ static CPUWriteMemoryFunc *vmsvga_vram_write[] = {
 
 static void vmsvga_save(struct vmsvga_state_s *s, QEMUFile *f)
 {
-    qemu_put_be32s(f, &s->depth);
-    qemu_put_be32s(f, &s->enable);
-    qemu_put_be32s(f, &s->config);
-    qemu_put_be32s(f, &s->cursor.id);
-    qemu_put_be32s(f, &s->cursor.x);
-    qemu_put_be32s(f, &s->cursor.y);
-    qemu_put_be32s(f, &s->cursor.on);
-    qemu_put_be32s(f, &s->index);
+    qemu_put_be32(f, s->depth);
+    qemu_put_be32(f, s->enable);
+    qemu_put_be32(f, s->config);
+    qemu_put_be32(f, s->cursor.id);
+    qemu_put_be32(f, s->cursor.x);
+    qemu_put_be32(f, s->cursor.y);
+    qemu_put_be32(f, s->cursor.on);
+    qemu_put_be32(f, s->index);
     qemu_put_buffer(f, (uint8_t *) s->scratch, s->scratch_size * 4);
-    qemu_put_be32s(f, &s->new_width);
-    qemu_put_be32s(f, &s->new_height);
+    qemu_put_be32(f, s->new_width);
+    qemu_put_be32(f, s->new_height);
     qemu_put_be32s(f, &s->guest);
     qemu_put_be32s(f, &s->svgaid);
-    qemu_put_be32s(f, &s->syncing);
-    qemu_put_be32s(f, &s->fb_size);
+    qemu_put_be32(f, s->syncing);
+    qemu_put_be32(f, s->fb_size);
 }
 
 static int vmsvga_load(struct vmsvga_state_s *s, QEMUFile *f)
 {
     int depth;
-    qemu_get_be32s(f, &depth);
-    qemu_get_be32s(f, &s->enable);
-    qemu_get_be32s(f, &s->config);
-    qemu_get_be32s(f, &s->cursor.id);
-    qemu_get_be32s(f, &s->cursor.x);
-    qemu_get_be32s(f, &s->cursor.y);
-    qemu_get_be32s(f, &s->cursor.on);
-    qemu_get_be32s(f, &s->index);
+    depth=qemu_get_be32(f);
+    s->enable=qemu_get_be32(f);
+    s->config=qemu_get_be32(f);
+    s->cursor.id=qemu_get_be32(f);
+    s->cursor.x=qemu_get_be32(f);
+    s->cursor.y=qemu_get_be32(f);
+    s->cursor.on=qemu_get_be32(f);
+    s->index=qemu_get_be32(f);
     qemu_get_buffer(f, (uint8_t *) s->scratch, s->scratch_size * 4);
-    qemu_get_be32s(f, &s->new_width);
-    qemu_get_be32s(f, &s->new_height);
+    s->new_width=qemu_get_be32(f);
+    s->new_height=qemu_get_be32(f);
     qemu_get_be32s(f, &s->guest);
     qemu_get_be32s(f, &s->svgaid);
-    qemu_get_be32s(f, &s->syncing);
-    qemu_get_be32s(f, &s->fb_size);
+    s->syncing=qemu_get_be32(f);
+    s->fb_size=qemu_get_be32(f);
 
     if (s->enable && depth != s->depth) {
         printf("%s: need colour depth of %i bits to resume operation.\n",