summaryrefslogtreecommitdiff
path: root/src/drivers/elog
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2020-01-04 15:30:55 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-04-20 06:11:09 +0000
commit8920ee0dcccea100428495220aa53e248f5a210d (patch)
treea0105b669ea05c471925185d33c7c8b9e9e8d5d3 /src/drivers/elog
parentda4272454981be0eb225bc5786935891181cf0f8 (diff)
drivers/elog,pc80: Move cmos_post_log()
Do this to remove elog header dependency from pc80/ and remove some preprocessor guards. Change-Id: I98044a28c29a2b1756fb25fb593f505e914a71c0 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38189 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/drivers/elog')
-rw-r--r--src/drivers/elog/elog.c29
1 files changed, 24 insertions, 5 deletions
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();
}
}