[coreboot] [commit] r5478 - in trunk/src: devices/oprom mainboard/via/epia-m northbridge/via/vt8623
repository service
svn at coreboot.org
Thu Apr 22 20:15:33 CEST 2010
Author: stepan
Date: Thu Apr 22 20:15:32 2010
New Revision: 5478
URL: https://tracker.coreboot.org/trac/coreboot/changeset/5478
Log:
via epia-m now works with default x86.c instead of its own copy of vgabios.c.
Allows to drop quite a bunch of nasty code
Signed-off-by: Stefan Reinauer <stepan at coresystems.de>
Acked-by: Stefan Reinauer <stepan at coresystems.de>
Added:
trunk/src/northbridge/via/vt8623/vga.c
Deleted:
trunk/src/mainboard/via/epia-m/Makefile.inc
trunk/src/mainboard/via/epia-m/vgabios.c
trunk/src/mainboard/via/epia-m/vgachip.h
Modified:
trunk/src/devices/oprom/x86.c
trunk/src/devices/oprom/x86_asm.S
trunk/src/mainboard/via/epia-m/Kconfig
trunk/src/mainboard/via/epia-m/devicetree.cb
trunk/src/mainboard/via/epia-m/mainboard.c
trunk/src/mainboard/via/epia-m/romstage.c
trunk/src/northbridge/via/vt8623/Makefile.inc
trunk/src/northbridge/via/vt8623/northbridge.c
trunk/src/northbridge/via/vt8623/northbridge.h
Modified: trunk/src/devices/oprom/x86.c
==============================================================================
--- trunk/src/devices/oprom/x86.c Thu Apr 22 15:18:09 2010 (r5477)
+++ trunk/src/devices/oprom/x86.c Thu Apr 22 20:15:32 2010 (r5478)
@@ -318,7 +318,7 @@
/* Pass errors back to our caller via the CARRY flag */
if (ret) {
- printk(BIOS_DEBUG,"error!\n");
+ printk(BIOS_DEBUG,"int%02x call returned error.\n", intnumber);
flags |= 1; // error: set carry
}else{
flags &= ~1; // no error: clear carry
Modified: trunk/src/devices/oprom/x86_asm.S
==============================================================================
--- trunk/src/devices/oprom/x86_asm.S Thu Apr 22 15:18:09 2010 (r5477)
+++ trunk/src/devices/oprom/x86_asm.S Thu Apr 22 20:15:32 2010 (r5478)
@@ -257,8 +257,6 @@
.globl __run_interrupt
__run_interrupt = RELOCATED(.)
- /* paranoia -- does ecx get saved? not sure. This is
- * the easiest safe thing to do. */
pushal
/* save the stack */
mov %esp, __stack
Modified: trunk/src/mainboard/via/epia-m/Kconfig
==============================================================================
--- trunk/src/mainboard/via/epia-m/Kconfig Thu Apr 22 15:18:09 2010 (r5477)
+++ trunk/src/mainboard/via/epia-m/Kconfig Thu Apr 22 20:15:32 2010 (r5478)
@@ -22,24 +22,8 @@
default "EPIA-M"
depends on BOARD_VIA_EPIA_M
-config RAMBASE
- hex
- default 0x4000
- depends on BOARD_VIA_EPIA_M
-
config IRQ_SLOT_COUNT
int
default 5
depends on BOARD_VIA_EPIA_M
-# this is done by this board's vgabios.c already
-config VGA_ROM_RUN
- bool
- default n
- depends on BOARD_VIA_EPIA_M
-
-config PCI_ROM_RUN
- bool
- default n
- depends on BOARD_VIA_EPIA_M
-
Modified: trunk/src/mainboard/via/epia-m/devicetree.cb
==============================================================================
--- trunk/src/mainboard/via/epia-m/devicetree.cb Thu Apr 22 15:18:09 2010 (r5477)
+++ trunk/src/mainboard/via/epia-m/devicetree.cb Thu Apr 22 20:15:32 2010 (r5478)
@@ -7,6 +7,10 @@
end
device pci_domain 0 on
+
+ device pci 0.0 on end
+ device pci 1.0 on end
+
chip southbridge/via/vt8235
device pci 10.0 on end # USB 1.1
Modified: trunk/src/mainboard/via/epia-m/mainboard.c
==============================================================================
--- trunk/src/mainboard/via/epia-m/mainboard.c Thu Apr 22 15:18:09 2010 (r5477)
+++ trunk/src/mainboard/via/epia-m/mainboard.c Thu Apr 22 20:15:32 2010 (r5478)
@@ -1,40 +1,5 @@
-#include <console/console.h>
#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include <arch/io.h>
#include "chip.h"
-#include "vgachip.h"
-
-static void vga_fixup(void) {
- // we do this right here because:
- // - all the hardware is working, and some VGA bioses seem to need
- // that
- // - we need page 0 below for coreboot tables.
-
- printk(BIOS_DEBUG, "INSTALL REAL-MODE IDT\n");
- setup_realmode_idt();
- printk(BIOS_DEBUG, "DO THE VGA BIOS\n");
- do_vgabios();
- post_code(0x93);
- vga_enable_console();
-}
-
-void write_protect_vgabios(void)
-{
- device_t dev;
-
- printk(BIOS_INFO, "write_protect_vgabios\n");
- /* there are two possible devices. Just do both. */
- dev = dev_find_device(PCI_VENDOR_ID_VIA, 0x3122, 0);
- if(dev)
- pci_write_config8(dev, 0x61, 0xaa);
-
- dev = dev_find_device(PCI_VENDOR_ID_VIA, 0x3123, 0);
- if(dev)
- pci_write_config8(dev, 0x61, 0xaa);
-}
struct chip_operations mainboard_ops = {
CHIP_NAME("VIA EPIA-M Mainboard")
Modified: trunk/src/mainboard/via/epia-m/romstage.c
==============================================================================
--- trunk/src/mainboard/via/epia-m/romstage.c Thu Apr 22 15:18:09 2010 (r5477)
+++ trunk/src/mainboard/via/epia-m/romstage.c Thu Apr 22 20:15:32 2010 (r5478)
@@ -30,7 +30,7 @@
{
device_t dev;
- dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
+ dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA,
PCI_DEVICE_ID_VIA_8235), 0);
if (dev == PCI_DEV_INVALID) {
@@ -82,7 +82,7 @@
* Disable the firewire stuff, which apparently steps on IO 0+ on
* reset. Doh!
*/
- dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
+ dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA,
PCI_DEVICE_ID_VIA_6305), 0);
if (dev != PCI_DEV_INVALID) {
pci_write_config8(dev, 0x15, 0x1c);
@@ -94,14 +94,12 @@
enable_smbus();
- print_spew("In romstage.c:main()\n");
-
/* Halt if there was a built in self test failure */
report_bist_failure(bist);
// init_timer();
- outb(5, 0x80);
+ post_code(0x05);
print_debug(" Enabling mainboard devices\n");
enable_mainboard_devices();
@@ -113,18 +111,11 @@
/* Check all of memory */
#if 0
- ram_check(0x00000000, msr.lo);
-#endif
-#if 0
static const struct {
unsigned long lo, hi;
} check_addrs[] = {
/* Check 16MB of memory @ 0*/
{ 0x00000000, 0x01000000 },
-#if TOTAL_CPUS > 1
- /* Check 16MB of memory @ 2GB */
- { 0x80000000, 0x81000000 },
-#endif
};
int i;
for(i = 0; i < ARRAY_SIZE(check_addrs); i++) {
Modified: trunk/src/northbridge/via/vt8623/Makefile.inc
==============================================================================
--- trunk/src/northbridge/via/vt8623/Makefile.inc Thu Apr 22 15:18:09 2010 (r5477)
+++ trunk/src/northbridge/via/vt8623/Makefile.inc Thu Apr 22 20:15:32 2010 (r5478)
@@ -19,4 +19,5 @@
##
driver-y += northbridge.o
+driver-y += vga.o
Modified: trunk/src/northbridge/via/vt8623/northbridge.c
==============================================================================
--- trunk/src/northbridge/via/vt8623/northbridge.c Thu Apr 22 15:18:09 2010 (r5477)
+++ trunk/src/northbridge/via/vt8623/northbridge.c Thu Apr 22 20:15:32 2010 (r5478)
@@ -105,82 +105,6 @@
.device = PCI_DEVICE_ID_VIA_8633_1,
};
-static void vga_init(device_t dev)
-{
- //unsigned long fb;
- //msr_t clocks1,clocks2,instructions,setup;
-
- printk(BIOS_DEBUG, "VGA random fixup ...\n");
- pci_write_config8(dev, 0x04, 0x07);
- pci_write_config8(dev, 0x0d, 0x20);
- pci_write_config32(dev,0x10,0xd8000008);
- pci_write_config32(dev,0x14,0xdc000000);
-
- // set up performnce counters for debugging vga init sequence
- //setup.lo = 0x1c0; // count instructions
- //wrmsr(0x187,setup);
- //instructions.hi = 0;
- //instructions.lo = 0;
- //wrmsr(0xc2,instructions);
- //clocks1 = rdmsr(0x10);
-
-
-#if 0
- /* code to make vga init go through the emulator - as of yet this does not workfor the epia-m */
- pci_dev_init(dev);
-
- call_bios_interrupt(0x10,0x4f1f,0x8003,1,0);
-
- //clocks2 = rdmsr(0x10);
- //instructions = rdmsr(0xc2);
-
- printk(BIOS_DEBUG, "Clocks 1 = %08x:%08x\n",clocks1.hi,clocks1.lo);
- printk(BIOS_DEBUG, "Clocks 2 = %08x:%08x\n",clocks2.hi,clocks2.lo);
- printk(BIOS_DEBUG, "Instructions = %08x:%08x\n",instructions.hi,instructions.lo);
-
-#else
-
- /* code to make vga init run in real mode - does work but against the current coreboot philosophy */
- printk(BIOS_DEBUG, "INSTALL REAL-MODE IDT\n");
- setup_realmode_idt();
- printk(BIOS_DEBUG, "DO THE VGA BIOS\n");
- do_vgabios();
-
- //clocks2 = rdmsr(0x10);
- //instructions = rdmsr(0xc2);
-
- //printk(BIOS_DEBUG, "Clocks 1 = %08x:%08x\n",clocks1.hi,clocks1.lo);
- //printk(BIOS_DEBUG, "Clocks 2 = %08x:%08x\n",clocks2.hi,clocks2.lo);
- //printk(BIOS_DEBUG, "Instructions = %08x:%08x\n",instructions.hi,instructions.lo);
-
- vga_enable_console();
-
-#endif
-
- pci_write_config32(dev,0x30,0);
-
- /* Set the vga mtrrs - disable for the moment as the add_var_mtrr function has vapourised */
-#if 0
- add_var_mtrr( 0xd0000000 >> 10, 0x08000000>>10, MTRR_TYPE_WRCOMB);
- fb = pci_read_config32(dev,0x10); // get the fb address
- add_var_mtrr( fb>>10, 8192, MTRR_TYPE_WRCOMB);
-#endif
-}
-
-static struct device_operations vga_operations = {
- .read_resources = pci_dev_read_resources,
- .set_resources = pci_dev_set_resources,
- .enable_resources = pci_dev_enable_resources,
- .init = vga_init,
- .ops_pci = 0,
-};
-
-static const struct pci_driver vga_driver __pci_driver = {
- .ops = &vga_operations,
- .vendor = PCI_VENDOR_ID_VIA,
- .device = 0x3122,
-};
-
static void ram_resource(device_t dev, unsigned long index,
unsigned long basek, unsigned long sizek)
{
Modified: trunk/src/northbridge/via/vt8623/northbridge.h
==============================================================================
--- trunk/src/northbridge/via/vt8623/northbridge.h Thu Apr 22 15:18:09 2010 (r5477)
+++ trunk/src/northbridge/via/vt8623/northbridge.h Thu Apr 22 20:15:32 2010 (r5478)
@@ -2,11 +2,7 @@
#define NORTHBRIDGE_VIA_VT8623_H
unsigned int vt8623_scan_root_bus(device_t root, unsigned int max);
-
-void vga_enable_console(void);
-void do_vgabios(void);
-void setup_realmode_idt(void);
+extern void (*vga_enable_console)(void) __attribute__((regparm(0)));
void write_protect_vgabios(void);
-
#endif /* NORTHBRIDGE_VIA_VT8623_H */
Added: trunk/src/northbridge/via/vt8623/vga.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/src/northbridge/via/vt8623/vga.c Thu Apr 22 20:15:32 2010 (r5478)
@@ -0,0 +1,158 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007-2009 coresystems GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <console/console.h>
+#include <arch/io.h>
+#include <stdint.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <stdlib.h>
+#include <string.h>
+#include <bitops.h>
+#include <cpu/cpu.h>
+#include <cpu/x86/mtrr.h>
+#include <cpu/x86/msr.h>
+#include <arch/interrupt.h>
+#include "chip.h"
+#include "northbridge.h"
+
+static int via_vt8623_int15_handler(struct eregs *regs)
+{
+ int res=-1;
+ printk(BIOS_DEBUG, "via_vt8623_int15_handler\n");
+ switch(regs->eax & 0xffff) {
+ case 0x5f19:
+ break;
+ case 0x5f18:
+ regs->eax=0x5f;
+ regs->ebx=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory
+ regs->ecx=0x060;
+ res=0;
+ break;
+ case 0x5f00:
+ regs->eax = 0x8600;
+ 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=0x860f;
+ break;
+ default:
+ printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
+ regs->eax & 0xffff);
+ break;
+ }
+ return res;
+}
+
+void write_protect_vgabios(void)
+{
+ device_t dev;
+
+ printk(BIOS_DEBUG, "write_protect_vgabios\n");
+
+ dev = dev_find_device(PCI_VENDOR_ID_VIA, 0x3122, 0);
+ if (dev)
+ pci_write_config8(dev, 0x61, 0xaa);
+
+ dev = dev_find_device(PCI_VENDOR_ID_VIA, 0x3123, 0);
+ if (dev)
+ pci_write_config8(dev, 0x61, 0xaa);
+}
+
+static void vga_random_fixup(device_t dev)
+{
+ printk(BIOS_DEBUG, "VGA random fixup ...\n");
+ pci_write_config8(dev, 0x04, 0x07);
+ pci_write_config8(dev, 0x0d, 0x20);
+ pci_write_config32(dev,0x10,0xd8000008);
+ pci_write_config32(dev,0x14,0xdc000000);
+}
+
+static void vga_init(device_t dev)
+{
+ vga_random_fixup(dev);
+
+ mainboard_interrupt_handlers(0x15, &via_vt8623_int15_handler);
+
+#ifdef MEASURE_VGA_INIT_TIME
+ msr_t clocks1, clocks2, instructions, setup;
+
+ // set up performnce counters for debugging vga init sequence
+ setup.lo = 0x1c0; // count instructions
+ wrmsr(0x187,setup);
+ instructions.hi = 0;
+ instructions.lo = 0;
+ wrmsr(0xc2,instructions);
+ clocks1 = rdmsr(0x10);
+#endif
+ 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();
+
+#ifdef MEASURE_VGA_INIT_TIME
+ clocks2 = rdmsr(0x10);
+ instructions = rdmsr(0xc2);
+
+ printk(BIOS_DEBUG, "Clocks 1 = %08x:%08x\n",clocks1.hi,clocks1.lo);
+ printk(BIOS_DEBUG, "Clocks 2 = %08x:%08x\n",clocks2.hi,clocks2.lo);
+ printk(BIOS_DEBUG, "Instructions = %08x:%08x\n",instructions.hi,instructions.lo);
+#endif
+
+ pci_write_config32(dev, 0x30, 0);
+
+#if 0
+ /* Set the vga mtrrs - disable for the moment as the add_var_mtrr function has vapourised */
+ unsigned long fb;
+ add_var_mtrr( 0xd0000000 >> 10, 0x08000000>>10, MTRR_TYPE_WRCOMB);
+ fb = pci_read_config32(dev,0x10); // get the fb address
+ add_var_mtrr( fb>>10, 8192, MTRR_TYPE_WRCOMB);
+#endif
+}
+
+static struct device_operations vga_operations = {
+ .read_resources = pci_dev_read_resources,
+ .set_resources = pci_dev_set_resources,
+ .enable_resources = pci_dev_enable_resources,
+ .init = vga_init,
+ .ops_pci = 0,
+};
+
+static const struct pci_driver vga_driver __pci_driver = {
+ .ops = &vga_operations,
+ .vendor = PCI_VENDOR_ID_VIA,
+ .device = 0x3122,
+};
More information about the coreboot
mailing list