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.
This commit is contained in:
jmcneill 2009-09-14 11:56:27 +00:00
parent 33e10c238e
commit 1ea984dc79
4 changed files with 37 additions and 10 deletions

View File

@ -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 @@ exec_netbsd(const char *file, physaddr_t loadaddr, int boothowto, int floppy,
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 @@ exec_netbsd(const char *file, physaddr_t loadaddr, int boothowto, int floppy,
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,

View File

@ -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>
@ -42,6 +42,7 @@ static int vbeverbose = 1;
static struct _vbestate {
int available;
int modenum;
} vbestate;
static void
@ -91,6 +92,7 @@ vbe_init(void)
vbe_dump(&vbe);
vbestate.available = 1;
vbestate.modenum = 0;
}
int
@ -173,6 +175,22 @@ vbe_set_mode(int modenum)
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 @@ command_vesa(char *cmd)
}
if (strcmp(arg, "disabled") == 0 || strcmp(arg, "off") == 0) {
framebuffer_configure(NULL);
biosvideomode();
vbestate.modenum = 0;
return;
}
@ -341,13 +358,15 @@ command_vesa(char *cmd)
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;
}

View File

@ -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>
@ -94,6 +94,7 @@ int biosvbe_palette_data(int, int, struct paletteentry *);
/* 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);

View File

@ -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 @@ const struct bootblk_command commands[] = {
{ "consdev", command_consdev },
{ "modules", command_modules },
{ "load", module_add },
{ "vesa", command_vesa },
{ NULL, NULL },
};
@ -180,6 +182,7 @@ command_help(char *arg)
"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"