Xen: Use VGA Hooks to make VGA passthrough work on certain devices
[seabios.git] / vgasrc / clext.c
index 26b34e0d30db6306502579959a93b4a4b81f35bd..7d1a604d45fc117acd132ff7460eb54a43414d8d 100644 (file)
@@ -368,6 +368,30 @@ clext_set_displaystart(struct vgamode_s *vmode_g, int val)
     return 0;
 }
 
+int
+clext_size_state(int states)
+{
+    if (states & 8)
+        return -1;
+    return stdvga_size_state(states);
+}
+
+int
+clext_save_state(u16 seg, void *data, int states)
+{
+    if (states & 8)
+        return -1;
+    return stdvga_save_state(seg, data, states);
+}
+
+int
+clext_restore_state(u16 seg, void *data, int states)
+{
+    if (states & 8)
+        return -1;
+    return stdvga_restore_state(seg, data, states);
+}
+
 
 /****************************************************************
  * Mode setting
@@ -590,6 +614,17 @@ clext_init(void)
         return -1;
     dprintf(1, "cirrus init 2\n");
 
+    // memory setup
+    stdvga_sequ_write(0x0a, stdvga_sequ_read(0x0f) & 0x18);
+    // set vga mode
+    stdvga_sequ_write(0x07, 0x00);
+    // reset bitblt
+    stdvga_grdc_write(0x31, 0x04);
+    stdvga_grdc_write(0x31, 0x00);
+
+    if (GET_GLOBAL(HaveRunInit))
+        return 0;
+
     u32 lfb_addr = 0;
     int bdf = GET_GLOBAL(VgaBDF);
     if (CONFIG_VGA_PCI && bdf >= 0)
@@ -600,13 +635,5 @@ clext_init(void)
     SET_VGA(VBE_total_memory, totalmem * 64 * 1024);
     SET_VGA(VBE_win_granularity, 16);
 
-    // memory setup
-    stdvga_sequ_write(0x0a, stdvga_sequ_read(0x0f) & 0x18);
-    // set vga mode
-    stdvga_sequ_write(0x07, 0x00);
-    // reset bitblt
-    stdvga_grdc_write(0x31, 0x04);
-    stdvga_grdc_write(0x31, 0x00);
-
     return 0;
 }