From 1b66bbaf8380f72faffb48e2bb4f977fb8b3e958 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Sun, 28 Nov 2021 08:34:53 +0000 Subject: mainboard/starlabs/labtop: Hook up Thunderbolt to CMOS Hook up Thunderbolt and related settings to CMOS value of `thunderbolt`. Changes TcssXhciEn, UsbTcPortEn and the relevant PCI devices. Signed-off-by: Sean Rhodes Change-Id: Ibadc7464831242ae51982610b410ccf0a6811edd Reviewed-on: https://review.coreboot.org/c/coreboot/+/59705 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons Reviewed-by: Andy Pont --- src/mainboard/starlabs/labtop/cmos.default | 1 + src/mainboard/starlabs/labtop/cmos.layout | 1 + src/mainboard/starlabs/labtop/variants/tgl/devtree.c | 12 ++++++++++++ src/mainboard/starlabs/labtop/variants/tgl/romstage.c | 8 ++++++++ 4 files changed, 22 insertions(+) (limited to 'src') diff --git a/src/mainboard/starlabs/labtop/cmos.default b/src/mainboard/starlabs/labtop/cmos.default index b4b2d2600b..589189f9dd 100644 --- a/src/mainboard/starlabs/labtop/cmos.default +++ b/src/mainboard/starlabs/labtop/cmos.default @@ -14,6 +14,7 @@ webcam=Enable microphone=Enable legacy_8254_timer=Enable usb_always_on=Disable +thunderbolt=Disable # EC kbl_timeout=30 seconds fn_ctrl_swap=Disable diff --git a/src/mainboard/starlabs/labtop/cmos.layout b/src/mainboard/starlabs/labtop/cmos.layout index 2601e9818a..85ec47772c 100644 --- a/src/mainboard/starlabs/labtop/cmos.layout +++ b/src/mainboard/starlabs/labtop/cmos.layout @@ -30,6 +30,7 @@ entries 520 1 e 1 microphone 528 1 e 1 legacy_8254_timer 536 1 e 1 usb_always_on +544 1 e 1 thunderbolt # coreboot config options: EC 600 3 e 4 kbl_timeout diff --git a/src/mainboard/starlabs/labtop/variants/tgl/devtree.c b/src/mainboard/starlabs/labtop/variants/tgl/devtree.c index 034877c66e..42a5aff366 100644 --- a/src/mainboard/starlabs/labtop/variants/tgl/devtree.c +++ b/src/mainboard/starlabs/labtop/variants/tgl/devtree.c @@ -19,6 +19,9 @@ void devtree_update(void) &cfg->power_limits_config[POWER_LIMITS_U_4_CORE]; struct device *nic_dev = pcidev_on_root(0x14, 3); + struct device *tbt_pci_dev = pcidev_on_root(0x07, 0); + struct device *tbt_dma_dev = pcidev_on_root(0x0d, 2); + /* Update PL1 & PL2 based on CMOS settings */ switch (get_uint_option("power_profile", 0)) { @@ -50,4 +53,13 @@ void devtree_update(void) /* Enable/Disable Webcam based on CMOS settings */ if (get_uint_option("webcam", 1) == 0) cfg->usb2_ports[3].enable = 0; + + /* Enable/Disable Thunderbolt based on CMOS settings */ + if (get_uint_option("thunderbolt", 1) == 0) { + cfg->UsbTcPortEn = 0; + cfg->TcssXhciEn = 0; + cfg->TcssD3ColdDisable = 0; + tbt_pci_dev->enabled = 0; + tbt_dma_dev->enabled = 0; + } } diff --git a/src/mainboard/starlabs/labtop/variants/tgl/romstage.c b/src/mainboard/starlabs/labtop/variants/tgl/romstage.c index dae2142a91..1d65c61ba5 100644 --- a/src/mainboard/starlabs/labtop/variants/tgl/romstage.c +++ b/src/mainboard/starlabs/labtop/variants/tgl/romstage.c @@ -33,4 +33,12 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) const uint8_t ht = get_uint_option("hyper_threading", mupd->FspmConfig.HyperThreading); mupd->FspmConfig.HyperThreading = ht; + + /* Enable/Disable Thunderbolt based on CMOS settings */ + if (get_uint_option("thunderbolt", 1) == 0) { + mupd->FspmConfig.VtdItbtEnable = 0; + mupd->FspmConfig.VtdBaseAddress[3] = 0; + mupd->FspmConfig.TcssDma0En = 0; + mupd->FspmConfig.TcssItbtPcie0En = 0; + } }; -- cgit v1.2.3