Since some people disapprove of white space cleanups mixed in regular commits
[coreboot.git] / src / mainboard / tyan / s2735 / romstage.c
1
2 #include <stdint.h>
3 #include <string.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 #include <cpu/x86/lapic.h>
9 #include "option_table.h"
10 #include "pc80/mc146818rtc_early.c"
11 #include "pc80/serial.c"
12 #include "console/console.c"
13 #include "lib/ramtest.c"
14
15 #include "southbridge/intel/i82801ex/i82801ex_early_smbus.c"
16 #include "northbridge/intel/e7501/raminit.h"
17
18 #include "northbridge/intel/e7501/debug.c"
19 #include "superio/winbond/w83627hf/w83627hf_early_serial.c"
20
21 #include "cpu/x86/mtrr/earlymtrr.c"
22 #include "cpu/x86/bist.h"
23
24 #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
25
26 // FIXME: There's another hard_reset() in reset.c. Why?
27 static void hard_reset(void)
28 {
29         /* full reset */
30         outb(0x0a, 0x0cf9);
31         outb(0x0e, 0x0cf9);
32 }
33
34 static inline int spd_read_byte(unsigned device, unsigned address)
35 {
36         return smbus_read_byte(device, address);
37 }
38
39 #include "northbridge/intel/e7501/raminit.c"
40 #include "northbridge/intel/e7501/reset_test.c"
41 #include "lib/generic_sdram.c"
42
43 void main(unsigned long bist)
44 {
45         static const struct mem_controller memctrl[] = {
46                 {
47                         .d0 = PCI_DEV(0, 0, 0),
48                         .d0f1 = PCI_DEV(0, 0, 1),
49                         .channel0 = { (0xa<<3)|0, (0xa<<3)|1, (0xa<<3)|2, 0 },
50                         .channel1 = { (0xa<<3)|4, (0xa<<3)|5, (0xa<<3)|6, 0 },
51                 },
52         };
53
54         if (bist == 0) {
55                 enable_lapic();
56         }
57
58         w83627hf_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
59         uart_init();
60         console_init();
61
62         /* Halt if there was a built in self test failure */
63         report_bist_failure(bist);
64
65         if(bios_reset_detected()) {
66                 hard_reset();
67         }
68
69         enable_smbus();
70 #if 0
71         dump_spd_registers(&memctrl[0]);
72 #endif
73 #if 0
74         dump_smbus_registers();
75 #endif
76
77         sdram_initialize(1, memctrl);
78
79 #if 0
80         dump_pci_devices();
81 #endif
82
83 #if 1
84         dump_pci_device(PCI_DEV(0, 0, 0));
85 #endif
86 }
87