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 <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/6788 Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Tested-by: build bot (Jenkins)
This commit is contained in:
parent
8603513540
commit
6abb33c7ba
|
@ -253,7 +253,7 @@ static int smbios_write_type3(unsigned long *current, int handle)
|
||||||
t->bootup_state = SMBIOS_STATE_SAFE;
|
t->bootup_state = SMBIOS_STATE_SAFE;
|
||||||
t->power_supply_state = SMBIOS_STATE_SAFE;
|
t->power_supply_state = SMBIOS_STATE_SAFE;
|
||||||
t->thermal_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;
|
t->security_status = SMBIOS_STATE_SAFE;
|
||||||
len = t->length + smbios_string_table_len(t->eos);
|
len = t->length + smbios_string_table_len(t->eos);
|
||||||
*current += len;
|
*current += len;
|
||||||
|
@ -295,21 +295,31 @@ static int smbios_write_type4(unsigned long *current, int handle)
|
||||||
return len;
|
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;
|
struct smbios_type11 *t = (struct smbios_type11 *)*current;
|
||||||
int i, len;
|
int len;
|
||||||
|
device_t dev;
|
||||||
|
|
||||||
memset(t, 0, sizeof *t);
|
memset(t, 0, sizeof *t);
|
||||||
t->type = SMBIOS_OEM_STRINGS;
|
t->type = SMBIOS_OEM_STRINGS;
|
||||||
t->handle = handle;
|
t->handle = *handle;
|
||||||
t->length = len = sizeof *t - 2;
|
t->length = len = sizeof *t - 2;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for(dev = all_devices; dev; dev = dev->next) {
|
||||||
t->count = smbios_add_string(t->eos, oem_strings[i]);
|
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);
|
len += smbios_string_table_len(t->eos);
|
||||||
|
|
||||||
*current += len;
|
*current += len;
|
||||||
|
(*handle)++;
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,6 +408,7 @@ unsigned long smbios_write_tables(unsigned long current)
|
||||||
len += smbios_write_type2(¤t, handle++);
|
len += smbios_write_type2(¤t, handle++);
|
||||||
len += smbios_write_type3(¤t, handle++);
|
len += smbios_write_type3(¤t, handle++);
|
||||||
len += smbios_write_type4(¤t, handle++);
|
len += smbios_write_type4(¤t, handle++);
|
||||||
|
len += smbios_write_type11(¤t, &handle);
|
||||||
#if CONFIG_ELOG
|
#if CONFIG_ELOG
|
||||||
len += elog_smbios_write_type15(¤t, handle++);
|
len += elog_smbios_write_type15(¤t, handle++);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <kconfig.h>
|
#include <kconfig.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <smbios.h>
|
||||||
#include <pc80/mc146818rtc.h>
|
#include <pc80/mc146818rtc.h>
|
||||||
|
|
||||||
#include "h8.h"
|
#include "h8.h"
|
||||||
|
@ -166,12 +167,27 @@ u8 h8_build_id_and_function_spec_version(char *buf, u8 buf_len)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void h8_smbios_strings(device_t dev, struct smbios_type11 *t)
|
||||||
|
{
|
||||||
|
char tpec[] = "IBM ThinkPad Embedded Controller -[ ]-";
|
||||||
|
|
||||||
|
h8_build_id_and_function_spec_version(tpec + 35, 17);
|
||||||
|
|
||||||
|
t->count = smbios_add_string(t->eos, tpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct device_operations h8_dev_ops = {
|
||||||
|
.get_smbios_strings = h8_smbios_strings
|
||||||
|
};
|
||||||
|
|
||||||
static void h8_enable(device_t dev)
|
static void h8_enable(device_t dev)
|
||||||
{
|
{
|
||||||
struct ec_lenovo_h8_config *conf = dev->chip_info;
|
struct ec_lenovo_h8_config *conf = dev->chip_info;
|
||||||
u8 val, tmp;
|
u8 val, tmp;
|
||||||
u8 beepmask0, beepmask1, config1;
|
u8 beepmask0, beepmask1, config1;
|
||||||
|
|
||||||
|
dev->ops = &h8_dev_ops;
|
||||||
|
|
||||||
h8_log_ec_version();
|
h8_log_ec_version();
|
||||||
|
|
||||||
ec_write(H8_CONFIG0, conf->config0);
|
ec_write(H8_CONFIG0, conf->config0);
|
||||||
|
@ -279,5 +295,5 @@ static void h8_enable(device_t dev)
|
||||||
|
|
||||||
struct chip_operations ec_lenovo_h8_ops = {
|
struct chip_operations ec_lenovo_h8_ops = {
|
||||||
CHIP_NAME("Lenovo H8 EC")
|
CHIP_NAME("Lenovo H8 EC")
|
||||||
.enable_dev = h8_enable
|
.enable_dev = h8_enable,
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,6 +39,8 @@ struct chip_operations {
|
||||||
|
|
||||||
struct bus;
|
struct bus;
|
||||||
|
|
||||||
|
struct smbios_type11;
|
||||||
|
|
||||||
struct device_operations {
|
struct device_operations {
|
||||||
void (*read_resources)(device_t dev);
|
void (*read_resources)(device_t dev);
|
||||||
void (*set_resources)(device_t dev);
|
void (*set_resources)(device_t dev);
|
||||||
|
@ -52,6 +54,7 @@ struct device_operations {
|
||||||
void (*reset_bus)(struct bus *bus);
|
void (*reset_bus)(struct bus *bus);
|
||||||
#if CONFIG_GENERATE_SMBIOS_TABLES
|
#if CONFIG_GENERATE_SMBIOS_TABLES
|
||||||
int (*get_smbios_data)(device_t dev, int *handle, unsigned long *current);
|
int (*get_smbios_data)(device_t dev, int *handle, unsigned long *current);
|
||||||
|
void (*get_smbios_strings)(device_t dev, struct smbios_type11 *t);
|
||||||
#endif
|
#endif
|
||||||
const struct pci_operations *ops_pci;
|
const struct pci_operations *ops_pci;
|
||||||
const struct smbus_bus_operations *ops_smbus_bus;
|
const struct smbus_bus_operations *ops_smbus_bus;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
int smbios_write_type11(unsigned long *current, int handle, const char **oem_strings, int count);
|
|
||||||
unsigned long smbios_write_tables(unsigned long start);
|
unsigned long smbios_write_tables(unsigned long start);
|
||||||
int smbios_add_string(char *start, const char *str);
|
int smbios_add_string(char *start, const char *str);
|
||||||
int smbios_string_table_len(char *start);
|
int smbios_string_table_len(char *start);
|
||||||
|
|
|
@ -164,27 +164,12 @@ static void mainboard_init(device_t dev)
|
||||||
0x42, 0x142);
|
0x42, 0x142);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mainboard_smbios_data(device_t dev, int *handle, unsigned long *current)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
char tpec[] = "IBM ThinkPad Embedded Controller -[ ]-";
|
|
||||||
const char *oem_strings[] = {
|
|
||||||
tpec,
|
|
||||||
};
|
|
||||||
|
|
||||||
h8_build_id_and_function_spec_version(tpec + 35, 17);
|
|
||||||
len = smbios_write_type11(current, (*handle)++, oem_strings, ARRAY_SIZE(oem_strings));
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
// mainboard_enable is executed as first thing after
|
// mainboard_enable is executed as first thing after
|
||||||
// enumerate_buses().
|
// enumerate_buses().
|
||||||
|
|
||||||
static void mainboard_enable(device_t dev)
|
static void mainboard_enable(device_t dev)
|
||||||
{
|
{
|
||||||
dev->ops->init = mainboard_init;
|
dev->ops->init = mainboard_init;
|
||||||
dev->ops->get_smbios_data = mainboard_smbios_data;
|
|
||||||
|
|
||||||
#if CONFIG_VGA_ROM_RUN
|
#if CONFIG_VGA_ROM_RUN
|
||||||
/* Install custom int15 handler for VGA OPROM */
|
/* Install custom int15 handler for VGA OPROM */
|
||||||
|
|
|
@ -129,24 +129,9 @@ static void mainboard_init(device_t dev)
|
||||||
ec_write(0x0c, inb(0x164c) & 8 ? 0x89 : 0x09);
|
ec_write(0x0c, inb(0x164c) & 8 ? 0x89 : 0x09);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mainboard_smbios_data(device_t dev, int *handle, unsigned long *current)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
char tpec[] = "IBM ThinkPad Embedded Controller -[ ]-";
|
|
||||||
const char *oem_strings[] = {
|
|
||||||
tpec,
|
|
||||||
};
|
|
||||||
|
|
||||||
h8_build_id_and_function_spec_version(tpec + 35, 17);
|
|
||||||
len = smbios_write_type11(current, (*handle)++, oem_strings, ARRAY_SIZE(oem_strings));
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mainboard_enable(device_t dev)
|
static void mainboard_enable(device_t dev)
|
||||||
{
|
{
|
||||||
dev->ops->init = mainboard_init;
|
dev->ops->init = mainboard_init;
|
||||||
dev->ops->get_smbios_data = mainboard_smbios_data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct chip_operations mainboard_ops = {
|
struct chip_operations mainboard_ops = {
|
||||||
|
|
|
@ -125,20 +125,6 @@ const char *smbios_mainboard_bios_version(void)
|
||||||
return "CBET4000 " COREBOOT_VERSION;
|
return "CBET4000 " COREBOOT_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mainboard_smbios_data(device_t dev, int *handle, unsigned long *current)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
char tpec[] = "IBM ThinkPad Embedded Controller -[ ]-";
|
|
||||||
const char *oem_strings[] = {
|
|
||||||
tpec,
|
|
||||||
};
|
|
||||||
|
|
||||||
h8_build_id_and_function_spec_version(tpec + 35, 17);
|
|
||||||
len = smbios_write_type11(current, (*handle)++, oem_strings, ARRAY_SIZE(oem_strings));
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mainboard_init(device_t dev)
|
static void mainboard_init(device_t dev)
|
||||||
{
|
{
|
||||||
/* This sneaked in here, because X200 SuperIO chip isn't really
|
/* This sneaked in here, because X200 SuperIO chip isn't really
|
||||||
|
@ -155,7 +141,6 @@ static void mainboard_enable(device_t dev)
|
||||||
mainboard_interrupt_handlers(0x15, &int15_handler);
|
mainboard_interrupt_handlers(0x15, &int15_handler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dev->ops->get_smbios_data = mainboard_smbios_data;
|
|
||||||
dev->ops->init = mainboard_init;
|
dev->ops->init = mainboard_init;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,27 +147,12 @@ static void mainboard_init(device_t dev)
|
||||||
0x42, 0x142);
|
0x42, 0x142);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mainboard_smbios_data(device_t dev, int *handle, unsigned long *current)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
char tpec[] = "IBM ThinkPad Embedded Controller -[ ]-";
|
|
||||||
const char *oem_strings[] = {
|
|
||||||
tpec,
|
|
||||||
};
|
|
||||||
|
|
||||||
h8_build_id_and_function_spec_version(tpec + 35, 17);
|
|
||||||
len = smbios_write_type11(current, (*handle)++, oem_strings, ARRAY_SIZE(oem_strings));
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mainboard_enable(device_t dev)
|
static void mainboard_enable(device_t dev)
|
||||||
{
|
{
|
||||||
device_t dev0;
|
device_t dev0;
|
||||||
u16 pmbase;
|
u16 pmbase;
|
||||||
|
|
||||||
dev->ops->init = mainboard_init;
|
dev->ops->init = mainboard_init;
|
||||||
dev->ops->get_smbios_data = mainboard_smbios_data;
|
|
||||||
|
|
||||||
pmbase = pci_read_config32(dev_find_slot(0, PCI_DEVFN(0x1f, 0)),
|
pmbase = pci_read_config32(dev_find_slot(0, PCI_DEVFN(0x1f, 0)),
|
||||||
PMBASE) & 0xff80;
|
PMBASE) & 0xff80;
|
||||||
|
|
|
@ -174,27 +174,12 @@ static void mainboard_init(device_t dev)
|
||||||
0x42, 0x142);
|
0x42, 0x142);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mainboard_smbios_data(device_t dev, int *handle, unsigned long *current)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
char tpec[] = "IBM ThinkPad Embedded Controller -[ ]-";
|
|
||||||
const char *oem_strings[] = {
|
|
||||||
tpec,
|
|
||||||
};
|
|
||||||
|
|
||||||
h8_build_id_and_function_spec_version(tpec + 35, 17);
|
|
||||||
len = smbios_write_type11(current, (*handle)++, oem_strings, ARRAY_SIZE(oem_strings));
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
// mainboard_enable is executed as first thing after
|
// mainboard_enable is executed as first thing after
|
||||||
// enumerate_buses().
|
// enumerate_buses().
|
||||||
|
|
||||||
static void mainboard_enable(device_t dev)
|
static void mainboard_enable(device_t dev)
|
||||||
{
|
{
|
||||||
dev->ops->init = mainboard_init;
|
dev->ops->init = mainboard_init;
|
||||||
dev->ops->get_smbios_data = mainboard_smbios_data;
|
|
||||||
|
|
||||||
#if CONFIG_VGA_ROM_RUN
|
#if CONFIG_VGA_ROM_RUN
|
||||||
/* Install custom int15 handler for VGA OPROM */
|
/* Install custom int15 handler for VGA OPROM */
|
||||||
|
|
|
@ -174,27 +174,12 @@ static void mainboard_init(device_t dev)
|
||||||
0x42, 0x142);
|
0x42, 0x142);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mainboard_smbios_data(device_t dev, int *handle, unsigned long *current)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
char tpec[] = "IBM ThinkPad Embedded Controller -[ ]-";
|
|
||||||
const char *oem_strings[] = {
|
|
||||||
tpec,
|
|
||||||
};
|
|
||||||
|
|
||||||
h8_build_id_and_function_spec_version(tpec + 35, 17);
|
|
||||||
len = smbios_write_type11(current, (*handle)++, oem_strings, ARRAY_SIZE(oem_strings));
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
// mainboard_enable is executed as first thing after
|
// mainboard_enable is executed as first thing after
|
||||||
// enumerate_buses().
|
// enumerate_buses().
|
||||||
|
|
||||||
static void mainboard_enable(device_t dev)
|
static void mainboard_enable(device_t dev)
|
||||||
{
|
{
|
||||||
dev->ops->init = mainboard_init;
|
dev->ops->init = mainboard_init;
|
||||||
dev->ops->get_smbios_data = mainboard_smbios_data;
|
|
||||||
|
|
||||||
#if CONFIG_VGA_ROM_RUN
|
#if CONFIG_VGA_ROM_RUN
|
||||||
/* Install custom int15 handler for VGA OPROM */
|
/* Install custom int15 handler for VGA OPROM */
|
||||||
|
|
|
@ -136,20 +136,6 @@ static void mainboard_init(device_t dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mainboard_smbios_data(device_t dev, int *handle, unsigned long *current)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
char tpec[] = "IBM ThinkPad Embedded Controller -[ ]-";
|
|
||||||
const char *oem_strings[] = {
|
|
||||||
tpec,
|
|
||||||
};
|
|
||||||
|
|
||||||
h8_build_id_and_function_spec_version(tpec + 35, 17);
|
|
||||||
len = smbios_write_type11(current, (*handle)++, oem_strings, ARRAY_SIZE(oem_strings));
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *smbios_mainboard_bios_version(void)
|
const char *smbios_mainboard_bios_version(void)
|
||||||
{
|
{
|
||||||
/* Satisfy thinkpad_acpi. */
|
/* Satisfy thinkpad_acpi. */
|
||||||
|
@ -162,7 +148,6 @@ const char *smbios_mainboard_bios_version(void)
|
||||||
static void mainboard_enable(device_t dev)
|
static void mainboard_enable(device_t dev)
|
||||||
{
|
{
|
||||||
dev->ops->init = mainboard_init;
|
dev->ops->init = mainboard_init;
|
||||||
dev->ops->get_smbios_data = mainboard_smbios_data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct chip_operations mainboard_ops = {
|
struct chip_operations mainboard_ops = {
|
||||||
|
|
Loading…
Reference in New Issue