2003-04-22 21:02:15 +02:00
|
|
|
#include <console/console.h>
|
2010-02-22 07:09:43 +01:00
|
|
|
#include <fallback.h>
|
|
|
|
#include <watchdog.h>
|
2003-04-22 21:02:15 +02:00
|
|
|
#include <arch/io.h>
|
|
|
|
|
2012-11-30 21:03:46 +01:00
|
|
|
#if CONFIG_PC80_SYSTEM
|
|
|
|
#include <pc80/mc146818rtc.h>
|
2005-07-08 04:49:49 +02:00
|
|
|
|
2012-11-30 21:03:46 +01:00
|
|
|
static void set_boot_successful(void)
|
2003-04-22 21:02:15 +02:00
|
|
|
{
|
2015-11-01 09:13:17 +01:00
|
|
|
uint8_t index, byte;
|
|
|
|
|
2003-04-22 21:02:15 +02:00
|
|
|
index = inb(RTC_PORT(0)) & 0x80;
|
|
|
|
index |= RTC_BOOT_BYTE;
|
|
|
|
outb(index, RTC_PORT(0));
|
|
|
|
|
|
|
|
byte = inb(RTC_PORT(1));
|
|
|
|
|
2015-11-01 09:13:17 +01:00
|
|
|
if (IS_ENABLED(CONFIG_SKIP_MAX_REBOOT_CNT_CLEAR)) {
|
|
|
|
/* Set the fallback boot bit to allow for recovery if
|
|
|
|
* the payload fails to boot.
|
|
|
|
* It is the responsibility of the payload to reset
|
|
|
|
* the normal boot bit to 1 if desired
|
|
|
|
*/
|
|
|
|
byte &= ~RTC_BOOT_NORMAL;
|
|
|
|
} else {
|
|
|
|
/* If we are in normal mode set the boot count to 0 */
|
|
|
|
if (byte & RTC_BOOT_NORMAL)
|
2015-03-16 17:47:45 +01:00
|
|
|
byte &= 0x0f;
|
2015-11-01 09:13:17 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-04-22 21:02:15 +02:00
|
|
|
outb(byte, RTC_PORT(1));
|
|
|
|
}
|
2012-11-30 21:03:46 +01:00
|
|
|
#else
|
|
|
|
static void set_boot_successful(void)
|
|
|
|
{
|
|
|
|
/* To be implemented */
|
|
|
|
}
|
|
|
|
#endif
|
2005-07-08 04:49:49 +02:00
|
|
|
|
|
|
|
void boot_successful(void)
|
|
|
|
{
|
2011-10-12 23:30:59 +02:00
|
|
|
#if CONFIG_FRAMEBUFFER_SET_VESA_MODE && !CONFIG_FRAMEBUFFER_KEEP_VESA_MODE
|
2010-02-22 05:33:13 +01:00
|
|
|
void vbe_textmode_console(void);
|
|
|
|
|
|
|
|
vbe_textmode_console();
|
|
|
|
#endif
|
2005-07-08 04:49:49 +02:00
|
|
|
/* Remember this was a successful boot */
|
|
|
|
set_boot_successful();
|
|
|
|
|
|
|
|
/* turn off the boot watchdog */
|
|
|
|
watchdog_off();
|
|
|
|
}
|