9689f67400798a86a3e6f995608fd078d40b172c
[coreboot.git] / src / mainboard / iei / juki-511p / failover.c
1 /*
2  * This file is part of the LinuxBIOS project.
3  *
4  * Copyright (C) 2007 Nikolay Petukhov <nikolay.petukhov@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
19  */
20
21 #define ASSEMBLY 1
22
23 #include <stdint.h>
24 #include <device/pci_def.h>
25 #include <device/pci_ids.h>
26 #include <arch/io.h>
27 #include "arch/romcc_io.h"
28 #include "pc80/mc146818rtc_early.c"
29
30 static unsigned long main(unsigned long bist)
31 {
32         /* This is the primary cpu how should I boot? */
33         if (do_normal_boot()) {
34                 goto normal_image;
35         }
36         else {
37                 goto fallback_image;
38         }
39 normal_image:
40         asm volatile ("jmp __normal_image"
41                 : /* outputs */
42                 : "a" (bist) /* inputs */
43                 : /* clobbers */
44                 );
45 cpu_reset:
46         asm volatile ("jmp __cpu_reset"
47                 : /* outputs */
48                 : "a"(bist) /* inputs */
49                 : /* clobbers */
50                 );
51 fallback_image:
52         return bist;
53 }