From 6abb33c7ba5f18ec3e3578cb1f804cbe60e49c49 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Wed, 27 Aug 2014 23:42:45 +0200 Subject: smbios: reorganise OEM strings handling. OEM strings should not be handled by mobo code but by common code with strings collected from all devices. Change-Id: Ibde61a1ca79845670bc0df87dc6c67fa868d48a9 Signed-off-by: Vladimir Serbinenko Reviewed-on: http://review.coreboot.org/6788 Reviewed-by: Edward O'Callaghan Tested-by: build bot (Jenkins) --- src/arch/x86/boot/smbios.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/arch/x86/boot/smbios.c') diff --git a/src/arch/x86/boot/smbios.c b/src/arch/x86/boot/smbios.c index 1e720ec87a..9eea38fefb 100644 --- a/src/arch/x86/boot/smbios.c +++ b/src/arch/x86/boot/smbios.c @@ -253,7 +253,7 @@ static int smbios_write_type3(unsigned long *current, int handle) t->bootup_state = SMBIOS_STATE_SAFE; t->power_supply_state = SMBIOS_STATE_SAFE; t->thermal_state = SMBIOS_STATE_SAFE; - t->_type = SMBIOS_ENCLOSURE_DESKTOP; + t->_type = SMBIOS_ENCLOSURE_NOTEBOOK; t->security_status = SMBIOS_STATE_SAFE; len = t->length + smbios_string_table_len(t->eos); *current += len; @@ -295,21 +295,31 @@ static int smbios_write_type4(unsigned long *current, int handle) return len; } -int smbios_write_type11(unsigned long *current, int handle, const char **oem_strings, int count) +static int smbios_write_type11(unsigned long *current, int *handle) { struct smbios_type11 *t = (struct smbios_type11 *)*current; - int i, len; + int len; + device_t dev; memset(t, 0, sizeof *t); t->type = SMBIOS_OEM_STRINGS; - t->handle = handle; + t->handle = *handle; t->length = len = sizeof *t - 2; - for (i = 0; i < count; i++) - t->count = smbios_add_string(t->eos, oem_strings[i]); + for(dev = all_devices; dev; dev = dev->next) { + if (dev->ops && dev->ops->get_smbios_strings) + dev->ops->get_smbios_strings(dev, t); + } + + if (t->count == 0) { + memset(t, 0, sizeof *t); + return 0; + } len += smbios_string_table_len(t->eos); + *current += len; + (*handle)++; return len; } @@ -398,6 +408,7 @@ unsigned long smbios_write_tables(unsigned long current) len += smbios_write_type2(¤t, handle++); len += smbios_write_type3(¤t, handle++); len += smbios_write_type4(¤t, handle++); + len += smbios_write_type11(¤t, &handle); #if CONFIG_ELOG len += elog_smbios_write_type15(¤t, handle++); #endif -- cgit v1.2.3