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 <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/29542
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Karthikeyan Ramasubramanian 2018-11-06 13:00:27 -07:00 committed by Aaron Durbin
parent 07bc08c299
commit cca1f371d2
1 changed files with 15 additions and 9 deletions

View File

@ -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;
}