4 #include <device/pci_def.h>
5 #include <device/pci_ids.h>
7 #include <cpu/x86/lapic.h>
10 #include <device/pnp_def.h>
11 #include <arch/romcc_io.h>
14 #include "pc80/serial.c"
15 #include "arch/i386/lib/console.c"
16 #include "lib/ramtest.c"
17 #include "northbridge/via/vt8623/raminit.h"
18 #include "cpu/x86/mtrr/earlymtrr.c"
19 #include "cpu/x86/bist.h"
23 void udelay(int usecs)
26 for(i = 0; i < usecs; i++)
30 #include "lib/delay.c"
31 #include "cpu/x86/lapic/boot_cpu.c"
32 #include "lib/debug.c"
34 #include "southbridge/via/vt8235/vt8235_early_smbus.c"
36 #include "southbridge/via/vt8235/vt8235_early_serial.c"
37 static void memreset_setup(void)
41 static inline int spd_read_byte(unsigned device, unsigned address)
43 return smbus_read_byte(device, address);
46 #include "northbridge/via/vt8623/raminit.c"
48 static void enable_mainboard_devices(void)
52 dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
53 PCI_DEVICE_ID_VIA_8235), 0);
55 if (dev == PCI_DEV_INVALID) {
56 die("Southbridge not found!!!\n");
58 pci_write_config8(dev, 0x50, 0x80);
59 pci_write_config8(dev, 0x51, 0x1f);
61 // This early setup switches IDE into compatibility mode before PCI gets
62 // a chance to assign I/Os
63 // movl $CONFIG_ADDR(0, 0x89, 0x42), %eax
66 // PCI_WRITE_CONFIG_BYTE
68 /* we do this here as in V2, we can not yet do raw operations
71 dev += 0x100; /* ICKY */
73 pci_write_config8(dev, 0x04, 7);
74 pci_write_config8(dev, 0x40, 3);
75 pci_write_config8(dev, 0x42, 0);
76 pci_write_config8(dev, 0x3c, 0xe);
77 pci_write_config8(dev, 0x3d, 0);
80 static void enable_shadow_ram(void)
82 device_t dev = 0; /* no need to look up 0:0.0 */
83 unsigned char shadowreg;
84 /* dev 0 for southbridge */
85 shadowreg = pci_read_config8(dev, 0x63);
88 pci_write_config8(dev, 0x63, shadowreg);
91 static void main(unsigned long bist)
97 * Enable VGA; 32MB buffer.
99 pci_write_config8(0, 0xe1, 0xdd);
102 * Disable the firewire stuff, which apparently steps on IO 0+ on
105 dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
106 PCI_DEVICE_ID_VIA_6305), 0);
107 if (dev != PCI_DEV_INVALID) {
108 pci_write_config8(dev, 0x15, 0x1c);
111 enable_vt8235_serial();
117 print_spew("In auto.c:main()\r\n");
119 /* Halt if there was a built in self test failure */
120 report_bist_failure(bist);
126 print_debug(" Enabling mainboard devices\r\n");
127 enable_mainboard_devices();
129 print_debug(" Enabling shadow ram\r\n");
132 ddr_ram_setup((const struct mem_controller *)0);
134 /* Check all of memory */
136 ram_check(0x00000000, msr.lo);
139 static const struct {
140 unsigned long lo, hi;
142 /* Check 16MB of memory @ 0*/
143 { 0x00000000, 0x01000000 },
145 /* Check 16MB of memory @ 2GB */
146 { 0x80000000, 0x81000000 },
150 for(i = 0; i < ARRAY_SIZE(check_addrs); i++) {
151 ram_check(check_addrs[i].lo, check_addrs[i].hi);
156 print_debug(" Doing MTRR init.\r\n");
160 //dump_pci_devices();
162 print_spew("Leaving auto.c:main()\r\n");