1bddd0a1692290164b35dc65b3aa7603fdbf0029
[coreboot.git] / src / lib / fallback_boot.c
1 #include <console/console.h>
2 #include <part/fallback_boot.h>
3 #include <pc80/mc146818rtc.h>
4 #include <arch/io.h>
5
6 void boot_successful(void)
7 {
8         /* Remember I succesfully booted by setting
9          * the initial boot direction
10          * to the direction that I booted.
11          */
12         unsigned char index, byte;
13         index = inb(RTC_PORT(0)) & 0x80;
14         index |= RTC_BOOT_BYTE;
15         outb(index, RTC_PORT(0));
16
17         byte = inb(RTC_PORT(1));
18         byte &= 0xfe;
19         byte |= (byte & 2) >> 1;
20
21         /* If we are in normal mode set the boot count to 0 */
22         if(byte & 1)
23                 byte &= 0x0f;
24         outb(byte, RTC_PORT(1));
25 }