From e91ec7c7735eda163efc6ece9ac95e12e8adf497 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 14 Jan 2012 16:30:49 -0500 Subject: [PATCH] vgabios: Hook up Cirrus extended bios functions. Signed-off-by: Kevin O'Connor --- vgasrc/clext.c | 47 ++++++++++++++++++++++++++--------------------- vgasrc/clext.h | 4 +++- vgasrc/vgabios.c | 11 ++++++----- 3 files changed, 35 insertions(+), 27 deletions(-) diff --git a/vgasrc/clext.c b/vgasrc/clext.c index 835d809..9bd424e 100644 --- a/vgasrc/clext.c +++ b/vgasrc/clext.c @@ -452,7 +452,7 @@ cirrus_check(void) ****************************************************************/ static void -cirrus_extbios_80h(struct bregs *regs) +clext_101280(struct bregs *regs) { u16 crtc_addr = stdvga_get_crtc(); outb(0x27, crtc_addr); @@ -470,14 +470,14 @@ cirrus_extbios_80h(struct bregs *regs) } static void -cirrus_extbios_81h(struct bregs *regs) +clext_101281(struct bregs *regs) { // XXX regs->ax = 0x0100; } static void -cirrus_extbios_82h(struct bregs *regs) +clext_101282(struct bregs *regs) { u16 crtc_addr = stdvga_get_crtc(); outb(0x27, crtc_addr); @@ -486,13 +486,13 @@ cirrus_extbios_82h(struct bregs *regs) } static void -cirrus_extbios_85h(struct bregs *regs) +clext_101285(struct bregs *regs) { regs->al = cirrus_get_memsize(); } static void -cirrus_extbios_9Ah(struct bregs *regs) +clext_10129a(struct bregs *regs) { regs->ax = 0x4060; regs->cx = 0x1132; @@ -507,7 +507,7 @@ ASM16( "retf"); static void -cirrus_extbios_A0h(struct bregs *regs) +clext_1012a0(struct bregs *regs) { struct cirrus_mode_s *table_g = cirrus_get_modeentry(regs->al & 0x7f); regs->ah = (table_g ? 1 : 0); @@ -516,38 +516,43 @@ cirrus_extbios_A0h(struct bregs *regs) } static void -cirrus_extbios_A1h(struct bregs *regs) +clext_1012a1(struct bregs *regs) { regs->bx = 0x0e00; // IBM 8512/8513, color } static void -cirrus_extbios_A2h(struct bregs *regs) +clext_1012a2(struct bregs *regs) { regs->al = 0x07; // HSync 31.5 - 64.0 kHz } static void -cirrus_extbios_AEh(struct bregs *regs) +clext_1012ae(struct bregs *regs) { regs->al = 0x01; // High Refresh 75Hz } +static void +clext_1012XX(struct bregs *regs) +{ + debug_stub(regs); +} + void -cirrus_extbios(struct bregs *regs) +clext_1012(struct bregs *regs) { - // XXX - regs->bl < 0x80 or > 0xaf call regular handlers. switch (regs->bl) { - case 0x80: cirrus_extbios_80h(regs); break; - case 0x81: cirrus_extbios_81h(regs); break; - case 0x82: cirrus_extbios_82h(regs); break; - case 0x85: cirrus_extbios_85h(regs); break; - case 0x9a: cirrus_extbios_9Ah(regs); break; - case 0xa0: cirrus_extbios_A0h(regs); break; - case 0xa1: cirrus_extbios_A1h(regs); break; - case 0xa2: cirrus_extbios_A2h(regs); break; - case 0xae: cirrus_extbios_AEh(regs); break; - default: break; + case 0x80: clext_101280(regs); break; + case 0x81: clext_101281(regs); break; + case 0x82: clext_101282(regs); break; + case 0x85: clext_101285(regs); break; + case 0x9a: clext_10129a(regs); break; + case 0xa0: clext_1012a0(regs); break; + case 0xa1: clext_1012a1(regs); break; + case 0xa2: clext_1012a2(regs); break; + case 0xae: clext_1012ae(regs); break; + default: clext_1012XX(regs); break; } } diff --git a/vgasrc/clext.h b/vgasrc/clext.h index f337b65..a14cf13 100644 --- a/vgasrc/clext.h +++ b/vgasrc/clext.h @@ -1,11 +1,13 @@ #ifndef __CLEXT_H #define __CLEXT_H -#include "types.h" // u8 +#include "types.h" // u16 struct vgamode_s *clext_find_mode(int mode); int clext_set_mode(int mode, int flags); void clext_list_modes(u16 seg, u16 *dest, u16 *last); int clext_init(void); +struct bregs; +void clext_1012(struct bregs *regs); #endif // clext.h diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c index f351107..8ab5baa 100644 --- a/vgasrc/vgabios.c +++ b/vgasrc/vgabios.c @@ -18,9 +18,7 @@ #include "optionroms.h" // struct pci_data #include "config.h" // CONFIG_* #include "stdvga.h" // stdvga_set_cursor_shape -#include "geodevga.h" // geodevga_init -#include "bochsvga.h" // bochsvga_init -#include "clext.h" // clext_init +#include "clext.h" // clext_1012 #include "vgahw.h" // vgahw_set_mode // XXX @@ -942,6 +940,11 @@ handle_1012XX(struct bregs *regs) static void handle_1012(struct bregs *regs) { + if (CONFIG_VGA_CIRRUS && regs->bl >= 0x80) { + clext_1012(regs); + return; + } + switch (regs->bl) { case 0x10: handle_101210(regs); break; case 0x30: handle_101230(regs); break; @@ -953,8 +956,6 @@ handle_1012(struct bregs *regs) case 0x36: handle_101236(regs); break; default: handle_1012XX(regs); break; } - - // XXX - cirrus has 1280, 1281, 1282, 1285, 129a, 12a0, 12a1, 12a2, 12ae } -- 2.25.1