lenovo: Make version look like something thinkpad_acpi would accept

thinkpad_acpi checks that BIOS version matches some pattern.
Report version in this form.

Not cleaned up as the idea of this patch seems to be met with resistance.
Can make it Thinkpad-specific if the idea is accepted.

Change-Id: I15e33e87e7a7f42d6a06f12fb39b5172153af8a1
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-on: http://review.coreboot.org/4650
Tested-by: build bot (Jenkins)
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
This commit is contained in:
Vladimir Serbinenko 2014-06-01 00:26:48 +02:00
parent 4c81a9e142
commit 63acd22dc5
6 changed files with 53 additions and 4 deletions

View File

@ -118,6 +118,14 @@ static int smbios_processor_name(char *start)
return smbios_add_string(start, tmp); return smbios_add_string(start, tmp);
} }
const char *__attribute__((weak)) smbios_mainboard_bios_version(void)
{
if (strlen(CONFIG_LOCALVERSION))
return CONFIG_LOCALVERSION;
else
return COREBOOT_VERSION;
}
static int smbios_write_type0(unsigned long *current, int handle) static int smbios_write_type0(unsigned long *current, int handle)
{ {
struct smbios_type0 *t = (struct smbios_type0 *)*current; struct smbios_type0 *t = (struct smbios_type0 *)*current;
@ -132,10 +140,7 @@ static int smbios_write_type0(unsigned long *current, int handle)
#if !CONFIG_CHROMEOS #if !CONFIG_CHROMEOS
t->bios_release_date = smbios_add_string(t->eos, COREBOOT_DMI_DATE); t->bios_release_date = smbios_add_string(t->eos, COREBOOT_DMI_DATE);
if (strlen(CONFIG_LOCALVERSION)) t->bios_version = smbios_add_string(t->eos, smbios_mainboard_bios_version());
t->bios_version = smbios_add_string(t->eos, CONFIG_LOCALVERSION);
else
t->bios_version = smbios_add_string(t->eos, COREBOOT_VERSION);
#else #else
#define SPACES \ #define SPACES \
" " " "

View File

@ -19,6 +19,7 @@ const char *smbios_mainboard_product_name(void);
const char *smbios_mainboard_serial_number(void); const char *smbios_mainboard_serial_number(void);
const char *smbios_mainboard_version(void); const char *smbios_mainboard_version(void);
void smbios_mainboard_set_uuid(u8 *uuid); void smbios_mainboard_set_uuid(u8 *uuid);
const char *smbios_mainboard_bios_version(void);
#define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7) #define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7)
#define BIOS_CHARACTERISTICS_PC_CARD (1 << 8) #define BIOS_CHARACTERISTICS_PC_CARD (1 << 8)

View File

@ -24,6 +24,7 @@
#include <device/device.h> #include <device/device.h>
#include <arch/io.h> #include <arch/io.h>
#include <delay.h> #include <delay.h>
#include <string.h>
#include <device/pci_def.h> #include <device/pci_def.h>
#include <device/pci_ops.h> #include <device/pci_ops.h>
#include <arch/io.h> #include <arch/io.h>
@ -34,6 +35,7 @@
#include <pc80/mc146818rtc.h> #include <pc80/mc146818rtc.h>
#include <arch/x86/include/arch/acpigen.h> #include <arch/x86/include/arch/acpigen.h>
#include <smbios.h> #include <smbios.h>
#include <build.h>
static acpi_cstate_t cst_entries[] = { static acpi_cstate_t cst_entries[] = {
{ 1, 1, 1000, { 0x7f, 1, 2, { 0 }, 1, 0 } }, { 1, 1, 1000, { 0x7f, 1, 2, { 0 }, 1, 0 } },
@ -47,6 +49,15 @@ int get_cst_entries(acpi_cstate_t **entries)
return ARRAY_SIZE(cst_entries); return ARRAY_SIZE(cst_entries);
} }
const char *smbios_mainboard_bios_version(void)
{
/* Satisfy thinkpad_acpi. */
if (strlen(CONFIG_LOCALVERSION))
return "CBET4000 " CONFIG_LOCALVERSION;
else
return "CBET4000 " COREBOOT_VERSION;
}
static void mainboard_init(device_t dev) static void mainboard_init(device_t dev)
{ {
struct southbridge_intel_i82801gx_config *config; struct southbridge_intel_i82801gx_config *config;

View File

@ -25,6 +25,7 @@
#include <device/device.h> #include <device/device.h>
#include <arch/io.h> #include <arch/io.h>
#include <delay.h> #include <delay.h>
#include <string.h>
#include <device/pci_def.h> #include <device/pci_def.h>
#include <device/pci_ops.h> #include <device/pci_ops.h>
#include <device/pci_ids.h> #include <device/pci_ids.h>
@ -47,6 +48,7 @@
#include <cpu/x86/lapic.h> #include <cpu/x86/lapic.h>
#include <device/pci.h> #include <device/pci.h>
#include <smbios.h> #include <smbios.h>
#include <build.h>
static acpi_cstate_t cst_entries[] = { static acpi_cstate_t cst_entries[] = {
{1, 1, 1000, {0x7f, 1, 2, {0}, 1, 0}}, {1, 1, 1000, {0x7f, 1, 2, {0}, 1, 0}},
@ -88,6 +90,15 @@ static int int15_handler(void)
} }
#endif #endif
const char *smbios_mainboard_bios_version(void)
{
/* Satisfy thinkpad_acpi. */
if (strlen(CONFIG_LOCALVERSION))
return "CBET4000 " CONFIG_LOCALVERSION;
else
return "CBET4000 " COREBOOT_VERSION;
}
const char *smbios_mainboard_version(void) const char *smbios_mainboard_version(void)
{ {
return "Lenovo X201"; return "Lenovo X201";

View File

@ -39,6 +39,7 @@
#include <device/pci.h> #include <device/pci.h>
#include <cbfs.h> #include <cbfs.h>
#include <pc80/keyboard.h> #include <pc80/keyboard.h>
#include <build.h>
void mainboard_suspend_resume(void) void mainboard_suspend_resume(void)
{ {
@ -131,6 +132,15 @@ static int int15_handler(void)
} }
#endif #endif
const char *smbios_mainboard_bios_version(void)
{
/* Satisfy thinkpad_acpi. */
if (strlen(CONFIG_LOCALVERSION))
return "CBET4000 " CONFIG_LOCALVERSION;
else
return "CBET4000 " COREBOOT_VERSION;
}
const char *smbios_mainboard_version(void) const char *smbios_mainboard_version(void)
{ {
return "ThinkPad X230"; return "ThinkPad X230";

View File

@ -24,6 +24,7 @@
#include <device/device.h> #include <device/device.h>
#include <arch/io.h> #include <arch/io.h>
#include <delay.h> #include <delay.h>
#include <string.h>
#include <device/pci_def.h> #include <device/pci_def.h>
#include <device/pci_ops.h> #include <device/pci_ops.h>
#include <device/pci_ids.h> #include <device/pci_ids.h>
@ -37,6 +38,7 @@
#include "dock.h" #include "dock.h"
#include <arch/x86/include/arch/acpigen.h> #include <arch/x86/include/arch/acpigen.h>
#include <smbios.h> #include <smbios.h>
#include <build.h>
#include <x86emu/x86emu.h> #include <x86emu/x86emu.h>
#define PANEL INT15_5F35_CL_DISPLAY_DEFAULT #define PANEL INT15_5F35_CL_DISPLAY_DEFAULT
@ -148,6 +150,15 @@ static int mainboard_smbios_data(device_t dev, int *handle, unsigned long *curre
return len; return len;
} }
const char *smbios_mainboard_bios_version(void)
{
/* Satisfy thinkpad_acpi. */
if (strlen(CONFIG_LOCALVERSION))
return "CBET4000 " CONFIG_LOCALVERSION;
else
return "CBET4000 " COREBOOT_VERSION;
}
static void mainboard_enable(device_t dev) static void mainboard_enable(device_t dev)
{ {
dev->ops->init = mainboard_init; dev->ops->init = mainboard_init;