From 841af5e01e3e6b017a4f0ab7800fdf14baffd93f Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Tue, 11 May 2010 15:39:20 +0000 Subject: Change real mode API to allow passing intXX number or entry point and some register values from C. This theoretically fixes non-vga option roms, but it also allows to use the same assembler code for option roms and vsm. It will also make using the bootsplash without yabel a lot easier. Factor out and improve BDA setup, do some rom segment setup for those option roms that need it. Don't call the coreboot exception handler if an exception occurs in real mode. It's only partly usable, but mainly the Kontron 986LCD-M (and other i945GM boards) choke on an exception #6 (invalid opcode). This particular issue is not introduced by the changes in this patch but has been around for quite a while at least. Signed-off-by: Stefan Reinauer Acked-by: Patrick Georgi git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5543 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/northbridge/via/cx700/cx700_vga.c | 14 +++++++++++--- src/northbridge/via/cx700/northbridge.h | 4 ++-- src/northbridge/via/vt8623/northbridge.h | 4 ++-- src/northbridge/via/vt8623/vga.c | 18 ++++++++++++++---- src/northbridge/via/vx800/northbridge.h | 3 ++- src/northbridge/via/vx800/vga.c | 16 ++++++++++++---- 6 files changed, 43 insertions(+), 16 deletions(-) (limited to 'src/northbridge') diff --git a/src/northbridge/via/cx700/cx700_vga.c b/src/northbridge/via/cx700/cx700_vga.c index 2999907616..2da428c32f 100644 --- a/src/northbridge/via/cx700/cx700_vga.c +++ b/src/northbridge/via/cx700/cx700_vga.c @@ -144,6 +144,17 @@ static void write_protect_vgabios(void) } #endif +static void vga_enable_console(void) +{ + /* Call VGA BIOS int10 function 0x4f14 to enable main console + * Epia-M does not always autosense the main console so forcing + * it on is good. + */ + + /* int#, EAX, EBX, ECX, EDX, ESI, EDI */ + realmode_interrupt(0x10, 0x4f1f, 0x8003, 0x0001, 0x0000, 0x0000, 0x0000); +} + static void vga_init(device_t dev) { u8 reg8; @@ -166,9 +177,6 @@ static void vga_init(device_t dev) if (pci_read_config32(dev, PCI_ROM_ADDRESS) != 0xc0000) return; printk(BIOS_DEBUG, "Enable VGA console\n"); - // this is how it should look: - // call_bios_interrupt(0x10,0x4f1f,0x8003,1,0); - // this is how it looks: vga_enable_console(); /* It's not clear if these need to be programmed before or after diff --git a/src/northbridge/via/cx700/northbridge.h b/src/northbridge/via/cx700/northbridge.h index 193ba1fa48..4ae9ce5937 100644 --- a/src/northbridge/via/cx700/northbridge.h +++ b/src/northbridge/via/cx700/northbridge.h @@ -21,6 +21,6 @@ #define NORTHBRIDGE_VIA_CX700_H extern unsigned int cx700_scan_root_bus(device_t root, unsigned int max); -extern void (*vga_enable_console)(void) __attribute__((regparm(0))); - +extern void (*realmode_interrupt)(u32 intno, u32 eax, u32 ebx, u32 ecx, u32 edx, + u32 esi, u32 edi) __attribute__((regparm(0))); #endif /* NORTHBRIDGE_VIA_CX700_H */ diff --git a/src/northbridge/via/vt8623/northbridge.h b/src/northbridge/via/vt8623/northbridge.h index b3a2e75f15..9c0828741c 100644 --- a/src/northbridge/via/vt8623/northbridge.h +++ b/src/northbridge/via/vt8623/northbridge.h @@ -2,7 +2,7 @@ #define NORTHBRIDGE_VIA_VT8623_H unsigned int vt8623_scan_root_bus(device_t root, unsigned int max); -extern void (*vga_enable_console)(void) __attribute__((regparm(0))); -void write_protect_vgabios(void); +extern void (*realmode_interrupt)(u32 intno, u32 eax, u32 ebx, u32 ecx, u32 edx, + u32 esi, u32 edi) __attribute__((regparm(0))); #endif /* NORTHBRIDGE_VIA_VT8623_H */ diff --git a/src/northbridge/via/vt8623/vga.c b/src/northbridge/via/vt8623/vga.c index 78ffe0aa94..eb780cafe7 100644 --- a/src/northbridge/via/vt8623/vga.c +++ b/src/northbridge/via/vt8623/vga.c @@ -72,7 +72,8 @@ static int via_vt8623_int15_handler(struct eregs *regs) return res; } -void write_protect_vgabios(void) +#ifdef UNUSED_CODE +static void write_protect_vgabios(void) { device_t dev; @@ -86,6 +87,7 @@ void write_protect_vgabios(void) if (dev) pci_write_config8(dev, 0x61, 0xaa); } +#endif static void vga_random_fixup(device_t dev) { @@ -96,6 +98,17 @@ static void vga_random_fixup(device_t dev) pci_write_config32(dev,0x14,0xdc000000); } +static void vga_enable_console(void) +{ + /* Call VGA BIOS int10 function 0x4f14 to enable main console + * Epia-M does not always autosense the main console so forcing + * it on is good. + */ + + /* int#, EAX, EBX, ECX, EDX, ESI, EDI */ + realmode_interrupt(0x10, 0x4f1f, 0x8003, 0x0001, 0x0000, 0x0000, 0x0000); +} + static void vga_init(device_t dev) { vga_random_fixup(dev); @@ -118,9 +131,6 @@ static void vga_init(device_t dev) pci_dev_init(dev); printk(BIOS_DEBUG, "Enable VGA console\n"); - // this is how it should look: - // call_bios_interrupt(0x10,0x4f1f,0x8003,1,0); - // this is how it looks: vga_enable_console(); #ifdef MEASURE_VGA_INIT_TIME diff --git a/src/northbridge/via/vx800/northbridge.h b/src/northbridge/via/vx800/northbridge.h index ed6bd13e2c..05f75d2649 100644 --- a/src/northbridge/via/vx800/northbridge.h +++ b/src/northbridge/via/vx800/northbridge.h @@ -21,6 +21,7 @@ #define NORTHBRIDGE_VIA_VX800_H extern unsigned int vx800_scan_root_bus(device_t root, unsigned int max); -extern void (*vga_enable_console)(void) __attribute__((regparm(0))); +extern void (*realmode_interrupt)(u32 intno, u32 eax, u32 ebx, u32 ecx, u32 edx, + u32 esi, u32 edi) __attribute__((regparm(0))); #endif /* NORTHBRIDGE_VIA_VX800_H */ diff --git a/src/northbridge/via/vx800/vga.c b/src/northbridge/via/vx800/vga.c index cd33770823..b57ba50e84 100644 --- a/src/northbridge/via/vx800/vga.c +++ b/src/northbridge/via/vx800/vga.c @@ -127,7 +127,7 @@ static int via_vx800_int15_handler(struct eregs *regs) } #ifdef UNUSED_CODE -void write_protect_vgabios(void) +static void write_protect_vgabios(void) { device_t dev; @@ -144,6 +144,17 @@ void write_protect_vgabios(void) } #endif +static void vga_enable_console(void) +{ + /* Call VGA BIOS int10 function 0x4f14 to enable main console + * Epia-M does not always autosense the main console so forcing + * it on is good. + */ + + /* int#, EAX, EBX, ECX, EDX, ESI, EDI */ + realmode_interrupt(0x10, 0x4f1f, 0x8003, 0x0001, 0x0000, 0x0000, 0x0000); +} + extern u8 acpi_sleep_type; static void vga_init(device_t dev) { @@ -170,9 +181,6 @@ static void vga_init(device_t dev) pci_dev_init(dev); printk(BIOS_DEBUG, "Enable VGA console\n"); - // this is how it should look: - // call_bios_interrupt(0x10,0x4f1f,0x8003,1,0); - // this is how it looks: vga_enable_console(); if ((acpi_sleep_type == 3)/* || (PAYLOAD_IS_SEABIOS == 0)*/) { -- cgit v1.2.3