[SeaBIOS] [PATCH 4/4] vgabios: Fill in available legacy modes in video_func_static at runtime

Kevin O'Connor kevin at koconnor.net
Thu Oct 23 22:45:12 CEST 2014


Instead of hard coding the list of modes, fill them in from the list
of supported modes.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 vgasrc/stdvgamodes.c | 9 +++++++++
 vgasrc/vgabios.c     | 4 ++--
 vgasrc/vgabios.h     | 1 +
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/vgasrc/stdvgamodes.c b/vgasrc/stdvgamodes.c
index 53b7463..c553514 100644
--- a/vgasrc/stdvgamodes.c
+++ b/vgasrc/stdvgamodes.c
@@ -397,6 +397,15 @@ stdvga_build_video_param(void)
                    , get_global_seg(), GET_GLOBAL(stdmode_g->grdc_regs)
                    , ARRAY_SIZE(vparam_g->grdc_regs));
     }
+
+    // Fill available legacy modes in video_func_static table
+    u32 modes = 0;
+    for (i = 0; i < ARRAY_SIZE(vga_modes); i++) {
+        u16 mode = vga_modes[i].mode;
+        if (mode <= 0x13)
+            modes |= 1<<i;
+    }
+    SET_VGA(static_functionality.modes, modes);
 }
 
 void
diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c
index 449a615..84c772d 100644
--- a/vgasrc/vgabios.c
+++ b/vgasrc/vgabios.c
@@ -1083,8 +1083,8 @@ handle_101a(struct bregs *regs)
 }
 
 
-static struct video_func_static static_functionality VAR16 = {
-    .modes          = 0x0fe0ff,
+struct video_func_static static_functionality VAR16 = {
+    .modes          = 0x00,   // Filled in by stdvga_build_video_param()
     .scanlines      = 0x07,   // 200, 350, 400 scan lines
     .cblocks        = 0x02,   // mamimum number of visible charsets in text mode
     .active_cblocks = 0x08,   // total number of charset blocks in text mode
diff --git a/vgasrc/vgabios.h b/vgasrc/vgabios.h
index fc1eba6..77782e6 100644
--- a/vgasrc/vgabios.h
+++ b/vgasrc/vgabios.h
@@ -110,6 +110,7 @@ struct cursorpos get_cursor_pos(u8 page);
 int bda_save_restore(int cmd, u16 seg, void *data);
 struct vgamode_s *get_current_mode(void);
 int vga_set_mode(int mode, int flags);
+extern struct video_func_static static_functionality;
 
 // vgafb.c
 void init_gfx_op(struct gfx_op *op, struct vgamode_s *vmode_g);
-- 
1.9.3




More information about the SeaBIOS mailing list