blob: b956c94a158ca47b3b78d31ae0edc6a25622f171 [file] [log] [blame]
Eric Biederman8ca8d762003-04-22 19:02:15 +00001#include <console/console.h>
Stefan Reinauerde3206a2010-02-22 06:09:43 +00002#include <fallback.h>
3#include <watchdog.h>
Eric Biederman8ca8d762003-04-22 19:02:15 +00004#include <arch/io.h>
5
Stefan Reinauer859e8082012-11-30 12:03:46 -08006#if CONFIG_PC80_SYSTEM
7#include <pc80/mc146818rtc.h>
Yinghai Lu13f1c2a2005-07-08 02:49:49 +00008
Stefan Reinauer859e8082012-11-30 12:03:46 -08009static void set_boot_successful(void)
Eric Biederman8ca8d762003-04-22 19:02:15 +000010{
Martin Rothcbf2bd72013-07-09 21:51:14 -060011 /* Remember I successfully booted by setting
Eric Biederman8ca8d762003-04-22 19:02:15 +000012 * 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;
Eric Biederman2c018fb2003-07-21 20:13:45 +000022 byte |= (byte & (1 << 1)) >> 1;
Eric Biederman8ca8d762003-04-22 19:02:15 +000023
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}
Stefan Reinauer859e8082012-11-30 12:03:46 -080029#else
30static void set_boot_successful(void)
31{
32 /* To be implemented */
33}
34#endif
Yinghai Lu13f1c2a2005-07-08 02:49:49 +000035
36void boot_successful(void)
37{
Stefan Reinauerc1efb902011-10-12 14:30:59 -070038#if CONFIG_FRAMEBUFFER_SET_VESA_MODE && !CONFIG_FRAMEBUFFER_KEEP_VESA_MODE
Stefan Reinauerd650e992010-02-22 04:33:13 +000039 void vbe_textmode_console(void);
40
41 vbe_textmode_console();
42#endif
Yinghai Lu13f1c2a2005-07-08 02:49:49 +000043 /* Remember this was a successful boot */
44 set_boot_successful();
45
46 /* turn off the boot watchdog */
47 watchdog_off();
48}