diff options
author | Gabe Black <gabeblack@google.com> | 2013-04-23 19:36:01 -0700 |
---|---|---|
committer | Alexandru Gagniuc <mr.nuke.me@gmail.com> | 2013-12-02 15:16:15 +0100 |
commit | e62e0369d503ac4088b13ef09b15dbe50479855e (patch) | |
tree | a49c3df1cf8b37072c9c4e0d065b3109ec22dd81 /src/drivers/elog | |
parent | 60f820835f66ad4eb63f2fdecb7ebce3411077a8 (diff) |
elog: Get rid of the staging_header variable.
The header is at the start of the log. There's no reason to either keep a
seperate pointer to it, or to keep a copy of it in some other bit of memory.
Built and booted on Link and used 'mosys eventlog list' to list the
contents of the log. Ran
for x in $(seq 1 2000); do
cat elog.event.kernel_clean > /sys/firmware/gsmi/append_to_eventlog;
done
And ran mosys eventlog list again to verify that the log had been shrunk
correctly.
Change-Id: I2afcd52c0ce5bbb662ac56f2895cdbea28d5c2ce
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/49304
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-on: http://review.coreboot.org/4239
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/drivers/elog')
-rw-r--r-- | src/drivers/elog/elog.c | 27 | ||||
-rw-r--r-- | src/drivers/elog/elog_internal.h | 1 |
2 files changed, 7 insertions, 21 deletions
diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c index bc72e9710d..fd638a5ae8 100644 --- a/src/drivers/elog/elog.c +++ b/src/drivers/elog/elog.c @@ -376,7 +376,7 @@ static void elog_validate_and_fill(struct elog_descriptor *elog) elog->area_state = ELOG_AREA_HAS_CONTENT; /* Validate the header */ - if (!elog_is_header_valid(elog->staging_header)) { + if (!elog_is_header_valid(elog_get_header(elog))) { elog->header_state = ELOG_HEADER_INVALID; return; } @@ -390,8 +390,7 @@ static void elog_validate_and_fill(struct elog_descriptor *elog) */ static void elog_init_descriptor(struct elog_descriptor *elog, elog_descriptor_type type, - u8 *buffer, u32 size, - struct elog_header *header) + u8 *buffer, u32 size) { elog_debug("elog_init_descriptor(type=%u buffer=0x%p size=%u)\n", type, buffer, size); @@ -407,10 +406,6 @@ static void elog_init_descriptor(struct elog_descriptor *elog, if (type == ELOG_DESCRIPTOR_FLASH) elog_spi->read(elog_spi, elog->flash_base, size, buffer); - /* Get staging header from backing store */ - elog->staging_header = header; - memcpy(header, buffer, sizeof(struct elog_header)); - /* Data starts immediately after header */ elog->data = &buffer[sizeof(struct elog_header)]; elog->data_size = size - sizeof(struct elog_header); @@ -430,7 +425,7 @@ static void elog_reinit_descriptor(struct elog_descriptor *elog) { elog_debug("elog_reinit_descriptor()\n"); elog_init_descriptor(elog, elog->type, elog->backing_store, - elog->total_size, elog->staging_header); + elog->total_size); } /* @@ -438,7 +433,6 @@ static void elog_reinit_descriptor(struct elog_descriptor *elog) */ static int elog_setup_descriptors(u32 flash_base, u32 area_size) { - struct elog_header *staging_header; u8 *area; elog_debug("elog_setup_descriptors(base=0x%08x size=%u)\n", @@ -450,20 +444,14 @@ static int elog_setup_descriptors(u32 flash_base, u32 area_size) return -1; } - staging_header = malloc(sizeof(struct elog_header)); - if (!staging_header) { - printk(BIOS_ERR, "ELOG: Unable to allocate header\n"); - return -1; - } - area = malloc(area_size); if (!area) { - printk(BIOS_ERR, "ELOG: Unable to determine flash address\n"); + printk(BIOS_ERR, "ELOG: Unable to allocate backing store\n"); return -1; } elog_get_flash()->flash_base = flash_base; elog_init_descriptor(elog_get_flash(), ELOG_DESCRIPTOR_FLASH, - area, area_size, staging_header); + area, area_size); /* Initialize the memory area to look like a cleared flash area */ area = malloc(area_size); @@ -472,8 +460,7 @@ static int elog_setup_descriptors(u32 flash_base, u32 area_size) return -1; } memset(area, ELOG_TYPE_EOL, area_size); - elog_init_descriptor(elog_get_mem(), ELOG_DESCRIPTOR_MEMORY, - area, area_size, (struct elog_header *)area); + elog_init_descriptor(elog_get_mem(), ELOG_DESCRIPTOR_MEMORY,area, area_size); return 0; } @@ -500,7 +487,7 @@ static void elog_prepare_empty(struct elog_descriptor *elog, return; /* Write out the header */ - header = elog->staging_header; + header = elog_get_header(elog); header->magic = ELOG_SIGNATURE; header->version = ELOG_VERSION; header->header_size = sizeof(struct elog_header); diff --git a/src/drivers/elog/elog_internal.h b/src/drivers/elog/elog_internal.h index f6aa051007..67026af383 100644 --- a/src/drivers/elog/elog_internal.h +++ b/src/drivers/elog/elog_internal.h @@ -77,7 +77,6 @@ struct elog_descriptor { elog_area_state area_state; elog_header_state header_state; elog_event_buffer_state event_buffer_state; - struct elog_header *staging_header; void *backing_store; u8 *data; u32 flash_base; |