via epia; also yh lu tyan.
[coreboot.git] / src / mainboard / via / epia / auto.c
1 #define ASSEMBLY 1
2
3
4 #include <stdint.h>
5 #include <device/pci_def.h>
6 #include <cpu/p6/apic.h>
7 #include <arch/io.h>
8 #include <device/pnp.h>
9 #include <arch/romcc_io.h>
10 #include "pc80/serial.c"
11 #include "arch/i386/lib/console.c"
12 #include "ram/ramtest.c"
13 #include "northbridge/via/vt8601/raminit.h"
14 void udelay(int usecs) {
15   int i;
16   for(i = 0; i < usecs; i++)
17     outb(0x80, 0x80);
18 }
19
20 #include "lib/delay.c"
21 #include "cpu/p6/boot_cpu.c"
22 #include "debug.c"
23
24 #include "southbridge/via/vt8231/vt8231_early_smbus.c"
25 #define SIO_BASE 0x2e
26 #define MAXIMUM_CONSOLE_LOGLEVEL 9
27 #define DEFAULT_CONSOLE_LOGLEVEL 9
28
29 static void memreset_setup(void)
30 {
31 }
32
33 /*
34 static void memreset(int controllers, const struct mem_controller *ctrl)
35 {
36 }
37 */
38 static inline int spd_read_byte(unsigned device, unsigned address)
39 {
40         return smbus_read_byte(device, address);
41 }
42
43
44
45 #include "northbridge/via/vt8601/raminit.c"
46 #include "sdram/generic_sdram.c"
47
48 static void main(void)
49 {
50   struct mem_controller cpu[1];
51   //    init_timer();
52
53         uart_init();
54         console_init();
55         
56         enable_smbus();
57         memreset_setup();
58         sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
59
60
61         /* Check all of memory */
62 #if 0
63         msr_t msr;
64         msr = rdmsr(TOP_MEM);
65         print_debug("TOP_MEM: ");
66         print_debug_hex32(msr.hi);
67         print_debug_hex32(msr.lo);
68         print_debug("\r\n");
69 #endif
70 #if 0
71         ram_check(0x00000000, msr.lo);
72 #endif
73 #if 0
74         static const struct {
75                 unsigned long lo, hi;
76         } check_addrs[] = {
77                 /* Check 16MB of memory @ 0*/
78                 { 0x00000000, 0x01000000 },
79 #if TOTAL_CPUS > 1
80                 /* Check 16MB of memory @ 2GB */
81                 { 0x80000000, 0x81000000 },
82 #endif
83         };
84         int i;
85         for(i = 0; i < sizeof(check_addrs)/sizeof(check_addrs[0]); i++) {
86                 ram_check(check_addrs[i].lo, check_addrs[i].hi);
87         }
88 #endif
89 }