Drop excessive whitespace randomly sprinkled in romstage.c files.
[coreboot.git] / src / mainboard / digitallogic / msm800sev / romstage.c
1 #include <stdint.h>
2 #include <stdlib.h>
3 #include <device/pci_def.h>
4 #include <arch/io.h>
5 #include <device/pnp_def.h>
6 #include <arch/romcc_io.h>
7 #include <arch/hlt.h>
8 #include <console/console.h>
9 #include "cpu/x86/bist.h"
10 #include "cpu/x86/msr.h"
11 #include <cpu/amd/lxdef.h>
12 #include <cpu/amd/geode_post_code.h>
13 #include "southbridge/amd/cs5536/cs5536.h"
14 #include <spd.h>
15 #include "southbridge/amd/cs5536/cs5536_early_smbus.c"
16 #include "southbridge/amd/cs5536/cs5536_early_setup.c"
17 #include "superio/winbond/w83627hf/w83627hf_early_serial.c"
18
19 #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
20
21 static inline int spd_read_byte(unsigned device, unsigned address)
22 {
23                 return smbus_read_byte(device, address);
24 }
25
26 #define ManualConf 0            /* Do automatic strapped PLL config */
27 #define PLLMSRhi 0x00001490 /* manual settings for the PLL */
28 #define PLLMSRlo 0x02000030
29
30 #include "northbridge/amd/lx/raminit.h"
31 #include "northbridge/amd/lx/pll_reset.c"
32 #include "northbridge/amd/lx/raminit.c"
33 #include "lib/generic_sdram.c"
34 #include "cpu/amd/model_lx/cpureginit.c"
35 #include "cpu/amd/model_lx/syspreinit.c"
36 #include "cpu/amd/model_lx/msrinit.c"
37
38 static void mb_gpio_init(void)
39 {
40         /* Early mainboard specific GPIO setup */
41 }
42
43 void main(unsigned long bist)
44 {
45         post_code(0x01);
46
47         static const struct mem_controller memctrl [] = {
48                 {.channel0 = {DIMM0, DIMM1}}
49         };
50
51         SystemPreInit();
52         msr_init();
53
54         cs5536_early_setup();
55
56         /* NOTE: must do this AFTER the early_setup!
57          * it is counting on some early MSR setup
58          * for cs5536
59          */
60         cs5536_disable_internal_uart();
61         w83627hf_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
62         mb_gpio_init();
63         uart_init();
64         console_init();
65
66         /* Halt if there was a built in self test failure */
67         report_bist_failure(bist);
68
69         pll_reset(ManualConf);
70
71         cpuRegInit(0, DIMM0, DIMM1, DRAM_TERMINATED);
72
73         sdram_initialize(1, memctrl);
74
75         /* Check all of memory */
76         ram_check(0x00000000, 640*1024);
77
78         /* Switch from Cache as RAM to real RAM */
79         /* There are two ways we could think about this.
80          1. If we are using the romstage.inc ROMCC way, the stack is going to be re-setup in the code following this code.
81                 Just wbinvd the stack to clear the cache tags. We don't care where the stack used to be.
82          2. This file is built as a normal .c -> .o and linked in etc. The stack might be used to return etc.
83                 That means we care about what is in the stack. If we are smart we set the CAR stack to the same location
84                 as the rest of coreboot. If that is the case we can just do a wbinvd. The stack will be written into real
85                 RAM that is now setup and we continue like nothing happened. If the stack is located somewhere other than
86                 where LB would like it, you need to write some code to do a copy from cache to RAM
87
88          We use method 1 on Norwich.
89         */
90         post_code(0x02);
91         print_err("POST 02\n");
92         __asm__("wbinvd\n");
93         print_err("Past wbinvd\n");
94         /* we are finding the return does not work on this board. Explicitly call the label that is
95          * after the call to us. This is gross, but sometimes at this level it is the only way out
96          */
97         void done_cache_as_ram_main(void);
98         done_cache_as_ram_main();
99 }