This patch unifies the use of config options in v2 to all start with CONFIG_
[coreboot.git] / src / lib / fallback_boot.c
1 #include <console/console.h>
2 #include <part/fallback_boot.h>
3 #include <part/watchdog.h>
4 #include <pc80/mc146818rtc.h>
5 #include <arch/io.h>
6
7
8 #if CONFIG_HAVE_FALLBACK_BOOT == 1
9 void set_boot_successful(void)
10 {
11         /* Remember I succesfully booted by setting
12          * the initial boot direction
13          * to the direction that I booted.
14          */
15         unsigned char index, byte;
16         index = inb(RTC_PORT(0)) & 0x80;
17         index |= RTC_BOOT_BYTE;
18         outb(index, RTC_PORT(0));
19
20         byte = inb(RTC_PORT(1));
21         byte &= 0xfe;
22         byte |= (byte & (1 << 1)) >> 1;
23
24         /* If we are in normal mode set the boot count to 0 */
25         if(byte & 1)
26                 byte &= 0x0f;
27         outb(byte, RTC_PORT(1));
28 }
29 #endif
30
31 void boot_successful(void)
32 {
33         /* Remember this was a successful boot */
34         set_boot_successful();
35
36         /* turn off the boot watchdog */
37         watchdog_off();
38 }