diff options
author | Aaron Durbin <adurbin@chromium.org> | 2016-08-05 21:45:54 -0500 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2016-08-09 19:52:29 +0200 |
commit | 18fedb360f7ac3347782d97150657239632d3f3a (patch) | |
tree | 57c214a3a6e5e37e6df231a9be14dff3c10a9f58 /src/drivers | |
parent | 367f2b9568e03ad8ccb637a8f53623bf5eab4b7c (diff) |
drivers/elog: clean up SMBIOS related code
Don't conditionally compile parts of the code. The unused pieces
get culled by the linker, and the #if's just clutter things up.
BUG=chrome-os-partner:55932
Change-Id: Ic18b2deb0cfef7167c05f0a641eae2f4cdc848ee
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/16102
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/elog/elog.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c index ea7597fee8..9024cda89e 100644 --- a/src/drivers/elog/elog.c +++ b/src/drivers/elog/elog.c @@ -548,9 +548,6 @@ static void elog_shrink(void) elog_shrink_by_size(shrink_size); } -#ifndef __SMM__ -#if IS_ENABLED(CONFIG_ARCH_X86) - /* * Convert a flash offset into a memory mapped flash address */ @@ -574,14 +571,22 @@ int elog_smbios_write_type15(unsigned long *current, int handle) { struct smbios_type15 *t = (struct smbios_type15 *)*current; int len = sizeof(struct smbios_type15); + uintptr_t log_address; + + if (IS_ENABLED(CONFIG_ELOG_CBMEM)) { + /* Save event log buffer into CBMEM for the OS to read */ + void *cbmem = cbmem_add(CBMEM_ID_ELOG, total_size); + if (cbmem) + rdev_readat(mirror_dev_get(), cbmem, 0, total_size); + log_address = (uintptr_t)cbmem; + } else { + log_address = (uintptr_t)elog_flash_offset_to_address(); + } -#if CONFIG_ELOG_CBMEM - /* Save event log buffer into CBMEM for the OS to read */ - void *cbmem = cbmem_add(CBMEM_ID_ELOG, total_size); - if (!cbmem) + if (!log_address) { + printk(BIOS_WARNING, "SMBIOS type 15 log address invalid.\n"); return 0; - rdev_readat(mirror_dev_get(), cbmem, 0, total_size); -#endif + } memset(t, 0, len); t->type = SMBIOS_EVENT_LOG; @@ -593,11 +598,7 @@ int elog_smbios_write_type15(unsigned long *current, int handle) t->access_method = SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32; t->log_status = SMBIOS_EVENTLOG_STATUS_VALID; t->change_token = 0; -#if CONFIG_ELOG_CBMEM - t->address = (u32)cbmem; -#else - t->address = (u32)elog_flash_offset_to_address(); -#endif + t->address = log_address; t->header_format = ELOG_HEADER_TYPE_OEM; t->log_type_descriptors = 0; t->log_type_descriptor_length = 2; @@ -605,8 +606,6 @@ int elog_smbios_write_type15(unsigned long *current, int handle) *current += len; return len; } -#endif -#endif /* * Clear the entire event log |