[coreboot-gerrit] New patch to review for coreboot: drivers/elog: clean up SMBIOS related code
Aaron Durbin (adurbin@chromium.org)
gerrit at coreboot.org
Sat Aug 6 08:32:58 CEST 2016
Aaron Durbin (adurbin at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16102
-gerrit
commit 194dcedefad9b985787a2f315eac276c8bf93b76
Author: Aaron Durbin <adurbin at chromium.org>
Date: Fri Aug 5 21:45:54 2016 -0500
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 at chromium.org>
---
src/drivers/elog/elog.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index 26bb68d..c839d8a 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -546,9 +546,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
*/
@@ -572,14 +569,21 @@ int elog_smbios_write_type15(unsigned long *current, int handle)
{
struct smbios_type15 *t = (struct smbios_type15 *)*current;
int len = sizeof(struct smbios_type15);
-
-#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)
+ 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 (!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;
@@ -591,11 +595,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;
@@ -603,8 +603,6 @@ int elog_smbios_write_type15(unsigned long *current, int handle)
*current += len;
return len;
}
-#endif
-#endif
/*
* Clear the entire event log
More information about the coreboot-gerrit
mailing list