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>
This commit is contained in:
Aaron Durbin 2016-08-05 21:45:54 -05:00 committed by Martin Roth
parent 367f2b9568
commit 18fedb360f
1 changed files with 15 additions and 16 deletions

View File

@ -548,9 +548,6 @@ static void elog_shrink(void)
elog_shrink_by_size(shrink_size); elog_shrink_by_size(shrink_size);
} }
#ifndef __SMM__
#if IS_ENABLED(CONFIG_ARCH_X86)
/* /*
* Convert a flash offset into a memory mapped flash address * 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; struct smbios_type15 *t = (struct smbios_type15 *)*current;
int len = sizeof(struct smbios_type15); int len = sizeof(struct smbios_type15);
uintptr_t log_address;
#if CONFIG_ELOG_CBMEM if (IS_ENABLED(CONFIG_ELOG_CBMEM)) {
/* Save event log buffer into CBMEM for the OS to read */ /* Save event log buffer into CBMEM for the OS to read */
void *cbmem = cbmem_add(CBMEM_ID_ELOG, total_size); void *cbmem = cbmem_add(CBMEM_ID_ELOG, total_size);
if (!cbmem) 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 (!log_address) {
printk(BIOS_WARNING, "SMBIOS type 15 log address invalid.\n");
return 0; return 0;
rdev_readat(mirror_dev_get(), cbmem, 0, total_size); }
#endif
memset(t, 0, len); memset(t, 0, len);
t->type = SMBIOS_EVENT_LOG; 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->access_method = SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32;
t->log_status = SMBIOS_EVENTLOG_STATUS_VALID; t->log_status = SMBIOS_EVENTLOG_STATUS_VALID;
t->change_token = 0; t->change_token = 0;
#if CONFIG_ELOG_CBMEM t->address = log_address;
t->address = (u32)cbmem;
#else
t->address = (u32)elog_flash_offset_to_address();
#endif
t->header_format = ELOG_HEADER_TYPE_OEM; t->header_format = ELOG_HEADER_TYPE_OEM;
t->log_type_descriptors = 0; t->log_type_descriptors = 0;
t->log_type_descriptor_length = 2; t->log_type_descriptor_length = 2;
@ -605,8 +606,6 @@ int elog_smbios_write_type15(unsigned long *current, int handle)
*current += len; *current += len;
return len; return len;
} }
#endif
#endif
/* /*
* Clear the entire event log * Clear the entire event log