Add stubs for VIA vga bios callbacks to system bios.
authorKevin O'Connor <kevin@koconnor.net>
Sun, 17 Aug 2008 15:11:07 +0000 (11:11 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 17 Aug 2008 15:11:07 +0000 (11:11 -0400)
The VIA vga bios likes wants to call int 15/5f of main bios.  So, add
    stubs to make it happy.

Makefile
src/system.c
src/util.h
src/vgahooks.c [new file with mode: 0644]

index 16d3882190ebc05b37e0d1222f90394333209fc4..693524b9b9c01b6c11d992667600b3c7f7e8b9bc 100644 (file)
--- 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
index 05fb9068bf5f5a2e73c240199435faa5f0f7a18a..2e19efa626549d134084c9eb41d4944153be14fb 100644 (file)
@@ -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;
index 88ecc0eebfbae4c8d96568773a64a08ed119c458..a9642b9ce839b39efeef410b6e2340970601e4ce 100644 (file)
@@ -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 (file)
index 0000000..7c229ba
--- /dev/null
@@ -0,0 +1,65 @@
+// Hooks for via vgabios calls into main bios.
+//
+// Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
+//
+// 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;
+    }
+}