From cca1f371d2c1f775fce69e526a20bd424a4aecb8 Mon Sep 17 00:00:00 2001 From: Karthikeyan Ramasubramanian Date: Tue, 6 Nov 2018 13:00:27 -0700 Subject: drivers/elog: Add Ramstage helper to add boot count Add a helper function specific to ramstage to add the boot count information into event log at ramstage. BUG=b:117884485 BRANCH=None TEST=Add an event log from romstage, boot to ChromeOS Change-Id: Ic79f1a702548d8a2cd5c13175a9b2d718527953f Signed-off-by: Karthikeyan Ramasubramanian Reviewed-on: https://review.coreboot.org/29542 Reviewed-by: Furquan Shaikh Reviewed-by: Aaron Durbin Tested-by: build bot (Jenkins) --- src/drivers/elog/elog.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c index 18ca3b7adf..e006ded265 100644 --- a/src/drivers/elog/elog.c +++ b/src/drivers/elog/elog.c @@ -789,6 +789,19 @@ static bool elog_do_add_boot_count(void) #endif } +static void ramstage_elog_add_boot_count(void) +{ + 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(); +#endif + } +} + /* * Event log main entry point */ @@ -838,15 +851,8 @@ int elog_init(void) " shrink size %d\n", region_device_sz(&es->nv_dev), es->full_threshold, es->shrink_size); - 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(); -#endif - } + if (ENV_RAMSTAGE) + ramstage_elog_add_boot_count(); return 0; } -- cgit v1.2.3