Add stubs for VIA vga bios callbacks to system bios.
[seabios.git] / src / vgahooks.c
1 // Hooks for via vgabios calls into main bios.
2 //
3 // Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
4 //
5 // This file may be distributed under the terms of the GNU GPLv3 license.
6
7 #include "bregs.h" // set_fail
8 #include "util.h" // handle_155f
9 #include "config.h" // CONFIG_*
10
11 static void
12 handle_155f01(struct bregs *regs)
13 {
14     regs->eax = 0x5f;
15     regs->cl = 2; // panel type =  2 = 1024 * 768
16     set_success(regs);
17 }
18
19 static void
20 handle_155f02(struct bregs *regs)
21 {
22     regs->eax = 0x5f;
23     regs->bx = 2;
24     regs->cx = 0x401;  // PAL + crt only
25     regs->dx = 0;  // TV Layout - default
26     set_success(regs);
27 }
28
29 static void
30 handle_155f18(struct bregs *regs)
31 {
32     regs->eax = 0x5f;
33     regs->ebx = 0x545; // MCLK = 133, 32M frame buffer, 256 M main memory
34     regs->ecx = 0x060;
35     set_success(regs);
36 }
37
38 static void
39 handle_155f19(struct bregs *regs)
40 {
41     set_fail_silent(regs);
42 }
43
44 static void
45 handle_155fXX(struct bregs *regs)
46 {
47     set_code_fail(regs, RET_EUNSUPPORTED);
48 }
49
50 void
51 handle_155f(struct bregs *regs)
52 {
53     if (! CONFIG_VGAHOOKS) {
54         handle_155fXX(regs);
55         return;
56     }
57
58     switch (regs->al) {
59     case 0x01: handle_155f01(regs); break;
60     case 0x02: handle_155f02(regs); break;
61     case 0x18: handle_155f18(regs); break;
62     case 0x19: handle_155f19(regs); break;
63     default:   handle_155fXX(regs); break;
64     }
65 }