[SeaBIOS] [PATCH 2/5] SeaVGABios/cbvga: Assume VGA compatible GPU in text-mode

Patrick Rudolph siro at das-labor.org
Mon May 29 19:25:11 CEST 2017


Assume the GPU is VGA compatible when running in text-mode.
Advertise VGA modes.
Microsoft Windows relies on graphics mode 12 as last resort when
running in text mode. It is used even when not advertised.

Allows to boot Windows 7 in "Safe Mode" and shows the boot splash.

While the stdvga driver could be used instead, implementing it properly
in the cbvga driver allows to switch between text and gfx mode using
NVRAM option.

Signed-off-by: Patrick Rudolph <siro at das-labor.org>
---
 vgasrc/cbvga.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c
index 39ffdbb..49af7f9 100644
--- a/vgasrc/cbvga.c
+++ b/vgasrc/cbvga.c
@@ -21,6 +21,10 @@ static u32 CBlinelength VAR16;
 
 struct vgamode_s *cbvga_find_mode(int mode)
 {
+    /* Assume VGA compatible hardware in text-mode. */
+    if (GET_GLOBAL(CBmode) == 0x3)
+        return stdvga_find_mode(mode);
+
     if (mode == GET_GLOBAL(CBmode))
         return &CBmodeinfo;
     if (mode == 0x03)
@@ -31,11 +35,11 @@ struct vgamode_s *cbvga_find_mode(int mode)
 void
 cbvga_list_modes(u16 seg, u16 *dest, u16 *last)
 {
-    if (dest<last) {
-        SET_FARVAR(seg, *dest, GET_GLOBAL(CBmode));
-        dest++;
+
+    /* Assume VGA compatible hardware in text-mode. */
+    if (GET_GLOBAL(CBmode) == 0x3) {
+        stdvga_list_modes(seg, dest, last);
     }
-    SET_FARVAR(seg, *dest, 0xffff);
 }
 
 int
@@ -98,6 +102,11 @@ int
 cbvga_set_mode(struct vgamode_s *vmode_g, int flags)
 {
     u8 emul = vmode_g == &CBemulinfo || GET_GLOBAL(CBmode) == 0x03;
+
+    /* Assume VGA compatible hardware in text-mode. */
+    if (GET_GLOBAL(CBmode) == 0x03)
+        return stdvga_set_mode(vmode_g, flags);
+
     MASK_BDA_EXT(flags, BF_EMULATE_TEXT, emul ? BF_EMULATE_TEXT : 0);
     if (!(flags & MF_NOCLEARMEM)) {
         if (GET_GLOBAL(CBmodeinfo.memmodel) == MM_TEXT) {
-- 
2.9.3




More information about the SeaBIOS mailing list