From 455c68ed0dca6cc5c8df4131c2fcf314e3002f56 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 24 Apr 2013 17:54:37 -0700 Subject: elog: Merge elog_validate_and_fill into elog_init_descriptor. elog_validate_and_fill was called in exactly one place, in elog_init_descriptor. It didn't actually do what its name implied since the data in the event log was already "filled" by elog_init_descriptor. Likewise elog_init_descriptor was delegating an important part of its own job, scanning through the list of events, to elog_validate_and_fill. Since one function was basically just a displaced part of the other which couldn't really stand on its own, this change merges them together. Built and booted on Link. Ran mosys eventlog list. Added 2000 events with the SMI handler and ran mosys eventlog list again. Change-Id: Ic899eeb18146d0f127d0dded207d37d63cbc716f Signed-off-by: Gabe Black Reviewed-on: https://gerrit.chromium.org/gerrit/49308 Reviewed-by: Duncan Laurie Commit-Queue: Gabe Black Tested-by: Gabe Black Reviewed-on: http://review.coreboot.org/4243 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/drivers/elog/elog.c | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) (limited to 'src/drivers/elog') diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c index 8f47ca2d5b..ca5b3fb411 100644 --- a/src/drivers/elog/elog.c +++ b/src/drivers/elog/elog.c @@ -354,28 +354,6 @@ static void elog_update_event_buffer_state(struct elog_descriptor *elog) elog->last_event_size = last_event_size; } -static void elog_validate_and_fill(struct elog_descriptor *elog) -{ - elog_debug("elog_validate_and_fill()\n"); - - /* Check if the area is empty or not */ - if (elog_is_area_clear(elog)) { - elog->area_state = ELOG_AREA_EMPTY; - return; - } - - elog->area_state = ELOG_AREA_HAS_CONTENT; - - /* Validate the header */ - if (!elog_is_header_valid(elog_get_header(elog))) { - elog->header_state = ELOG_HEADER_INVALID; - return; - } - - elog->header_state = ELOG_HEADER_VALID; - elog_update_event_buffer_state(elog); -} - /* * (Re)initialize a new ELOG descriptor */ @@ -396,7 +374,22 @@ static void elog_init_descriptor(struct elog_descriptor *elog) elog->last_event_size = 0; elog->event_count = 0; - elog_validate_and_fill(elog); + /* Check if the area is empty or not */ + if (elog_is_area_clear(elog)) { + elog->area_state = ELOG_AREA_EMPTY; + return; + } + + elog->area_state = ELOG_AREA_HAS_CONTENT; + + /* Validate the header */ + if (!elog_is_header_valid(elog_get_header(elog))) { + elog->header_state = ELOG_HEADER_INVALID; + return; + } + + elog->header_state = ELOG_HEADER_VALID; + elog_update_event_buffer_state(elog); } /* -- cgit v1.2.3