From 8920ee0dcccea100428495220aa53e248f5a210d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sat, 4 Jan 2020 15:30:55 +0200 Subject: drivers/elog,pc80: Move cmos_post_log() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do this to remove elog header dependency from pc80/ and remove some preprocessor guards. Change-Id: I98044a28c29a2b1756fb25fb593f505e914a71c0 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/38189 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/drivers/elog/elog.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/drivers/elog') diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c index c353d59e9f..ca604dde3a 100644 --- a/src/drivers/elog/elog.c +++ b/src/drivers/elog/elog.c @@ -748,16 +748,35 @@ static bool elog_do_add_boot_count(void) #endif } +/* Check and log POST codes from previous boot */ +static void log_last_boot_post(void) +{ +#if CONFIG(ARCH_X86) + u8 code; + u32 extra; + + if (!CONFIG(CMOS_POST)) + return; + + if (cmos_post_previous_boot(&code, &extra) == 0) + return; + + printk(BIOS_WARNING, "POST: Unexpected post code/extra " + "in previous boot: 0x%02x/0x%04x\n", code, extra); + + elog_add_event_word(ELOG_TYPE_LAST_POST_CODE, code); + /* Always zero with !CMOS_POST_EXTRA. */ + if (extra) + elog_add_event_dword(ELOG_TYPE_POST_EXTRA, extra); +#endif +} + static void elog_add_boot_count(void) { if (elog_do_add_boot_count()) { elog_add_event_dword(ELOG_TYPE_BOOT, boot_count_read()); -#if CONFIG(ARCH_X86) - /* Check and log POST codes from previous boot */ - if (CONFIG(CMOS_POST)) - cmos_post_log(); -#endif + log_last_boot_post(); } } -- cgit v1.2.3