Only BSP CPU writes CMOS in bootblock code
[coreboot.git] / src / arch / x86 / init / bootblock_normal.c
1 #include <bootblock_common.h>
2 #include <pc80/mc146818rtc.h>
3
4 static void main(unsigned long bist)
5 {
6         unsigned long entry;
7         int boot_mode;
8
9         if (boot_cpu()) {
10                 bootblock_northbridge_init();
11                 bootblock_southbridge_init();
12                 bootblock_cpu_init();
13
14 #if CONFIG_USE_OPTION_TABLE
15                 sanitize_cmos();
16 #endif
17                 boot_mode = do_normal_boot();
18         } else {
19
20                 /* Questionable single byte read from CMOS.
21                  * Do not add any other CMOS access in the
22                  * bootblock for AP CPUs.
23                  */
24                 boot_mode = last_boot_normal();
25         }
26
27         if (boot_mode)
28                 entry = findstage("normal/romstage");
29         else
30                 entry = findstage("fallback/romstage");
31
32         if (entry) call(entry, bist);
33
34         /* run fallback if normal can't be found */
35         entry = findstage("fallback/romstage");
36         if (entry) call(entry, bist);
37
38         /* duh. we're stuck */
39         asm volatile ("1:\n\thlt\n\tjmp 1b\n\t");
40 }
41