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)
84 * Enable VGA; 32MB buffer.
86 pci_write_config8(0, 0xe1, 0xdd);
89 * Disable the firewire stuff, which apparently steps on IO 0+ on
92 dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
93 PCI_DEVICE_ID_VIA_6305), 0);
94 if (dev != PCI_DEV_INVALID) {
95 pci_write_config8(dev, 0x15, 0x1c);
98 enable_vt8235_serial();
104 print_spew("In romstage.c:main()\n");
106 /* Halt if there was a built in self test failure */
107 report_bist_failure(bist);
113 print_debug(" Enabling mainboard devices\n");
114 enable_mainboard_devices();
116 print_debug(" Enabling shadow ram\n");
119 ddr_ram_setup((const struct mem_controller *)0);
121 /* Check all of memory */
123 ram_check(0x00000000, msr.lo);
126 static const struct {
127 unsigned long lo, hi;
129 /* Check 16MB of memory @ 0*/
130 { 0x00000000, 0x01000000 },
132 /* Check 16MB of memory @ 2GB */
133 { 0x80000000, 0x81000000 },
137 for(i = 0; i < ARRAY_SIZE(check_addrs); i++) {
138 ram_check(check_addrs[i].lo, check_addrs[i].hi);
143 print_debug(" Doing MTRR init.\n");
147 //dump_pci_devices();
149 print_spew("Leaving romstage.c:main()\n");