Tyan update to work with new CPU Config
[coreboot.git] / src / mainboard / tyan / s2880 / 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/mc146818rtc_early.c"
9 #include "southbridge/amd/amd8111/amd8111_enable_rom.c"
10 #include "northbridge/amd/amdk8/early_ht.c"
11 #include "cpu/x86/lapic/boot_cpu.c"
12 #include "northbridge/amd/amdk8/reset_test.c"
13
14 static unsigned long main(unsigned long bist)
15 {
16         /* Make cerain my local apic is useable */
17         enable_lapic();
18
19         /* Is this a cpu only reset? */
20         if (cpu_init_detected()) {
21                 if (last_boot_normal()) {
22                         goto normal_image;
23                 } else {
24                         goto cpu_reset;
25                 }
26         }
27         /* Is this a secondary cpu? */
28         if (!boot_cpu()) {
29                 if (last_boot_normal()) {
30                         goto normal_image;
31                 } else {
32                         goto fallback_image;
33                 }
34         }
35         
36
37         /* Nothing special needs to be done to find bus 0 */
38         /* Allow the HT devices to be found */
39         enumerate_ht_chain();
40         
41         /* Setup the 8111 */
42         amd8111_enable_rom();
43
44         /* Is this a deliberate reset by the bios */
45         if (bios_reset_detected() && last_boot_normal()) {
46                 goto normal_image;
47         }
48         /* This is the primary cpu how should I boot? */
49         else if (do_normal_boot()) {
50                 goto normal_image;
51         }
52         else {
53                 goto fallback_image;
54         }
55  normal_image:
56         asm volatile ("jmp __normal_image" 
57                 : /* outputs */ 
58                 : "a" (bist) /* inputs */
59                 : /* clobbers */
60                 );
61  cpu_reset:
62 #if 0
63         asm volatile ("jmp __cpu_reset"
64                 : /* outputs */ 
65                 : "a"(bist) /* inputs */
66                 : /* clobbers */
67                 );
68 #endif
69  fallback_image:
70         return bist;
71 }