[SeaBIOS] [PATCH 5/4] Add geodevga_set_mode() function

Christian Gmeiner christian.gmeiner at gmail.com
Fri Aug 31 16:19:18 CEST 2012


We need to set the DC register visibility before we can call
stdvga_set_mode().

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 vgasrc/geodevga.c | 41 +++++++++++++++++++++++++++++++++++++++++
 vgasrc/geodevga.h |  1 +
 2 files changed, 42 insertions(+)

diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c
index bff856a..dab2b2a 100644
--- a/vgasrc/geodevga.c
+++ b/vgasrc/geodevga.c
@@ -170,6 +170,47 @@ static void dc_unmap(void)
     dc_map(0);
 }

+/****************************************************************
+ * Mode setting
+ ****************************************************************/
+
+int geodevga_set_mode(struct vgamode_s *vmode_g, int flags)
+{
+    /* we need set the DC register visibility within the standard
+     * VGA memory space (0xA0000 - 0xBffff).
+     *
+     * bit:
+     * 7:3      RSVD
+     * 2:1      VG_RG_MAP
+     *           00: Disabled
+     *           01: 0xA0000
+     *           10: 0xB0000
+     *           11: 0xB8000
+     * 0        PACK_CH4
+     */
+
+    u8 reg;
+
+    switch (vmode_g->sstart) {
+    case SEG_GRAPH:
+        reg = 0x02;
+        break;
+    case SEG_MTEXT:
+        reg = 0x04;
+        break;
+    case SEG_CTEXT:
+        reg = 0x06;
+        break;
+    default:
+        reg = 0x00;
+        break;
+    }
+
+    stdvga_crtc_write(VGAREG_VGA_CRTC_ADDRESS, EXTENDED_MODE_CONTROL, reg);
+
+    return stdvga_set_mode(vmode_g, flags);
+}
+

 /****************************************************************
 * Init Functions
diff --git a/vgasrc/geodevga.h b/vgasrc/geodevga.h
index fd7ce43..86f5d48 100644
--- a/vgasrc/geodevga.h
+++ b/vgasrc/geodevga.h
@@ -71,5 +71,6 @@
 #define DC_CFG_MSK                      0xf000a6

 int geodevga_init();
+int geodevga_set_mode(struct vgamode_s *vmode_g, int flags);

 #endif
-- 
1.7.11.rc2.5.g68f532f




More information about the SeaBIOS mailing list