[coreboot-gerrit] Change in coreboot[master]: elog: Only log POST code from previous boot on non-S3 resume

Daniel Kurtz (Code Review) gerrit at coreboot.org
Fri May 25 02:24:56 CEST 2018


Hello Daniel Kurtz,

I'd like you to do a code review. Please visit

    https://review.coreboot.org/26528

to review the following change.


Change subject: elog: Only log POST code from previous boot on non-S3 resume
......................................................................

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 at chromium.org>
---
M src/drivers/elog/elog.c
1 file changed, 20 insertions(+), 10 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/26528/1

diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index ff4f036..d41457d 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -737,6 +737,21 @@
 }
 
 /*
+ * 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 @@
 	       " 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;
 }
 

-- 
To view, visit https://review.coreboot.org/26528
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f3bb8526a0c8c0ea1efd924628b33c147543b88
Gerrit-Change-Number: 26528
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Kurtz <djkurtz at google.com>
Gerrit-Reviewer: Daniel Kurtz <djkurtz at chromium.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180525/a972519e/attachment-0001.html>


More information about the coreboot-gerrit mailing list