mb/lenovo: Integrate W541 into haswell mainboard
Lots of code from lenovo/haswell can be reused for lenovo/w541. Thus, integrate it into lenovo/haswell and make it a variant. Change-Id: If99d842cff777fe27ff63baabc447e69b9d0333c Signed-off-by: Felix Singer <felixsinger@posteo.net> Reviewed-on: https://review.coreboot.org/c/coreboot/+/63514 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
This commit is contained in:
parent
b5bdd70758
commit
c5f7055746
20 changed files with 14 additions and 321 deletions
|
@ -24,6 +24,9 @@ config BOARD_LENOVO_THINKPAD_T440P
|
||||||
select BOARD_LENOVO_HASWELL_COMMON
|
select BOARD_LENOVO_HASWELL_COMMON
|
||||||
select INTEL_INT15
|
select INTEL_INT15
|
||||||
|
|
||||||
|
config BOARD_LENOVO_THINKPAD_W541
|
||||||
|
select BOARD_LENOVO_HASWELL_COMMON
|
||||||
|
|
||||||
if BOARD_LENOVO_HASWELL_COMMON
|
if BOARD_LENOVO_HASWELL_COMMON
|
||||||
|
|
||||||
config VBOOT
|
config VBOOT
|
||||||
|
@ -43,6 +46,7 @@ config VBOOT_VBNV_OFFSET
|
||||||
|
|
||||||
config VARIANT_DIR
|
config VARIANT_DIR
|
||||||
default "t440p" if BOARD_LENOVO_THINKPAD_T440P
|
default "t440p" if BOARD_LENOVO_THINKPAD_T440P
|
||||||
|
default "w541" if BOARD_LENOVO_THINKPAD_W541
|
||||||
|
|
||||||
config DEVICETREE
|
config DEVICETREE
|
||||||
default "variants/\$(CONFIG_VARIANT_DIR)/devicetree.cb"
|
default "variants/\$(CONFIG_VARIANT_DIR)/devicetree.cb"
|
||||||
|
@ -55,10 +59,11 @@ config MAINBOARD_DIR
|
||||||
|
|
||||||
config MAINBOARD_PART_NUMBER
|
config MAINBOARD_PART_NUMBER
|
||||||
default "ThinkPad T440p" if BOARD_LENOVO_THINKPAD_T440P
|
default "ThinkPad T440p" if BOARD_LENOVO_THINKPAD_T440P
|
||||||
|
default "ThinkPad W541" if BOARD_LENOVO_THINKPAD_W541
|
||||||
|
|
||||||
config VGA_BIOS_ID
|
config VGA_BIOS_ID
|
||||||
string
|
string
|
||||||
default "8086,0416"
|
default "8086,0416" if BOARD_LENOVO_THINKPAD_T440P
|
||||||
|
|
||||||
config USBDEBUG_HCD_INDEX
|
config USBDEBUG_HCD_INDEX
|
||||||
int
|
int
|
||||||
|
@ -72,9 +77,13 @@ config PS2K_EISAID
|
||||||
default "LEN0071"
|
default "LEN0071"
|
||||||
|
|
||||||
config PS2M_EISAID
|
config PS2M_EISAID
|
||||||
default "LEN0036"
|
default "LEN0036" if BOARD_LENOVO_THINKPAD_T440P
|
||||||
|
default "LEN004A" if BOARD_LENOVO_THINKPAD_W541
|
||||||
|
|
||||||
config THINKPADEC_HKEY_EISAID
|
config THINKPADEC_HKEY_EISAID
|
||||||
default "LEN0068"
|
default "LEN0068"
|
||||||
|
|
||||||
|
config GFX_GMA_PANEL_1_PORT
|
||||||
|
default "DP3" if BOARD_LENOVO_THINKPAD_W541
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
config BOARD_LENOVO_THINKPAD_T440P
|
config BOARD_LENOVO_THINKPAD_T440P
|
||||||
bool "ThinkPad T440p"
|
bool "ThinkPad T440p"
|
||||||
|
|
||||||
|
config BOARD_LENOVO_THINKPAD_W541
|
||||||
|
bool "ThinkPad W541"
|
||||||
|
|
|
@ -8,33 +8,6 @@
|
||||||
#include <ec/lenovo/pmh7/pmh7.h>
|
#include <ec/lenovo/pmh7/pmh7.h>
|
||||||
#include <device/pci_ops.h>
|
#include <device/pci_ops.h>
|
||||||
|
|
||||||
void mainboard_config_rcba(void)
|
|
||||||
{
|
|
||||||
RCBA16(D31IR) = DIR_ROUTE(PIRQA, PIRQD, PIRQC, PIRQA);
|
|
||||||
RCBA16(D29IR) = DIR_ROUTE(PIRQH, PIRQD, PIRQA, PIRQC);
|
|
||||||
RCBA16(D28IR) = DIR_ROUTE(PIRQA, PIRQA, PIRQA, PIRQA);
|
|
||||||
RCBA16(D27IR) = DIR_ROUTE(PIRQG, PIRQB, PIRQC, PIRQD);
|
|
||||||
RCBA16(D26IR) = DIR_ROUTE(PIRQA, PIRQF, PIRQC, PIRQD);
|
|
||||||
RCBA16(D25IR) = DIR_ROUTE(PIRQE, PIRQF, PIRQG, PIRQH);
|
|
||||||
RCBA16(D22IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
|
|
||||||
RCBA16(D20IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mb_late_romstage_setup(void)
|
|
||||||
{
|
|
||||||
u8 enable_peg = get_uint_option("enable_dual_graphics", 0);
|
|
||||||
|
|
||||||
bool power_en = pmh7_dgpu_power_state();
|
|
||||||
|
|
||||||
if (enable_peg != power_en)
|
|
||||||
pmh7_dgpu_power_enable(!power_en);
|
|
||||||
|
|
||||||
if (!enable_peg) {
|
|
||||||
// Hide disabled dGPU device
|
|
||||||
pci_and_config32(HOST_BRIDGE, DEVEN, ~DEVEN_D1F0EN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void mb_get_spd_map(struct spd_info *spdi)
|
void mb_get_spd_map(struct spd_info *spdi)
|
||||||
{
|
{
|
||||||
spdi->addresses[0] = 0x50;
|
spdi->addresses[0] = 0x50;
|
|
@ -1,47 +0,0 @@
|
||||||
if BOARD_LENOVO_THINKPAD_W541
|
|
||||||
|
|
||||||
config BOARD_SPECIFIC_OPTIONS
|
|
||||||
def_bool y
|
|
||||||
select BOARD_ROMSIZE_KB_12288
|
|
||||||
select EC_LENOVO_H8
|
|
||||||
select EC_LENOVO_PMH7
|
|
||||||
select H8_HAS_BAT_THRESHOLDS_IMPL
|
|
||||||
select H8_HAS_PRIMARY_FN_KEYS
|
|
||||||
select HAVE_ACPI_RESUME
|
|
||||||
select HAVE_ACPI_TABLES
|
|
||||||
select HAVE_CMOS_DEFAULT
|
|
||||||
select HAVE_OPTION_TABLE
|
|
||||||
select INTEL_GMA_HAVE_VBT
|
|
||||||
select MAINBOARD_HAS_LIBGFXINIT
|
|
||||||
select MAINBOARD_HAS_TPM1
|
|
||||||
select MAINBOARD_USES_IFD_GBE_REGION
|
|
||||||
select MEMORY_MAPPED_TPM
|
|
||||||
select NORTHBRIDGE_INTEL_HASWELL
|
|
||||||
select NO_UART_ON_SUPERIO
|
|
||||||
select SERIRQ_CONTINUOUS_MODE
|
|
||||||
select SOUTHBRIDGE_INTEL_LYNXPOINT
|
|
||||||
select SYSTEM_TYPE_LAPTOP
|
|
||||||
|
|
||||||
config GFX_GMA_PANEL_1_PORT
|
|
||||||
default "DP3"
|
|
||||||
|
|
||||||
config MAINBOARD_DIR
|
|
||||||
default "lenovo/w541"
|
|
||||||
|
|
||||||
config MAINBOARD_PART_NUMBER
|
|
||||||
default "ThinkPad W541"
|
|
||||||
|
|
||||||
config DRIVER_LENOVO_SERIALS
|
|
||||||
bool
|
|
||||||
default n
|
|
||||||
|
|
||||||
config PS2K_EISAID
|
|
||||||
default "LEN0071"
|
|
||||||
|
|
||||||
config PS2M_EISAID
|
|
||||||
default "LEN004A"
|
|
||||||
|
|
||||||
config THINKPADEC_HKEY_EISAID
|
|
||||||
default "LEN0068"
|
|
||||||
|
|
||||||
endif
|
|
|
@ -1,2 +0,0 @@
|
||||||
config BOARD_LENOVO_THINKPAD_W541
|
|
||||||
bool "ThinkPad W541"
|
|
|
@ -1,2 +0,0 @@
|
||||||
romstage-y += gpio.c
|
|
||||||
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
|
|
|
@ -1,4 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
||||||
|
|
||||||
#include <ec/lenovo/h8/acpi/ec.asl>
|
|
||||||
#include <ec/lenovo/h8/acpi/thinkpad_bat_thresholds_b0.asl>
|
|
|
@ -1,14 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
||||||
|
|
||||||
Method(_WAK,1)
|
|
||||||
{
|
|
||||||
/* ME may not be up yet. */
|
|
||||||
\_TZ.MEB1 = 0
|
|
||||||
\_TZ.MEB2 = 0
|
|
||||||
Return(Package(){0,0})
|
|
||||||
}
|
|
||||||
|
|
||||||
Method(_PTS,1)
|
|
||||||
{
|
|
||||||
\_SB.PCI0.LPCB.EC.RADI(0)
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
||||||
|
|
||||||
#include <drivers/pc80/pc/ps2_controller.asl>
|
|
|
@ -1,15 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
||||||
|
|
||||||
#include <acpi/acpi_gnvs.h>
|
|
||||||
#include <soc/nvs.h>
|
|
||||||
|
|
||||||
void mainboard_fill_gnvs(struct global_nvs *gnvs)
|
|
||||||
{
|
|
||||||
/* The lid is open by default. */
|
|
||||||
gnvs->lids = 1;
|
|
||||||
|
|
||||||
/* Temperature at which OS will shut down. */
|
|
||||||
gnvs->tcrt = 100;
|
|
||||||
/* Temperature at which OS will throttle CPU. */
|
|
||||||
gnvs->tpsv = 90;
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
boot_option=Fallback
|
|
||||||
debug_level=Debug
|
|
||||||
power_on_after_fail=Disable
|
|
||||||
nmi=Enable
|
|
||||||
volume=0x3
|
|
||||||
wlan=Enable
|
|
||||||
fn_ctrl_swap=Disable
|
|
||||||
f1_to_f12_as_primary=Enable
|
|
||||||
sticky_fn=Disable
|
|
||||||
trackpoint=Enable
|
|
||||||
backlight=Keyboard
|
|
||||||
enable_dual_graphics=Disable
|
|
||||||
usb_always_on=Disable
|
|
|
@ -1,76 +0,0 @@
|
||||||
## SPDX-License-Identifier: GPL-2.0-only
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
entries
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
0 120 r 0 reserved_memory
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
# RTC_BOOT_BYTE (coreboot hardcoded)
|
|
||||||
384 1 e 4 boot_option
|
|
||||||
388 4 h 0 reboot_counter
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
# coreboot config options: console
|
|
||||||
395 4 e 6 debug_level
|
|
||||||
|
|
||||||
#400 8 r 0 reserved for century byte
|
|
||||||
|
|
||||||
# coreboot config options: southbridge
|
|
||||||
408 1 e 1 nmi
|
|
||||||
409 2 e 7 power_on_after_fail
|
|
||||||
|
|
||||||
# coreboot config options: EC
|
|
||||||
415 1 e 1 wlan
|
|
||||||
416 1 e 1 trackpoint
|
|
||||||
417 1 e 1 fn_ctrl_swap
|
|
||||||
418 1 e 1 sticky_fn
|
|
||||||
419 2 e 13 usb_always_on
|
|
||||||
422 2 e 10 backlight
|
|
||||||
424 1 e 1 f1_to_f12_as_primary
|
|
||||||
|
|
||||||
# coreboot config options: northbridge
|
|
||||||
435 1 e 1 enable_dual_graphics
|
|
||||||
440 8 h 0 volume
|
|
||||||
|
|
||||||
# VBOOT
|
|
||||||
448 128 r 0 vbnv
|
|
||||||
|
|
||||||
# coreboot config options: check sums
|
|
||||||
984 16 h 0 check_sum
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
|
|
||||||
enumerations
|
|
||||||
|
|
||||||
#ID value text
|
|
||||||
1 0 Disable
|
|
||||||
1 1 Enable
|
|
||||||
4 0 Fallback
|
|
||||||
4 1 Normal
|
|
||||||
6 0 Emergency
|
|
||||||
6 1 Alert
|
|
||||||
6 2 Critical
|
|
||||||
6 3 Error
|
|
||||||
6 4 Warning
|
|
||||||
6 5 Notice
|
|
||||||
6 6 Info
|
|
||||||
6 7 Debug
|
|
||||||
6 8 Spew
|
|
||||||
7 0 Disable
|
|
||||||
7 1 Enable
|
|
||||||
7 2 Keep
|
|
||||||
# Haswell ThinkPads have no Thinklight
|
|
||||||
#10 0 Both
|
|
||||||
10 1 Keyboard
|
|
||||||
#10 2 Thinklight only
|
|
||||||
10 3 None
|
|
||||||
13 0 Disable
|
|
||||||
13 1 AC and battery
|
|
||||||
13 2 AC only
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
checksums
|
|
||||||
|
|
||||||
checksum 392 447 984
|
|
|
@ -1,31 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
||||||
|
|
||||||
#define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB
|
|
||||||
#define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB
|
|
||||||
#define EC_LENOVO_H8_ME_WORKAROUND 1
|
|
||||||
#define THINKPAD_EC_GPE 17
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
|
||||||
DefinitionBlock(
|
|
||||||
"dsdt.aml",
|
|
||||||
"DSDT",
|
|
||||||
ACPI_DSDT_REV_2,
|
|
||||||
OEM_ID,
|
|
||||||
ACPI_TABLE_CREATOR,
|
|
||||||
0x20141018 // OEM revision
|
|
||||||
)
|
|
||||||
{
|
|
||||||
#include <acpi/dsdt_top.asl>
|
|
||||||
#include "acpi/platform.asl"
|
|
||||||
#include <cpu/intel/common/acpi/cpu.asl>
|
|
||||||
#include <southbridge/intel/common/acpi/platform.asl>
|
|
||||||
#include <southbridge/intel/lynxpoint/acpi/globalnvs.asl>
|
|
||||||
#include <southbridge/intel/common/acpi/sleepstates.asl>
|
|
||||||
|
|
||||||
Device (\_SB.PCI0)
|
|
||||||
{
|
|
||||||
#include <northbridge/intel/haswell/acpi/hostbridge.asl>
|
|
||||||
#include <drivers/intel/gma/acpi/default_brightness_levels.asl>
|
|
||||||
#include <southbridge/intel/lynxpoint/acpi/pch.asl>
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,85 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
||||||
|
|
||||||
#include <arch/io.h>
|
|
||||||
#include <device/pci_ops.h>
|
|
||||||
#include <console/console.h>
|
|
||||||
#include <cpu/x86/smm.h>
|
|
||||||
#include <ec/acpi/ec.h>
|
|
||||||
#include <ec/lenovo/h8/h8.h>
|
|
||||||
#include <southbridge/intel/lynxpoint/pch.h>
|
|
||||||
|
|
||||||
#define GPE_EC_SCI 1
|
|
||||||
#define GPE_EC_WAKE 13
|
|
||||||
|
|
||||||
static void mainboard_smi_handle_ec_sci(void)
|
|
||||||
{
|
|
||||||
u8 status = inb(EC_SC);
|
|
||||||
u8 event;
|
|
||||||
|
|
||||||
if (!(status & EC_SCI_EVT))
|
|
||||||
return;
|
|
||||||
|
|
||||||
event = ec_query();
|
|
||||||
printk(BIOS_DEBUG, "EC event %#02x\n", event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mainboard_smi_gpi(u32 gpi_sts)
|
|
||||||
{
|
|
||||||
if (gpi_sts & (1 << GPE_EC_SCI))
|
|
||||||
mainboard_smi_handle_ec_sci();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* lynxpoint doesn't have gpi_route_interrupt, so add it */
|
|
||||||
#define GPI_DISABLE 0x00
|
|
||||||
#define GPI_IS_SMI 0x01
|
|
||||||
#define GPI_IS_SCI 0x02
|
|
||||||
#define GPI_IS_NMI 0x03
|
|
||||||
|
|
||||||
static void gpi_route_interrupt(u8 gpi, u8 mode)
|
|
||||||
{
|
|
||||||
u32 gpi_rout;
|
|
||||||
|
|
||||||
gpi_rout = pci_read_config32(PCI_DEV(0, 0x1f, 0), GPIO_ROUT);
|
|
||||||
gpi_rout &= ~(3 << (2 * gpi));
|
|
||||||
gpi_rout |= ((mode & 3) << (2 * gpi));
|
|
||||||
pci_write_config32(PCI_DEV(0, 0x1f, 0), GPIO_ROUT, gpi_rout);
|
|
||||||
}
|
|
||||||
|
|
||||||
int mainboard_smi_apmc(u8 data)
|
|
||||||
{
|
|
||||||
switch (data) {
|
|
||||||
case APM_CNT_ACPI_ENABLE:
|
|
||||||
/* use 0x1600/0x1604 to prevent races with userspace */
|
|
||||||
ec_set_ports(0x1604, 0x1600);
|
|
||||||
/* route EC_SCI to SCI */
|
|
||||||
gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SCI);
|
|
||||||
/* discard all events, and enable attention */
|
|
||||||
ec_write(0x80, 0x01);
|
|
||||||
break;
|
|
||||||
case APM_CNT_ACPI_DISABLE:
|
|
||||||
/* we have to use port 0x62/0x66, as 0x1600/0x1604 doesn't
|
|
||||||
provide a EC query function */
|
|
||||||
ec_set_ports(0x66, 0x62);
|
|
||||||
/* route EC_SCI to SMI */
|
|
||||||
gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SMI);
|
|
||||||
/* discard all events, and enable attention */
|
|
||||||
ec_write(0x80, 0x01);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mainboard_smi_sleep(u8 slp_typ)
|
|
||||||
{
|
|
||||||
if (slp_typ == 3) {
|
|
||||||
u8 ec_wake = ec_read(0x32);
|
|
||||||
/* If EC wake events are enabled,
|
|
||||||
* enable wake on EC WAKE GPE. */
|
|
||||||
if (ec_wake & 0x14) {
|
|
||||||
/* Redirect EC WAKE GPE to SCI. */
|
|
||||||
gpi_route_interrupt(GPE_EC_WAKE, GPI_IS_SCI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue