summaryrefslogtreecommitdiff
path: root/src/drivers/elog/elog.c
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2013-05-23 07:23:09 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2013-11-25 23:38:04 +0100
commit032be82a11a9cee6cc45df7a5ea94778ea4280d7 (patch)
tree551d085694a9bd30746bf08cc666298f9d3be1f4 /src/drivers/elog/elog.c
parentb1c25e74af0a7b1cb4aae0fc9ab8147ee9d14907 (diff)
elog: Check for successful flash erase in elog_shrink
A parrot device with a bad flash part has been seen to hang in the elog_shrink code becuase the flash was not successfully erased and it gets stuck in a loop trying to shrink the log and then add an event. Change-Id: I8bb13dbadd293f9d892f322e213c9255c8e9acb3 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/56405 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/4186 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/drivers/elog/elog.c')
-rw-r--r--src/drivers/elog/elog.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index 6de51235f5..bc72e9710d 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -661,6 +661,12 @@ static int elog_shrink(void)
/* Erase flash area */
elog_flash_erase_area();
+ /* Ensure the area was successfully erased */
+ if (elog_get_flash()->next_event_offset >= CONFIG_ELOG_FULL_THRESHOLD) {
+ printk(BIOS_ERR, "ELOG: Flash area was not erased!\n");
+ return -1;
+ }
+
/* Write new flash area */
elog_prepare_empty(elog_get_flash(),
(u8*)elog_get_event_base(mem, offset),
@@ -839,7 +845,8 @@ int elog_init(void)
/* Shrink the log if we are getting too full */
if (elog_get_mem()->next_event_offset >= CONFIG_ELOG_FULL_THRESHOLD)
- elog_shrink();
+ if (elog_shrink() < 0)
+ return -1;
#if CONFIG_ELOG_BOOT_COUNT && !defined(__SMM__)
/* Log boot count event except in S3 resume */