From cbffa8ed98f0e87d7c926594fe73f6e56e86da5f Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 17 Aug 2008 11:11:07 -0400 Subject: Add stubs for VIA vga bios callbacks to system bios. The VIA vga bios likes wants to call int 15/5f of main bios. So, add stubs to make it happy. --- Makefile | 2 +- src/system.c | 1 + src/util.h | 3 +++ src/vgahooks.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/vgahooks.c diff --git a/Makefile b/Makefile index 16d3882..693524b 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ OUT=out/ # Source files SRCBOTH=output.c util.c floppy.c ata.c system.c mouse.c kbd.c pci.c \ serial.c clock.c pic.c cdrom.c ps2port.c -SRC16=$(SRCBOTH) disk.c apm.c pcibios.c +SRC16=$(SRCBOTH) disk.c apm.c pcibios.c vgahooks.c SRC32=$(SRCBOTH) post.c shadow.c post_menu.c memmap.c coreboot.c boot.c \ acpi.c pirtable.c smm.c smpdetect.c mptable.c smbios.c pciinit.c TABLESRC=font.c cbt.c floppy_dbt.c diff --git a/src/system.c b/src/system.c index 05fb906..2e19efa 100644 --- a/src/system.c +++ b/src/system.c @@ -318,6 +318,7 @@ handle_15(struct bregs *regs) case 0x4f: handle_154f(regs); break; case 0x52: handle_1552(regs); break; case 0x53: handle_1553(regs); break; + case 0x5f: handle_155f(regs); break; case 0x83: handle_1583(regs); break; case 0x86: handle_1586(regs); break; case 0x87: handle_1587(regs); break; diff --git a/src/util.h b/src/util.h index 88ecc0e..a9642b9 100644 --- a/src/util.h +++ b/src/util.h @@ -154,4 +154,7 @@ void interactive_bootmenu(); // coreboot.c void coreboot_fill_map(); +// vgahooks.c +void handle_155f(); + #endif // util.h diff --git a/src/vgahooks.c b/src/vgahooks.c new file mode 100644 index 0000000..7c229ba --- /dev/null +++ b/src/vgahooks.c @@ -0,0 +1,65 @@ +// Hooks for via vgabios calls into main bios. +// +// Copyright (C) 2008 Kevin O'Connor +// +// This file may be distributed under the terms of the GNU GPLv3 license. + +#include "bregs.h" // set_fail +#include "util.h" // handle_155f +#include "config.h" // CONFIG_* + +static void +handle_155f01(struct bregs *regs) +{ + regs->eax = 0x5f; + regs->cl = 2; // panel type = 2 = 1024 * 768 + set_success(regs); +} + +static void +handle_155f02(struct bregs *regs) +{ + regs->eax = 0x5f; + regs->bx = 2; + regs->cx = 0x401; // PAL + crt only + regs->dx = 0; // TV Layout - default + set_success(regs); +} + +static void +handle_155f18(struct bregs *regs) +{ + regs->eax = 0x5f; + regs->ebx = 0x545; // MCLK = 133, 32M frame buffer, 256 M main memory + regs->ecx = 0x060; + set_success(regs); +} + +static void +handle_155f19(struct bregs *regs) +{ + set_fail_silent(regs); +} + +static void +handle_155fXX(struct bregs *regs) +{ + set_code_fail(regs, RET_EUNSUPPORTED); +} + +void +handle_155f(struct bregs *regs) +{ + if (! CONFIG_VGAHOOKS) { + handle_155fXX(regs); + return; + } + + switch (regs->al) { + case 0x01: handle_155f01(regs); break; + case 0x02: handle_155f02(regs); break; + case 0x18: handle_155f18(regs); break; + case 0x19: handle_155f19(regs); break; + default: handle_155fXX(regs); break; + } +} -- cgit v1.1