2 #include <device/pci_def.h>
3 #include <device/pci_ids.h>
5 #include <cpu/x86/lapic.h>
8 #include <device/pnp_def.h>
9 #include <arch/romcc_io.h>
12 #include "pc80/serial.c"
13 #include "console/console.c"
14 #include "lib/ramtest.c"
15 #include "northbridge/via/vt8623/raminit.h"
16 #include "cpu/x86/mtrr/earlymtrr.c"
17 #include "cpu/x86/bist.h"
18 #include "pc80/udelay_io.c"
19 #include "lib/delay.c"
20 #include "cpu/x86/lapic/boot_cpu.c"
21 #include "lib/debug.c"
22 #include "southbridge/via/vt8235/vt8235_early_smbus.c"
23 #include "southbridge/via/vt8235/vt8235_early_serial.c"
25 static void memreset_setup(void)
29 static inline int spd_read_byte(unsigned device, unsigned address)
31 return smbus_read_byte(device, address);
34 #include "northbridge/via/vt8623/raminit.c"
36 static void enable_mainboard_devices(void)
40 dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
41 PCI_DEVICE_ID_VIA_8235), 0);
43 if (dev == PCI_DEV_INVALID) {
44 die("Southbridge not found!!!\n");
46 pci_write_config8(dev, 0x50, 0x80);
47 pci_write_config8(dev, 0x51, 0x1f);
49 // This early setup switches IDE into compatibility mode before PCI gets
50 // a chance to assign I/Os
51 // movl $CONFIG_ADDR(0, 0x89, 0x42), %eax
54 // PCI_WRITE_CONFIG_BYTE
56 /* we do this here as in V2, we can not yet do raw operations
59 dev += 0x100; /* ICKY */
61 pci_write_config8(dev, 0x04, 7);
62 pci_write_config8(dev, 0x40, 3);
63 pci_write_config8(dev, 0x42, 0);
64 pci_write_config8(dev, 0x3c, 0xe);
65 pci_write_config8(dev, 0x3d, 0);
68 static void enable_shadow_ram(void)
70 device_t dev = 0; /* no need to look up 0:0.0 */
71 unsigned char shadowreg;
72 /* dev 0 for southbridge */
73 shadowreg = pci_read_config8(dev, 0x63);
76 pci_write_config8(dev, 0x63, shadowreg);
79 static void main(unsigned long bist)
85 * Enable VGA; 32MB buffer.
87 pci_write_config8(0, 0xe1, 0xdd);
90 * Disable the firewire stuff, which apparently steps on IO 0+ on
93 dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
94 PCI_DEVICE_ID_VIA_6305), 0);
95 if (dev != PCI_DEV_INVALID) {
96 pci_write_config8(dev, 0x15, 0x1c);
99 enable_vt8235_serial();
105 print_spew("In romstage.c:main()\r\n");
107 /* Halt if there was a built in self test failure */
108 report_bist_failure(bist);
114 print_debug(" Enabling mainboard devices\r\n");
115 enable_mainboard_devices();
117 print_debug(" Enabling shadow ram\r\n");
120 ddr_ram_setup((const struct mem_controller *)0);
122 /* Check all of memory */
124 ram_check(0x00000000, msr.lo);
127 static const struct {
128 unsigned long lo, hi;
130 /* Check 16MB of memory @ 0*/
131 { 0x00000000, 0x01000000 },
133 /* Check 16MB of memory @ 2GB */
134 { 0x80000000, 0x81000000 },
138 for(i = 0; i < ARRAY_SIZE(check_addrs); i++) {
139 ram_check(check_addrs[i].lo, check_addrs[i].hi);
144 print_debug(" Doing MTRR init.\r\n");
148 //dump_pci_devices();
150 print_spew("Leaving romstage.c:main()\r\n");