diff options
Diffstat (limited to 'src/arch/x86')
-rw-r--r-- | src/arch/x86/include/bootblock_common.h | 24 | ||||
-rw-r--r-- | src/arch/x86/init/bootblock_simple.c | 3 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/arch/x86/include/bootblock_common.h b/src/arch/x86/include/bootblock_common.h index bd1968202f..c9674f4a9c 100644 --- a/src/arch/x86/include/bootblock_common.h +++ b/src/arch/x86/include/bootblock_common.h @@ -34,3 +34,27 @@ static void sanitize_cmos(void) } } #endif + +#if CONFIG_CMOS_POST +#include <pc80/mc146818rtc.h> + +static void cmos_post_init(void) +{ + u8 magic = CMOS_POST_BANK_0_MAGIC; + + /* Switch to the other bank */ + switch (cmos_read(CMOS_POST_BANK_OFFSET)) { + case CMOS_POST_BANK_1_MAGIC: + break; + case CMOS_POST_BANK_0_MAGIC: + magic = CMOS_POST_BANK_1_MAGIC; + break; + default: + /* Initialize to zero */ + cmos_write(0, CMOS_POST_BANK_0_OFFSET); + cmos_write(0, CMOS_POST_BANK_1_OFFSET); + } + + cmos_write(magic, CMOS_POST_BANK_OFFSET); +} +#endif diff --git a/src/arch/x86/init/bootblock_simple.c b/src/arch/x86/init/bootblock_simple.c index 41f73b43b6..fd9ba2289b 100644 --- a/src/arch/x86/init/bootblock_simple.c +++ b/src/arch/x86/init/bootblock_simple.c @@ -10,6 +10,9 @@ static void main(unsigned long bist) #if CONFIG_USE_OPTION_TABLE sanitize_cmos(); #endif +#if CONFIG_CMOS_POST + cmos_post_init(); +#endif } const char* target1 = "fallback/romstage"; |