Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/stand Don't commit the selected VBE mode until...



details:   https://anonhg.NetBSD.org/src/rev/de1e21218ec0
branches:  trunk
changeset: 747421:de1e21218ec0
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Sep 14 11:56:27 2009 +0000

description:
Don't commit the selected VBE mode until the loader is past the point of
no return; need to stick in text mode as long as possible since libsa does
not include a rasops library. While here, add the 'vesa' command to pxeboot
to mirror biosboot behaviour.

diffstat:

 sys/arch/i386/stand/lib/exec.c     |  10 +++++++---
 sys/arch/i386/stand/lib/vbe.c      |  29 ++++++++++++++++++++++++-----
 sys/arch/i386/stand/lib/vbe.h      |   3 ++-
 sys/arch/i386/stand/pxeboot/main.c |   5 ++++-
 4 files changed, 37 insertions(+), 10 deletions(-)

diffs (164 lines):

diff -r bf0de7972534 -r de1e21218ec0 sys/arch/i386/stand/lib/exec.c
--- a/sys/arch/i386/stand/lib/exec.c    Mon Sep 14 11:45:01 2009 +0000
+++ b/sys/arch/i386/stand/lib/exec.c    Mon Sep 14 11:56:27 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec.c,v 1.41 2009/09/13 18:13:37 jmcneill Exp $        */
+/*     $NetBSD: exec.c,v 1.42 2009/09/14 11:56:27 jmcneill Exp $        */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -114,6 +114,7 @@
 #include "libi386.h"
 #include "bootinfo.h"
 #include "bootmod.h"
+#include "vbe.h"
 #ifdef SUPPORT_PS2
 #include "biosmca.h"
 #endif
@@ -289,8 +290,6 @@
        BI_ALLOC(32); /* ??? */
 
        BI_ADD(&btinfo_console, BTINFO_CONSOLE, sizeof(struct btinfo_console));
-       BI_ADD(&btinfo_framebuffer, BTINFO_FRAMEBUFFER,
-           sizeof(struct btinfo_framebuffer));
 
        howto = boothowto;
 
@@ -323,6 +322,11 @@
        btinfo_symtab.esym = marks[MARK_END];
        BI_ADD(&btinfo_symtab, BTINFO_SYMTAB, sizeof(struct btinfo_symtab));
 
+       /* set new video mode if necessary */
+       vbe_commit();
+       BI_ADD(&btinfo_framebuffer, BTINFO_FRAMEBUFFER,
+           sizeof(struct btinfo_framebuffer));
+
        if (callback != NULL)
                (*callback)();
        startprog(marks[MARK_ENTRY], BOOT_NARGS, boot_argv,
diff -r bf0de7972534 -r de1e21218ec0 sys/arch/i386/stand/lib/vbe.c
--- a/sys/arch/i386/stand/lib/vbe.c     Mon Sep 14 11:45:01 2009 +0000
+++ b/sys/arch/i386/stand/lib/vbe.c     Mon Sep 14 11:56:27 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vbe.c,v 1.3 2009/08/24 02:15:46 jmcneill Exp $ */
+/* $NetBSD: vbe.c,v 1.4 2009/09/14 11:56:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -42,6 +42,7 @@
 
 static struct _vbestate {
        int             available;
+       int             modenum;
 } vbestate;
 
 static void
@@ -91,6 +92,7 @@
 
        vbe_dump(&vbe);
        vbestate.available = 1;
+       vbestate.modenum = 0;
 }
 
 int
@@ -173,6 +175,22 @@
        return 0;
 }
 
+int
+vbe_commit(void)
+{
+       int ret = 1;
+
+       if (vbestate.modenum > 0) {
+               ret = vbe_set_mode(vbestate.modenum);
+               if (ret) {
+                       printf("WARNING: failed to set VESA VBE mode 0x%x\n",
+                           vbestate.modenum);
+                       delay(5000000);
+               }
+       }
+       return ret;
+}
+
 static void *
 vbe_farptr(uint32_t farptr)
 {
@@ -330,8 +348,7 @@
        }
 
        if (strcmp(arg, "disabled") == 0 || strcmp(arg, "off") == 0) {
-               framebuffer_configure(NULL);
-               biosvideomode();
+               vbestate.modenum = 0;
                return;
        }
 
@@ -341,13 +358,15 @@
                modenum = strtoul(arg, NULL, 0);
        else if (strchr(arg, 'x') != NULL) {
                modenum = vbe_find_mode(arg);
-               if (modenum == 0)
+               if (modenum == 0) {
+                       printf("mode %s not supported by firmware\n", arg);
                        return;
+               }
        } else
                modenum = 0;
 
        if (modenum >= 0x100) {
-               vbe_set_mode(modenum);
+               vbestate.modenum = modenum;
                return;
        }
 
diff -r bf0de7972534 -r de1e21218ec0 sys/arch/i386/stand/lib/vbe.h
--- a/sys/arch/i386/stand/lib/vbe.h     Mon Sep 14 11:45:01 2009 +0000
+++ b/sys/arch/i386/stand/lib/vbe.h     Mon Sep 14 11:56:27 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vbe.h,v 1.1 2009/02/16 22:39:31 jmcneill Exp $ */
+/* $NetBSD: vbe.h,v 1.2 2009/09/14 11:56:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -94,6 +94,7 @@
 
 /* high-level VBE helpers, from vbe.c */
 void vbe_init(void);
+int vbe_commit(void);
 int vbe_available(void);
 int vbe_set_mode(int);
 int vbe_set_palette(const uint8_t *, int);
diff -r bf0de7972534 -r de1e21218ec0 sys/arch/i386/stand/pxeboot/main.c
--- a/sys/arch/i386/stand/pxeboot/main.c        Mon Sep 14 11:45:01 2009 +0000
+++ b/sys/arch/i386/stand/pxeboot/main.c        Mon Sep 14 11:56:27 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.20 2009/03/21 15:01:56 ad Exp $     */
+/*     $NetBSD: main.c,v 1.21 2009/09/14 11:56:27 jmcneill Exp $       */
 
 /*
  * Copyright (c) 1996
@@ -48,6 +48,7 @@
 #include <bootmenu.h>
 #include <bootmod.h>
 #include "pxeboot.h"
+#include "vbe.h"
 
 extern struct x86_boot_params boot_params;
 
@@ -72,6 +73,7 @@
        { "consdev",    command_consdev },
        { "modules",    command_modules },
        { "load",       module_add },
+       { "vesa",       command_vesa },
        { NULL,         NULL },
 };
 
@@ -180,6 +182,7 @@
               "boot [filename] [-adsqv]\n"
               "     (ex. \"netbsd.old -s\"\n"
               "consdev {pc|com[0123]|com[0123]kbd|auto}\n"
+              "vesa {enabled|disabled|list|modenum}\n"
               "modules {enabled|disabled}\n"
               "load {path_to_module}\n"
               "help|?\n"



Home | Main Index | Thread Index | Old Index