aboutsummaryrefslogtreecommitdiff
path: root/src/northbridge/via/vx800/vga.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/northbridge/via/vx800/vga.c')
-rw-r--r--src/northbridge/via/vx800/vga.c129
1 files changed, 98 insertions, 31 deletions
diff --git a/src/northbridge/via/vx800/vga.c b/src/northbridge/via/vx800/vga.c
index ee010a0c8b..3897e010b5 100644
--- a/src/northbridge/via/vx800/vga.c
+++ b/src/northbridge/via/vx800/vga.c
@@ -32,9 +32,9 @@
#include <cpu/cpu.h>
#include <cpu/x86/mtrr.h>
#include <cpu/x86/msr.h>
+#include <arch/interrupt.h>
#include "chip.h"
#include "northbridge.h"
-#include "vgachip.h"
/* PCI Domain 1 Device 0 Function 0 */
@@ -49,6 +49,83 @@
#define VIACONFIG_VGA_PCI_10 0xf8000008
#define VIACONFIG_VGA_PCI_14 0xfc000000
+static int via_vx800_int15_handler(struct eregs *regs)
+{
+ int res=-1;
+ printk(BIOS_DEBUG, "via_vx800_int15_handler\n");
+ switch(regs->eax & 0xffff) {
+ case 0x5f19:
+ regs->eax=0x5f;
+ regs->ecx=0x03;
+ res=0;
+ break;
+ case 0x5f18:
+ {
+ /*
+ * BL Bit[7:4]
+ * Memory Data Rate
+ * 0000: 66MHz
+ * 0001: 100MHz
+ * 0010: 133MHz
+ * 0011: 200MHz ( DDR200 )
+ * 0100: 266MHz ( DDR266 )
+ * 0101: 333MHz ( DDR333 )
+ * 0110: 400MHz ( DDR400 )
+ * 0111: 533MHz ( DDR I/II 533
+ * 1000: 667MHz ( DDR I/II 667)
+ * Bit[3:0]
+ * N: Frame Buffer Size 2^N MB
+ */
+ u8 i;
+ device_t dev;
+ dev = dev_find_slot(0, PCI_DEVFN(0, 3));
+ i = pci_read_config8(dev, 0xa1);
+ i = (i & 0x70);
+ i = i >> 4;
+ if (i == 0) {
+ regs->eax = 0x00; //not support 5f18
+ break;
+ }
+ i = i + 2;
+ regs->ebx = (u32) i;
+ i = pci_read_config8(dev, 0x90);
+ i = (i & 0x07);
+ i = i + 3;
+ i = i << 4;
+ regs->ebx = regs->ebx + ((u32) i);
+ regs->eax = 0x5f;
+ res = 0;
+ break;
+ }
+ case 0x5f00:
+ regs->eax = 0x005f;
+ res = 0;
+ break;
+ case 0x5f01:
+ regs->eax = 0x5f;
+ regs->ecx = (regs->ecx & 0xffffff00 ) | 2; // panel type = 2 = 1024 * 768
+ res = 0;
+ break;
+ case 0x5f02:
+ regs->eax=0x5f;
+ regs->ebx= (regs->ebx & 0xffff0000) | 2;
+ regs->ecx= (regs->ecx & 0xffff0000) | 0x401; // PAL + crt only
+ regs->edx= (regs->edx & 0xffff0000) | 0; // TV Layout - default
+ res=0;
+ break;
+ case 0x5f0f:
+ regs->eax = 0x005f;
+ res = 0;
+ break;
+ default:
+ printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
+ regs->eax & 0xffff);
+ regs->eax = 0;
+ break;
+ }
+ return res;
+}
+
void write_protect_vgabios(void)
{
device_t dev;
@@ -70,12 +147,12 @@ static void vga_init(device_t dev)
{
uint8_t reg8;
- print_debug("Initiailizing VGA...\n");
- u8 tmp8;
-//A20 OPEN
- tmp8 = inb(0x92);
- tmp8 = tmp8 | 2;
- outb(tmp8, 0x92);
+ mainboard_interrupt_handlers(0x15, &via_vx800_int15_handler);
+
+ //A20 OPEN
+ reg8 = inb(0x92);
+ reg8 = reg8 | 2;
+ outb(reg8, 0x92);
//*
//pci_write_config8(dev, 0x04, 0x07);
@@ -85,27 +162,17 @@ static void vga_init(device_t dev)
pci_write_config32(dev, 0x14, VIACONFIG_VGA_PCI_14);
pci_write_config8(dev, 0x3c, 0x0a); //same with vx855_lpc.c
//*/
- printk(BIOS_EMERG, "file '%s', line %d\n\n", __FILE__, __LINE__);
-#if 1
- printk(BIOS_DEBUG, "INSTALL REAL-MODE IDT\n");
- setup_realmode_idt();
- printk(BIOS_DEBUG, "DO THE VGA BIOS\n");
+ printk(BIOS_DEBUG, "Initializing VGA...\n");
+
+ 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();
- do_vgabios();
- if ((acpi_sleep_type == 3)/* || (PAYLOAD_IS_SEABIOS == 0)*/) {
- printk(BIOS_DEBUG, "Enable VGA console\n");
- // remove this function since in cn700 it is said "VGA seems to work without this, but crash & burn with it"
- //but the existense of vga_enable_console() seems do not hurt my coreboot. XP+ubuntu s3 can resume with and without this function.
- //and remove it also do not help my s3 problem: desktop screen have some thin black line, after resuming back to win.
- vga_enable_console();
- }
-#else
-/* Attempt to manually force the rom to load */
- printk(BIOS_DEBUG, "Forcing rom load\n");
- pci_rom_load(dev, 0xfff80000);
- run_bios(dev, 0xc0000);
-#endif
if ((acpi_sleep_type == 3)/* || (PAYLOAD_IS_SEABIOS == 0)*/) {
/* It's not clear if these need to be programmed before or after
* the VGA bios runs. Try both, clean up later */
@@ -117,13 +184,13 @@ static void vga_init(device_t dev)
outb(0x3d, CRTM_INDEX);
outb(reg8, CRTM_DATA);
+#if 0
/* Set framebuffer size to CONFIG_VIDEO_MB mb */
- /*reg8 = (CONFIG_VIDEO_MB/4);
- outb(0x39, SR_INDEX);
- outb(reg8, SR_DATA); */
+ reg8 = (CONFIG_VIDEO_MB/4);
+ outb(0x39, SR_INDEX);
+ outb(reg8, SR_DATA);
+#endif
}
- printk(BIOS_EMERG, "file '%s', line %d\n\n", __FILE__, __LINE__);
-
}
static struct device_operations vga_operations = {