in loglevel.h, if ASM_CONSOLE_LOGLEVEL is defined, don't try to set it.
[coreboot.git] / src / mainboard / digitallogic / adl855pc / auto.c
1 #define ASSEMBLY 1
2 #define ASM_CONSOLE_LOGLEVEL 10
3 #include <stdint.h>
4 #include <device/pci_def.h>
5 #include <arch/io.h>
6 #include <device/pnp_def.h>
7 #include <arch/romcc_io.h>
8 #if 0
9 #include <arch/smp/lapic.h>
10 #endif
11 #include <arch/hlt.h>
12 //#include "option_table.h"
13 #include "pc80/mc146818rtc_early.c"
14 #include "pc80/serial.c"
15 #include "arch/i386/lib/console.c"
16 #include "ram/ramtest.c"
17 #include "southbridge/intel/i82801dbm/i82801dbm_early_smbus.c"
18 #include "northbridge/intel/i855pm/raminit.h"
19
20 #if 0
21 #include "cpu/p6/apic_timer.c"
22 #include "lib/delay.c"
23 #endif
24
25 #include "cpu/x86/lapic/boot_cpu.c"
26 #include "northbridge/intel/i855pm/debug.c"
27 #include "superio/winbond/w83627hf/w83627hf_early_serial.c" 
28 #include "cpu/x86/mtrr/earlymtrr.c"
29 #include "cpu/x86/bist.h"
30
31 #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
32
33
34 static void hard_reset(void)
35 {
36         outb(0x0e, 0x0cf9);
37 }
38
39 static void memreset_setup(void)
40 {
41 }
42
43 static void memreset(int controllers, const struct mem_controller *ctrl)
44 {
45 }
46
47
48
49 static inline void activate_spd_rom(const struct mem_controller *ctrl)
50 {
51         /* nothing to do */
52 }
53  
54 static inline int spd_read_byte(unsigned device, unsigned address)
55 {
56         return smbus_read_byte(device, address);
57 }
58
59 #include "northbridge/intel/i855pm/raminit.c"
60 #include "northbridge/intel/i855pm/reset_test.c"
61 #include "sdram/generic_sdram.c"
62
63 static void main(unsigned long bist)
64 {
65         static const struct mem_controller memctrl[] = {
66                 {
67                         .d0 = PCI_DEV(0, 0, 1),
68                         .channel0 = { (0xa<<3)|0, 0 },
69                 },
70         };
71
72         if (bist == 0) {
73                 early_mtrr_init();
74 #if 0
75                 enable_lapic();
76                 init_timer();
77 #endif
78         }
79         
80         w83627hf_enable_serial(SERIAL_DEV, TTYS0_BASE);
81         uart_init();
82         console_init();
83         print_err("HARD MAIN0\n");
84
85         /* Halt if there was a built in self test failure */
86         report_bist_failure(bist);
87         
88         print_err("HARD MAIN\n");
89 #if 1
90         print_pci_devices();
91 #endif
92         print_err("after print pci dev   \n");
93         if(!bios_reset_detected()) {
94                 enable_smbus();
95         print_err("after enable smbus\n");
96 #if 1
97         dump_spd_registers(&memctrl[0]);
98         //              dump_smbus_registers();
99 #endif
100
101         print_err("after dump spd registers\n");
102                 memreset_setup();
103         print_err("memreset setup\n");
104                 sdram_initialize(sizeof(memctrl)/sizeof(memctrl[0]), memctrl);
105         print_err("sdram init\n");
106         } 
107 #if 0
108         else {
109                         /* clear memory 1meg */
110         __asm__ volatile(
111                 "1: \n\t"
112                 "movl %0, %%fs:(%1)\n\t"
113                 "addl $4,%1\n\t"
114                 "subl $4,%2\n\t"
115                 "jnz 1b\n\t"
116                 :
117                 : "a" (0), "D" (0), "c" (1024*1024)
118                 ); 
119         
120         }
121 #endif
122
123 #if 0
124         dump_pci_devices();
125 #endif
126 #if 0
127         dump_pci_device(PCI_DEV(0, 0, 0));
128 #endif
129
130 /*
131 #if  0
132         ram_check(0x00000000, msr.lo+(msr.hi<<32));
133 #else
134 #if 0
135         // Check 16MB of memory @ 0
136         ram_check(0x00000000, 0x01000000);
137 #else
138         // Check 16MB of memory @ 2GB 
139         ram_check(0x80000000, 0x81000000);
140 #endif
141 #endif
142 */
143 }