From 3466272a69f1345340f5eeda05a5dd338883f8eb Mon Sep 17 00:00:00 2001 From: gaspar-ilom Date: Thu, 6 Mar 2025 21:42:10 +0100 Subject: [PATCH 1/4] do not break building other thinkpads with the hacks for the t480/s made Mate Kukri still not fixing things properly but at least it should now be possible to build older thinkpads without regressions. prior, some code was just commented or unreachable. now we make this explicit with preprocessor directives. heads should build all boards on this coreboot version from the same coreboot tree. use CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON to decide what to compile this should work for T480, T480S and older thinkpads Signed-off-by: gaspar-ilom --- ...lding-other-thinkpads-with-the-hacks.patch | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 patches/coreboot-24.12/0004-do-not-break-building-other-thinkpads-with-the-hacks.patch diff --git a/patches/coreboot-24.12/0004-do-not-break-building-other-thinkpads-with-the-hacks.patch b/patches/coreboot-24.12/0004-do-not-break-building-other-thinkpads-with-the-hacks.patch new file mode 100644 index 000000000..a1fa08e11 --- /dev/null +++ b/patches/coreboot-24.12/0004-do-not-break-building-other-thinkpads-with-the-hacks.patch @@ -0,0 +1,157 @@ +From efc90be24c861f5f83309006e7fdbf3e3504534f Mon Sep 17 00:00:00 2001 +From: gaspar-ilom +Date: Thu, 6 Mar 2025 23:00:00 +0000 +Subject: [PATCH] do not break building other thinkpads with the hacks for the + t480/s made Mate Kukri + +still not fixing things properly but at least it should now be possible to build older thinkpads without regressions. +prior, some code was just commented or unreachable. now we make this explicit with preprocessor directives. +heads should build all boards on this coreboot version from the same coreboot tree. + +Signed-off-by: gaspar-ilom +--- + src/device/pci_rom.c | 8 +++++--- + src/ec/lenovo/h8/acpi/ec.asl | 4 +++- + src/ec/lenovo/h8/bluetooth.c | 15 ++++++++++----- + src/ec/lenovo/h8/wwan.c | 14 ++++++++++---- + 4 files changed, 28 insertions(+), 13 deletions(-) + +diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c +index cc6b9b068a..f47300faaa 100644 +--- a/src/device/pci_rom.c ++++ b/src/device/pci_rom.c +@@ -304,13 +304,15 @@ void pci_rom_ssdt(const struct device *device) + return; + } + +-#if 0 ++ #ifdef CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON ++ const char *scope = "\\_SB.PCI0.RP01.PEGP"; ++ #else + const char *scope = acpi_device_path(device); ++ #endif + if (!scope) { + printk(BIOS_ERR, "%s: Missing ACPI scope\n", dev_path(device)); + return; + } +-#endif + + /* Supports up to four devices. */ + if ((CBMEM_ID_ROM0 + ngfx) > CBMEM_ID_ROM3) { +@@ -338,7 +340,7 @@ void pci_rom_ssdt(const struct device *device) + memcpy(cbrom, rom, cbrom_length); + + /* write _ROM method */ +- acpigen_write_scope("\\_SB.PCI0.RP01.PEGP"); ++ acpigen_write_scope(scope); + acpigen_write_rom(cbrom, cbrom_length); + acpigen_pop_len(); /* pop scope */ + } +diff --git a/src/ec/lenovo/h8/acpi/ec.asl b/src/ec/lenovo/h8/acpi/ec.asl +index 8f4a8e1986..0159753f86 100644 +--- a/src/ec/lenovo/h8/acpi/ec.asl ++++ b/src/ec/lenovo/h8/acpi/ec.asl +@@ -331,7 +331,9 @@ Device(EC) + #include "sleepbutton.asl" + #include "lid.asl" + #include "beep.asl" +-//#include "thermal.asl" ++#ifndef CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON ++#include "thermal.asl" ++#endif + #include "systemstatus.asl" + #include "thinkpad.asl" + } +diff --git a/src/ec/lenovo/h8/bluetooth.c b/src/ec/lenovo/h8/bluetooth.c +index be71a24ced..94dd52d87e 100644 +--- a/src/ec/lenovo/h8/bluetooth.c ++++ b/src/ec/lenovo/h8/bluetooth.c +@@ -1,6 +1,7 @@ + /* SPDX-License-Identifier: GPL-2.0-only */ +- +-// #include ++#ifndef CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON ++#include ++#endif + #include + #include + #include +@@ -26,23 +27,27 @@ void h8_bluetooth_enable(int on) + */ + bool h8_has_bdc(const struct device *dev) + { ++ #ifdef CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON ++ printk(BIOS_INFO, "H8: BDC detection not implemented. " ++ "Assuming BDC installed\n"); ++ return true; ++ #else + struct ec_lenovo_h8_config *conf = dev->chip_info; + +- if (1 || !conf->has_bdc_detection) { ++ if (!conf->has_bdc_detection) { + printk(BIOS_INFO, "H8: BDC detection not implemented. " + "Assuming BDC installed\n"); + return true; + } + +-#if 0 + if (get_gpio(conf->bdc_gpio_num) == conf->bdc_gpio_lvl) { + printk(BIOS_INFO, "H8: BDC installed\n"); + return true; + } +-#endif + + printk(BIOS_INFO, "H8: BDC not installed\n"); + return false; ++ #endif + } + + /* +diff --git a/src/ec/lenovo/h8/wwan.c b/src/ec/lenovo/h8/wwan.c +index 5cdcf77406..183e1a2cf9 100644 +--- a/src/ec/lenovo/h8/wwan.c ++++ b/src/ec/lenovo/h8/wwan.c +@@ -1,6 +1,8 @@ + /* SPDX-License-Identifier: GPL-2.0-only */ + +-// #include ++#ifndef CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON ++#include ++#endif + #include + #include + #include +@@ -24,23 +26,27 @@ void h8_wwan_enable(int on) + */ + bool h8_has_wwan(const struct device *dev) + { ++ #ifdef CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON ++ printk(BIOS_INFO, "H8: WWAN detection not implemented. " ++ "Assuming WWAN installed\n"); ++ return true; ++ #else + struct ec_lenovo_h8_config *conf = dev->chip_info; + +- if (1 || !conf->has_wwan_detection) { ++ if (!conf->has_wwan_detection) { + printk(BIOS_INFO, "H8: WWAN detection not implemented. " + "Assuming WWAN installed\n"); + return true; + } + +-#if 0 + if (get_gpio(conf->wwan_gpio_num) == conf->wwan_gpio_lvl) { + printk(BIOS_INFO, "H8: WWAN installed\n"); + return true; + } +-#endif + + printk(BIOS_INFO, "H8: WWAN not installed\n"); + return false; ++ #endif + } + + /* +-- +2.39.5 + From bb120b14ae2ad0b4246b8153c7f18022d63ab550 Mon Sep 17 00:00:00 2001 From: gaspar-ilom Date: Fri, 7 Mar 2025 17:28:43 +0100 Subject: [PATCH 2/4] Revert "t480: move to unmaintained, remove t480 from circleci. Upstream will need to fix thermal codepath: as of now its either other thinkpads or t480. Not good" With 3466272a69f1345340f5eeda05a5dd338883f8eb T480 thermal codepath does not break other boards anymore. We move it back to circleci and maintained. This reverts commit 730fdd1b25384bacc8e491c543709f5967651ffb. Signed-off-by: gaspar-ilom --- .circleci/config.yml | 64 +++++++++---------- .../t480-hotp-maximized.config | 0 .../t480-maximized/t480-maximized.config | 2 +- 3 files changed, 33 insertions(+), 33 deletions(-) rename unmaintained_boards/UNMAINTAINED_t480-hotp-maximized/UNMAINTAINED_t480-hotp-maximized.config => boards/t480-hotp-maximized/t480-hotp-maximized.config (100%) rename unmaintained_boards/UNMAINTAINED_t480-maximized/UNMAINTAINED_t480-maximized.config => boards/t480-maximized/t480-maximized.config (97%) diff --git a/.circleci/config.yml b/.circleci/config.yml index a95a16b90..a3cf6c991 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -250,10 +250,10 @@ workflows: requires: - novacustom-nv4x_adl - # x230 is based on 24.12 coreboot release here + # t480 is based on 24.12 coreboot release, not sharing any buildstack from now, depend on muscl-cross cache - build_and_persist: - name: x230-hotp-maximized - target: x230-hotp-maximized + name: t480-hotp-maximized + target: t480-hotp-maximized subcommand: "" requires: - x86-musl-cross-make @@ -280,7 +280,7 @@ workflows: - save_cache: requires: - UNTESTED_talos-2 - - x230-hotp-maximized + - t480-hotp-maximized # Those onboarding new boards should add their entries below. # coreboot 24.12 boards @@ -289,49 +289,49 @@ workflows: target: x220-hotp-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: x220-maximized target: x220-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: t420-hotp-maximized target: t420-hotp-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: t420-maximized target: t420-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: x230-hotp-maximized_usb-kb target: x230-hotp-maximized_usb-kb subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: t430-hotp-maximized target: t430-hotp-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: x230-maximized target: x230-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized #TODO: move away of 24.02.01 coreboot and depend on optiplex specific dasharo commit - build: @@ -339,126 +339,126 @@ workflows: target: optiplex-7010_9010-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: optiplex-7010_9010-hotp-maximized target: optiplex-7010_9010-hotp-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: optiplex-7010_9010_TXT-maximized target: optiplex-7010_9010_TXT-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: optiplex-7010_9010_TXT-hotp-maximized target: optiplex-7010_9010_TXT-hotp-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: x230-maximized-fhd_edp target: x230-maximized-fhd_edp subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: x230-hotp-maximized-fhd_edp target: x230-hotp-maximized-fhd_edp subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: w530-hotp-maximized target: w530-hotp-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: t430-maximized target: t430-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: w530-maximized target: w530-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: t530-maximized target: t530-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: t530-hotp-maximized target: t530-hotp-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: UNTESTED_t440p-maximized target: UNTESTED_t440p-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: UNTESTED_t440p-hotp-maximized target: UNTESTED_t440p-hotp-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: UNTESTED_w541-maximized target: UNTESTED_w541-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: UNTESTED_w541-hotp-maximized target: UNTESTED_w541-hotp-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: qemu-coreboot-fbwhiptail-tpm2-hotp target: qemu-coreboot-fbwhiptail-tpm2-hotp subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: z220-cmt-maximized target: z220-cmt-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized - build: name: z220-cmt-hotp-maximized target: z220-cmt-hotp-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized # coreboot purism # librem boards @@ -513,11 +513,11 @@ workflows: # t480 is based on 24.12 coreboot release, not sharing any buildstack from now, depend on muscl-cross cache - build: - name: UNMAINTAINED_t480-maximized - target: UNMAINTAINED_t480-maximized + name: t480-maximized + target: t480-maximized subcommand: "" requires: - - x230-hotp-maximized + - t480-hotp-maximized # dasharo release, share 24.02.01 utils/crossgcc - build: diff --git a/unmaintained_boards/UNMAINTAINED_t480-hotp-maximized/UNMAINTAINED_t480-hotp-maximized.config b/boards/t480-hotp-maximized/t480-hotp-maximized.config similarity index 100% rename from unmaintained_boards/UNMAINTAINED_t480-hotp-maximized/UNMAINTAINED_t480-hotp-maximized.config rename to boards/t480-hotp-maximized/t480-hotp-maximized.config diff --git a/unmaintained_boards/UNMAINTAINED_t480-maximized/UNMAINTAINED_t480-maximized.config b/boards/t480-maximized/t480-maximized.config similarity index 97% rename from unmaintained_boards/UNMAINTAINED_t480-maximized/UNMAINTAINED_t480-maximized.config rename to boards/t480-maximized/t480-maximized.config index 984fd805f..92fcacd87 100644 --- a/unmaintained_boards/UNMAINTAINED_t480-maximized/UNMAINTAINED_t480-maximized.config +++ b/boards/t480-maximized/t480-maximized.config @@ -23,7 +23,7 @@ export CONFIG_COREBOOT=y export CONFIG_COREBOOT_VERSION=24.12 export CONFIG_LINUX_VERSION=6.1.8 -CONFIG_COREBOOT_CONFIG=config/coreboot-UNMAINTAINED_t480-maximized.config +CONFIG_COREBOOT_CONFIG=config/coreboot-t480-maximized.config CONFIG_LINUX_CONFIG=config/linux-t480.config #On-demand hardware support (modules.cpio) From dc207ea8f2ba2b49cd2504e9cbe960c8d25489d7 Mon Sep 17 00:00:00 2001 From: gaspar-ilom Date: Fri, 7 Mar 2025 19:55:54 +0100 Subject: [PATCH 3/4] Revert "patches/coreboot-24.12/0003-mb-lenovo-Add-ThinkPad-T480-and-ThinkPad-T480s.patch: do not comment inclusion of thermal.asl" Not necessary anymore as properly fixed by coreboot patch 0004 in 3466272a69f1345340f5eeda05a5dd338883f8eb This reverts commit aa2b15dd055b3db18e0e60bf4a008d3e6b95c270. Signed-off-by: gaspar-ilom --- ...enovo-Add-ThinkPad-T480-and-ThinkPad-T480s.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/patches/coreboot-24.12/0003-mb-lenovo-Add-ThinkPad-T480-and-ThinkPad-T480s.patch b/patches/coreboot-24.12/0003-mb-lenovo-Add-ThinkPad-T480-and-ThinkPad-T480s.patch index c5b8acfd5..108f688db 100644 --- a/patches/coreboot-24.12/0003-mb-lenovo-Add-ThinkPad-T480-and-ThinkPad-T480s.patch +++ b/patches/coreboot-24.12/0003-mb-lenovo-Add-ThinkPad-T480-and-ThinkPad-T480s.patch @@ -143,6 +143,19 @@ index d60720eb49..cc6b9b068a 100644 acpigen_write_rom(cbrom, cbrom_length); acpigen_pop_len(); /* pop scope */ } +diff --git a/src/ec/lenovo/h8/acpi/ec.asl b/src/ec/lenovo/h8/acpi/ec.asl +index bc54d3b422..8f4a8e1986 100644 +--- a/src/ec/lenovo/h8/acpi/ec.asl ++++ b/src/ec/lenovo/h8/acpi/ec.asl +@@ -331,7 +331,7 @@ Device(EC) + #include "sleepbutton.asl" + #include "lid.asl" + #include "beep.asl" +-#include "thermal.asl" ++//#include "thermal.asl" + #include "systemstatus.asl" + #include "thinkpad.asl" + } diff --git a/src/ec/lenovo/h8/bluetooth.c b/src/ec/lenovo/h8/bluetooth.c index 16fc8dce39..be71a24ced 100644 --- a/src/ec/lenovo/h8/bluetooth.c From f76558601576409c2bb0fc49f0a119a97d8506fe Mon Sep 17 00:00:00 2001 From: gaspar-ilom Date: Sat, 8 Mar 2025 00:59:00 +0100 Subject: [PATCH 4/4] fix preprocessor checks Signed-off-by: gaspar-ilom --- ...lding-other-thinkpads-with-the-hacks.patch | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/patches/coreboot-24.12/0004-do-not-break-building-other-thinkpads-with-the-hacks.patch b/patches/coreboot-24.12/0004-do-not-break-building-other-thinkpads-with-the-hacks.patch index a1fa08e11..81517093a 100644 --- a/patches/coreboot-24.12/0004-do-not-break-building-other-thinkpads-with-the-hacks.patch +++ b/patches/coreboot-24.12/0004-do-not-break-building-other-thinkpads-with-the-hacks.patch @@ -1,4 +1,4 @@ -From efc90be24c861f5f83309006e7fdbf3e3504534f Mon Sep 17 00:00:00 2001 +From d2188ab8134a6a9c67e64dda643b770221dba648 Mon Sep 17 00:00:00 2001 From: gaspar-ilom Date: Thu, 6 Mar 2025 23:00:00 +0000 Subject: [PATCH] do not break building other thinkpads with the hacks for the @@ -17,7 +17,7 @@ Signed-off-by: gaspar-ilom 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c -index cc6b9b068a..f47300faaa 100644 +index cc6b9b068a..7d4b52ba30 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -304,13 +304,15 @@ void pci_rom_ssdt(const struct device *device) @@ -25,7 +25,7 @@ index cc6b9b068a..f47300faaa 100644 } -#if 0 -+ #ifdef CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON ++ #if CONFIG(BOARD_LENOVO_SKLKBL_THINKPAD_COMMON) + const char *scope = "\\_SB.PCI0.RP01.PEGP"; + #else const char *scope = acpi_device_path(device); @@ -48,7 +48,7 @@ index cc6b9b068a..f47300faaa 100644 acpigen_pop_len(); /* pop scope */ } diff --git a/src/ec/lenovo/h8/acpi/ec.asl b/src/ec/lenovo/h8/acpi/ec.asl -index 8f4a8e1986..0159753f86 100644 +index 8f4a8e1986..f80c15106c 100644 --- a/src/ec/lenovo/h8/acpi/ec.asl +++ b/src/ec/lenovo/h8/acpi/ec.asl @@ -331,7 +331,9 @@ Device(EC) @@ -56,21 +56,21 @@ index 8f4a8e1986..0159753f86 100644 #include "lid.asl" #include "beep.asl" -//#include "thermal.asl" -+#ifndef CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON ++#if !CONFIG(BOARD_LENOVO_SKLKBL_THINKPAD_COMMON) +#include "thermal.asl" +#endif #include "systemstatus.asl" #include "thinkpad.asl" } diff --git a/src/ec/lenovo/h8/bluetooth.c b/src/ec/lenovo/h8/bluetooth.c -index be71a24ced..94dd52d87e 100644 +index be71a24ced..0b729bd819 100644 --- a/src/ec/lenovo/h8/bluetooth.c +++ b/src/ec/lenovo/h8/bluetooth.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ - -// #include -+#ifndef CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON ++#if !CONFIG(BOARD_LENOVO_SKLKBL_THINKPAD_COMMON) +#include +#endif #include @@ -80,7 +80,7 @@ index be71a24ced..94dd52d87e 100644 */ bool h8_has_bdc(const struct device *dev) { -+ #ifdef CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON ++ #if CONFIG(BOARD_LENOVO_SKLKBL_THINKPAD_COMMON) + printk(BIOS_INFO, "H8: BDC detection not implemented. " + "Assuming BDC installed\n"); + return true; @@ -108,14 +108,14 @@ index be71a24ced..94dd52d87e 100644 /* diff --git a/src/ec/lenovo/h8/wwan.c b/src/ec/lenovo/h8/wwan.c -index 5cdcf77406..183e1a2cf9 100644 +index 5cdcf77406..0a62583c56 100644 --- a/src/ec/lenovo/h8/wwan.c +++ b/src/ec/lenovo/h8/wwan.c @@ -1,6 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -// #include -+#ifndef CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON ++#if !CONFIG(BOARD_LENOVO_SKLKBL_THINKPAD_COMMON) +#include +#endif #include @@ -125,7 +125,7 @@ index 5cdcf77406..183e1a2cf9 100644 */ bool h8_has_wwan(const struct device *dev) { -+ #ifdef CONFIG_BOARD_LENOVO_SKLKBL_THINKPAD_COMMON ++ #if CONFIG(BOARD_LENOVO_SKLKBL_THINKPAD_COMMON) + printk(BIOS_INFO, "H8: WWAN detection not implemented. " + "Assuming WWAN installed\n"); + return true;