From 7f50afb0c79fc041a8533586172cae53284d3c9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= <kyosti.malkki@gmail.com>
Date: Wed, 11 Sep 2019 17:12:26 +0300
Subject: drivers/elog: Add elog_boot_notify()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Change-Id: I898188d31fcfd153eb95d0a7324fa9fd85316e3c
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35373
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
---
 src/soc/amd/picasso/romstage.c              | 4 +---
 src/soc/amd/stoneyridge/romstage.c          | 3 +--
 src/soc/intel/baytrail/romstage/romstage.c  | 5 +----
 src/soc/intel/broadwell/romstage/romstage.c | 6 ++----
 4 files changed, 5 insertions(+), 13 deletions(-)

(limited to 'src/soc')

diff --git a/src/soc/amd/picasso/romstage.c b/src/soc/amd/picasso/romstage.c
index 9882d9115e..257ae6789d 100644
--- a/src/soc/amd/picasso/romstage.c
+++ b/src/soc/amd/picasso/romstage.c
@@ -49,12 +49,10 @@ asmlinkage void car_stage_entry(void)
 	console_init();
 
 	mainboard_romstage_entry_s3(s3_resume);
+	elog_boot_notify(s3_resume);
 
 	if (!s3_resume) {
 		post_code(0x40);
-
-		if (CONFIG(ELOG_BOOT_COUNT))
-			boot_count_increment();
 	} else {
 		printk(BIOS_INFO, "S3 detected\n");
 		post_code(0x60);
diff --git a/src/soc/amd/stoneyridge/romstage.c b/src/soc/amd/stoneyridge/romstage.c
index 4032d3f8b8..2228c1a23e 100644
--- a/src/soc/amd/stoneyridge/romstage.c
+++ b/src/soc/amd/stoneyridge/romstage.c
@@ -97,6 +97,7 @@ asmlinkage void car_stage_entry(void)
 		load_smu_fw1();
 
 	mainboard_romstage_entry_s3(s3_resume);
+	elog_boot_notify(s3_resume);
 
 	bsp_agesa_call();
 
@@ -132,8 +133,6 @@ asmlinkage void car_stage_entry(void)
 		msr_t sys_cfg = rdmsr(SYSCFG_MSR);
 		sys_cfg.lo &= ~SYSCFG_MSR_TOM2WB;
 		wrmsr(SYSCFG_MSR, sys_cfg);
-		if (CONFIG(ELOG_BOOT_COUNT))
-			boot_count_increment();
 	} else {
 		printk(BIOS_INFO, "S3 detected\n");
 		post_code(0x60);
diff --git a/src/soc/intel/baytrail/romstage/romstage.c b/src/soc/intel/baytrail/romstage/romstage.c
index 7348d2b08f..7c129e258e 100644
--- a/src/soc/intel/baytrail/romstage/romstage.c
+++ b/src/soc/intel/baytrail/romstage/romstage.c
@@ -185,10 +185,7 @@ void mainboard_romstage_entry(void)
 
 	printk(BIOS_DEBUG, "prev_sleep_state = S%d\n", prev_sleep_state);
 
-#if CONFIG(ELOG_BOOT_COUNT)
-	if (prev_sleep_state != ACPI_S3)
-		boot_count_increment();
-#endif
+	elog_boot_notify(prev_sleep_state == ACPI_S3);
 
 	/* Initialize RAM */
 	raminit(&mp, prev_sleep_state);
diff --git a/src/soc/intel/broadwell/romstage/romstage.c b/src/soc/intel/broadwell/romstage/romstage.c
index ebb72cb62d..96218f4ba4 100644
--- a/src/soc/intel/broadwell/romstage/romstage.c
+++ b/src/soc/intel/broadwell/romstage/romstage.c
@@ -62,6 +62,8 @@ void mainboard_romstage_entry(void)
 	/* Get power state */
 	rp.power_state = fill_power_state();
 
+	elog_boot_notify(rp.power_state->prev_sleep_state == ACPI_S3);
+
 	/* Print useful platform information */
 	report_platform_info();
 
@@ -80,10 +82,6 @@ void mainboard_romstage_entry(void)
 
 	rp.pei_data.boot_mode = rp.power_state->prev_sleep_state;
 
-	if (CONFIG(ELOG_BOOT_COUNT)
-			&& rp.power_state->prev_sleep_state != ACPI_S3)
-		boot_count_increment();
-
 	/* Print ME state before MRC */
 	intel_me_status();
 
-- 
cgit v1.2.3