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>
13 #include "pc80/serial.c"
14 #include "arch/i386/lib/console.c"
15 #include "ram/ramtest.c"
16 #include "northbridge/via/vt8623/raminit.h"
17 #include "cpu/x86/mtrr/earlymtrr.c"
18 #include "cpu/x86/bist.h"
22 void udelay(int usecs)
25 for(i = 0; i < usecs; i++)
29 #include "lib/delay.c"
30 #include "cpu/x86/lapic/boot_cpu.c"
33 #include "southbridge/via/vt8235/vt8235_early_smbus.c"
35 #include "southbridge/via/vt8235/vt8235_early_serial.c"
36 static void memreset_setup(void)
40 static inline int spd_read_byte(unsigned device, unsigned address)
42 return smbus_read_byte(device, address);
45 #include "northbridge/via/vt8623/raminit.c"
47 static void enable_mainboard_devices(void)
51 dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
52 PCI_DEVICE_ID_VIA_8235), 0);
54 if (dev == PCI_DEV_INVALID) {
55 die("Southbridge not found!!!\n");
57 pci_write_config8(dev, 0x50, 0x80);
58 pci_write_config8(dev, 0x51, 0x1f);
60 // This early setup switches IDE into compatibility mode before PCI gets
61 // a chance to assign I/Os
62 // movl $CONFIG_ADDR(0, 0x89, 0x42), %eax
65 // PCI_WRITE_CONFIG_BYTE
67 /* we do this here as in V2, we can not yet do raw operations
70 dev += 0x100; /* ICKY */
72 pci_write_config8(dev, 0x04, 7);
73 pci_write_config8(dev, 0x40, 3);
74 pci_write_config8(dev, 0x42, 0);
75 pci_write_config8(dev, 0x3c, 0xe);
76 pci_write_config8(dev, 0x3d, 0);
79 static void enable_shadow_ram(void)
81 device_t dev = 0; /* no need to look up 0:0.0 */
82 unsigned char shadowreg;
83 /* dev 0 for southbridge */
84 shadowreg = pci_read_config8(dev, 0x63);
87 pci_write_config8(dev, 0x63, shadowreg);
90 static void main(unsigned long bist)
96 * Enable VGA; 32MB buffer.
98 pci_write_config8(0, 0xe1, 0xdd);
101 * Disable the firewire stuff, which apparently steps on IO 0+ on
104 dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
105 PCI_DEVICE_ID_VIA_6305), 0);
106 if (dev != PCI_DEV_INVALID) {
107 pci_write_config8(dev, 0x15, 0x1c);
112 enable_vt8235_serial();
116 print_spew("In auto.c:main()\r\n");
118 /* Halt if there was a built in self test failure */
119 report_bist_failure(bist);
125 print_debug(" Enabling mainboard devices\r\n");
126 enable_mainboard_devices();
128 print_debug(" Enabling shadow ram\r\n");
131 ddr_ram_setup((const struct mem_controller *)0);
133 /* Check all of memory */
135 ram_check(0x00000000, msr.lo);
138 static const struct {
139 unsigned long lo, hi;
141 /* Check 16MB of memory @ 0*/
142 { 0x00000000, 0x01000000 },
144 /* Check 16MB of memory @ 2GB */
145 { 0x80000000, 0x81000000 },
149 for(i = 0; i < sizeof(check_addrs)/sizeof(check_addrs[0]); i++) {
150 ram_check(check_addrs[i].lo, check_addrs[i].hi);
155 print_debug(" Doing MTRR init.\r\n");
159 //dump_pci_devices();
161 print_spew("Leaving auto.c:main()\r\n");