Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 1 | #include <console/console.h> |
Stefan Reinauer | de3206a | 2010-02-22 06:09:43 +0000 | [diff] [blame] | 2 | #include <fallback.h> |
| 3 | #include <watchdog.h> |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 4 | #include <arch/io.h> |
| 5 | |
Stefan Reinauer | 859e808 | 2012-11-30 12:03:46 -0800 | [diff] [blame] | 6 | #if CONFIG_PC80_SYSTEM |
| 7 | #include <pc80/mc146818rtc.h> |
Yinghai Lu | 13f1c2a | 2005-07-08 02:49:49 +0000 | [diff] [blame] | 8 | |
Stefan Reinauer | 859e808 | 2012-11-30 12:03:46 -0800 | [diff] [blame] | 9 | static void set_boot_successful(void) |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 10 | { |
Martin Roth | cbf2bd7 | 2013-07-09 21:51:14 -0600 | [diff] [blame^] | 11 | /* Remember I successfully booted by setting |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 12 | * 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 Biederman | 2c018fb | 2003-07-21 20:13:45 +0000 | [diff] [blame] | 22 | byte |= (byte & (1 << 1)) >> 1; |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 23 | |
| 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 Reinauer | 859e808 | 2012-11-30 12:03:46 -0800 | [diff] [blame] | 29 | #else |
| 30 | static void set_boot_successful(void) |
| 31 | { |
| 32 | /* To be implemented */ |
| 33 | } |
| 34 | #endif |
Yinghai Lu | 13f1c2a | 2005-07-08 02:49:49 +0000 | [diff] [blame] | 35 | |
| 36 | void boot_successful(void) |
| 37 | { |
Stefan Reinauer | c1efb90 | 2011-10-12 14:30:59 -0700 | [diff] [blame] | 38 | #if CONFIG_FRAMEBUFFER_SET_VESA_MODE && !CONFIG_FRAMEBUFFER_KEEP_VESA_MODE |
Stefan Reinauer | d650e99 | 2010-02-22 04:33:13 +0000 | [diff] [blame] | 39 | void vbe_textmode_console(void); |
| 40 | |
| 41 | vbe_textmode_console(); |
| 42 | #endif |
Yinghai Lu | 13f1c2a | 2005-07-08 02:49:49 +0000 | [diff] [blame] | 43 | /* Remember this was a successful boot */ |
| 44 | set_boot_successful(); |
| 45 | |
| 46 | /* turn off the boot watchdog */ |
| 47 | watchdog_off(); |
| 48 | } |