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