cpu/samsung/exynos5250: Move update-bl1.sh to 3rdparty/blobs/
[coreboot.git] / src / lib / fallback_boot.c
blob203071fc8a66a55b12d161314266dd8752455955
1 #include <console/console.h>
2 #include <fallback.h>
3 #include <watchdog.h>
4 #include <arch/io.h>
6 #if CONFIG_PC80_SYSTEM
7 #include <pc80/mc146818rtc.h>
9 static void set_boot_successful(void)
11 uint8_t index, byte;
13 index = inb(RTC_PORT(0)) & 0x80;
14 index |= RTC_BOOT_BYTE;
15 outb(index, RTC_PORT(0));
17 byte = inb(RTC_PORT(1));
19 if (IS_ENABLED(CONFIG_SKIP_MAX_REBOOT_CNT_CLEAR)) {
20 /* Set the fallback boot bit to allow for recovery if
21 * the payload fails to boot.
22 * It is the responsibility of the payload to reset
23 * the normal boot bit to 1 if desired
25 byte &= ~RTC_BOOT_NORMAL;
26 } else {
27 /* If we are in normal mode set the boot count to 0 */
28 if (byte & RTC_BOOT_NORMAL)
29 byte &= 0x0f;
33 outb(byte, RTC_PORT(1));
35 #else
36 static void set_boot_successful(void)
38 /* To be implemented */
40 #endif
42 void boot_successful(void)
44 #if CONFIG_FRAMEBUFFER_SET_VESA_MODE && !CONFIG_FRAMEBUFFER_KEEP_VESA_MODE
45 void vbe_textmode_console(void);
47 vbe_textmode_console();
48 #endif
49 /* Remember this was a successful boot */
50 set_boot_successful();
52 /* turn off the boot watchdog */
53 watchdog_off();