summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kurtz <djkurtz@chromium.org>2018-05-24 18:24:07 -0600
committerMartin Roth <martinroth@google.com>2018-05-25 16:40:41 +0000
commit7c670695fa560dee9fd7639b0ed2a2cf56889f53 (patch)
treeba8383d9a9296c7356ae9d87df62c1d277533c51
parent12173feef8a92962daf61e56db89d948d27916ef (diff)
downloadcoreboot-7c670695fa560dee9fd7639b0ed2a2cf56889f53.tar.xz
elog: Only log POST code from previous boot on non-S3 resume
It doesn't make sense to log post codes from a previous (failed) boot if we are resuming from S3, since the previous boot has to have been successful in order to enter S3 in the first place. While we are at it, use a helper function to combine conditionals and improve readability. BUG=none TEST=boot, suspend & resume grunt Change-Id: I4f3bb8526a0c8c0ea1efd924628b33c147543b88 Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-on: https://review.coreboot.org/26528 Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/drivers/elog/elog.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index ff4f0364c5..d41457d552 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -737,6 +737,21 @@ static int elog_sync_to_nv(void)
}
/*
+ * Do not log boot count events in S3 resume or SMM.
+ */
+static bool elog_do_add_boot_count(void)
+{
+ if (ENV_SMM)
+ return false;
+
+#if IS_ENABLED(CONFIG_HAVE_ACPI_RESUME)
+ return !acpi_is_wakeup_s3();
+#else
+ return true;
+#endif
+}
+
+/*
* Event log main entry point
*/
int elog_init(void)
@@ -784,20 +799,15 @@ int elog_init(void)
" shrink size %d\n", region_device_sz(&nv_dev),
full_threshold, shrink_size);
-#if !defined(__SMM__)
- /* Log boot count event except in S3 resume */
-#if IS_ENABLED(CONFIG_HAVE_ACPI_RESUME)
- if (!acpi_is_wakeup_s3())
-#endif
+ if (elog_do_add_boot_count()) {
elog_add_event_dword(ELOG_TYPE_BOOT, boot_count_read());
#if IS_ENABLED(CONFIG_ARCH_X86)
- /* Check and log POST codes from previous boot */
- if (IS_ENABLED(CONFIG_CMOS_POST))
- cmos_post_log();
+ /* Check and log POST codes from previous boot */
+ if (IS_ENABLED(CONFIG_CMOS_POST))
+ cmos_post_log();
#endif
-#endif
-
+ }
return 0;
}