We need this to be Kconfig. The old way is not trusted by me.
[coreboot.git] / src / mainboard / dell / s1850 / failover.c
1 #define ASSEMBLY 1
2 #include <stdint.h>
3 #include <device/pci_def.h>
4 #include <device/pci_ids.h>
5 #include <arch/io.h>
6 #include <arch/romcc_io.h>
7 #include <cpu/x86/lapic.h>
8 #include "pc80/serial.c"
9 #include "arch/i386/lib/console.c"
10 #include "pc80/mc146818rtc_early.c"
11 #include "cpu/x86/lapic/boot_cpu.c"
12 #include "northbridge/intel/e7520/memory_initialized.c"
13
14 static unsigned long main(unsigned long bist)
15 {
16         /* skip all this nonsense as we are not doing fallback yet */
17         goto fallback_image;
18         /* Did just the cpu reset? */
19         if (memory_initialized()) {
20                 if (last_boot_normal()) {
21                         goto normal_image;
22                 } else {
23                         goto cpu_reset;
24                 }
25         }
26
27         /* This is the primary cpu how should I boot? */
28         else if (do_normal_boot()) {
29                 goto normal_image;
30         }
31         else {
32                 goto fallback_image;
33         }
34  normal_image:
35         asm volatile ("jmp __normal_image" 
36                 : /* outputs */ 
37                 : "a" (bist) /* inputs */
38                 : /* clobbers */
39                 );
40  cpu_reset:
41         asm volatile ("jmp __cpu_reset"
42                 : /* outputs */ 
43                 : "a"(bist) /* inputs */
44                 : /* clobbers */
45                 );
46  fallback_image:
47         return bist;
48 }