aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/x86/boot/smbios.c23
-rw-r--r--src/ec/lenovo/h8/h8.c18
-rw-r--r--src/include/device/device.h3
-rw-r--r--src/include/smbios.h1
-rw-r--r--src/mainboard/lenovo/t530/mainboard.c15
-rw-r--r--src/mainboard/lenovo/t60/mainboard.c15
-rw-r--r--src/mainboard/lenovo/x200/mainboard.c15
-rw-r--r--src/mainboard/lenovo/x201/mainboard.c15
-rw-r--r--src/mainboard/lenovo/x220/mainboard.c15
-rw-r--r--src/mainboard/lenovo/x230/mainboard.c15
-rw-r--r--src/mainboard/lenovo/x60/mainboard.c15
11 files changed, 37 insertions, 113 deletions
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(&current, handle++);
len += smbios_write_type3(&current, handle++);
len += smbios_write_type4(&current, handle++);
+ len += smbios_write_type11(&current, &handle);
#if CONFIG_ELOG
len += elog_smbios_write_type15(&current, handle++);
#endif
diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c
index e70c0e8ed0..79ef3cdeeb 100644
--- a/src/ec/lenovo/h8/h8.c
+++ b/src/ec/lenovo/h8/h8.c
@@ -25,6 +25,7 @@
#include <kconfig.h>
#include <stdlib.h>
#include <string.h>
+#include <smbios.h>
#include <pc80/mc146818rtc.h>
#include "h8.h"
@@ -166,12 +167,27 @@ u8 h8_build_id_and_function_spec_version(char *buf, u8 buf_len)
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)
{
struct ec_lenovo_h8_config *conf = dev->chip_info;
u8 val, tmp;
u8 beepmask0, beepmask1, config1;
+ dev->ops = &h8_dev_ops;
+
h8_log_ec_version();
ec_write(H8_CONFIG0, conf->config0);
@@ -279,5 +295,5 @@ static void h8_enable(device_t dev)
struct chip_operations ec_lenovo_h8_ops = {
CHIP_NAME("Lenovo H8 EC")
- .enable_dev = h8_enable
+ .enable_dev = h8_enable,
};
diff --git a/src/include/device/device.h b/src/include/device/device.h
index ec17adfc54..19b5ea071e 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -39,6 +39,8 @@ struct chip_operations {
struct bus;
+struct smbios_type11;
+
struct device_operations {
void (*read_resources)(device_t dev);
void (*set_resources)(device_t dev);
@@ -52,6 +54,7 @@ struct device_operations {
void (*reset_bus)(struct bus *bus);
#if CONFIG_GENERATE_SMBIOS_TABLES
int (*get_smbios_data)(device_t dev, int *handle, unsigned long *current);
+ void (*get_smbios_strings)(device_t dev, struct smbios_type11 *t);
#endif
const struct pci_operations *ops_pci;
const struct smbus_bus_operations *ops_smbus_bus;
diff --git a/src/include/smbios.h b/src/include/smbios.h
index a5716b38a5..cf9df1ac89 100644
--- a/src/include/smbios.h
+++ b/src/include/smbios.h
@@ -3,7 +3,6 @@
#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);
int smbios_add_string(char *start, const char *str);
int smbios_string_table_len(char *start);
diff --git a/src/mainboard/lenovo/t530/mainboard.c b/src/mainboard/lenovo/t530/mainboard.c
index feb1aa78f0..c3425b3d01 100644
--- a/src/mainboard/lenovo/t530/mainboard.c
+++ b/src/mainboard/lenovo/t530/mainboard.c
@@ -164,27 +164,12 @@ static void mainboard_init(device_t dev)
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
// enumerate_buses().
static void mainboard_enable(device_t dev)
{
dev->ops->init = mainboard_init;
- dev->ops->get_smbios_data = mainboard_smbios_data;
#if CONFIG_VGA_ROM_RUN
/* Install custom int15 handler for VGA OPROM */
diff --git a/src/mainboard/lenovo/t60/mainboard.c b/src/mainboard/lenovo/t60/mainboard.c
index 6dac819f2e..9c6a30a47c 100644
--- a/src/mainboard/lenovo/t60/mainboard.c
+++ b/src/mainboard/lenovo/t60/mainboard.c
@@ -129,24 +129,9 @@ static void mainboard_init(device_t dev)
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)
{
dev->ops->init = mainboard_init;
- dev->ops->get_smbios_data = mainboard_smbios_data;
}
struct chip_operations mainboard_ops = {
diff --git a/src/mainboard/lenovo/x200/mainboard.c b/src/mainboard/lenovo/x200/mainboard.c
index 9fe55db308..df314630ff 100644
--- a/src/mainboard/lenovo/x200/mainboard.c
+++ b/src/mainboard/lenovo/x200/mainboard.c
@@ -125,20 +125,6 @@ const char *smbios_mainboard_bios_version(void)
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)
{
/* 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);
#endif
- dev->ops->get_smbios_data = mainboard_smbios_data;
dev->ops->init = mainboard_init;
}
diff --git a/src/mainboard/lenovo/x201/mainboard.c b/src/mainboard/lenovo/x201/mainboard.c
index 16d4bd9c7d..fd11da8326 100644
--- a/src/mainboard/lenovo/x201/mainboard.c
+++ b/src/mainboard/lenovo/x201/mainboard.c
@@ -147,27 +147,12 @@ static void mainboard_init(device_t dev)
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)
{
device_t dev0;
u16 pmbase;
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) & 0xff80;
diff --git a/src/mainboard/lenovo/x220/mainboard.c b/src/mainboard/lenovo/x220/mainboard.c
index 7bc1edbe8d..28cd8142dc 100644
--- a/src/mainboard/lenovo/x220/mainboard.c
+++ b/src/mainboard/lenovo/x220/mainboard.c
@@ -174,27 +174,12 @@ static void mainboard_init(device_t dev)
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
// enumerate_buses().
static void mainboard_enable(device_t dev)
{
dev->ops->init = mainboard_init;
- dev->ops->get_smbios_data = mainboard_smbios_data;
#if CONFIG_VGA_ROM_RUN
/* Install custom int15 handler for VGA OPROM */
diff --git a/src/mainboard/lenovo/x230/mainboard.c b/src/mainboard/lenovo/x230/mainboard.c
index 323f37faed..c017712855 100644
--- a/src/mainboard/lenovo/x230/mainboard.c
+++ b/src/mainboard/lenovo/x230/mainboard.c
@@ -174,27 +174,12 @@ static void mainboard_init(device_t dev)
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
// enumerate_buses().
static void mainboard_enable(device_t dev)
{
dev->ops->init = mainboard_init;
- dev->ops->get_smbios_data = mainboard_smbios_data;
#if CONFIG_VGA_ROM_RUN
/* Install custom int15 handler for VGA OPROM */
diff --git a/src/mainboard/lenovo/x60/mainboard.c b/src/mainboard/lenovo/x60/mainboard.c
index cc89047402..4472c0b168 100644
--- a/src/mainboard/lenovo/x60/mainboard.c
+++ b/src/mainboard/lenovo/x60/mainboard.c
@@ -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)
{
/* Satisfy thinkpad_acpi. */
@@ -162,7 +148,6 @@ const char *smbios_mainboard_bios_version(void)
static void mainboard_enable(device_t dev)
{
dev->ops->init = mainboard_init;
- dev->ops->get_smbios_data = mainboard_smbios_data;
}
struct chip_operations mainboard_ops = {