From 72f13e534bed0be4a3bc0999dc2fe772c322114f Mon Sep 17 00:00:00 2001 From: Bill XIE Date: Mon, 28 Oct 2019 00:16:05 +0800 Subject: [PATCH] ec/lenovo/h8: Make dock init in ramstage fully mainboard-specific Discussed in CB:36093, in the past many lenovo boards need to declare an empty h8_mainboard_init_dock() to satisfy h8.c. Now the confusing H8_DOCK_EARLY_INIT might be retired, and if a mainboard needs dock init (done with h8_mainboard_init_dock() in the past) in ramstage, (discussed in CB:4294 where H8_DOCK_EARLY_INIT is introduced) it can just do it in its own chip_ops.enable_dev function. Tested on X200. Testing on other affected targets may be necessary. Change-Id: I5737406d1f6cb6e91b2e2fa349a206a3dba988d1 Signed-off-by: Bill XIE Reviewed-on: https://review.coreboot.org/c/coreboot/+/36385 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans --- src/ec/lenovo/h8/Kconfig | 5 +---- src/ec/lenovo/h8/h8.c | 4 ---- src/ec/lenovo/h8/h8.h | 2 -- src/mainboard/lenovo/l520/mainboard.c | 4 ---- src/mainboard/lenovo/t400/Kconfig | 1 - src/mainboard/lenovo/t410/dock.c | 2 +- src/mainboard/lenovo/t410/dock.h | 2 +- src/mainboard/lenovo/t410/mainboard.c | 2 ++ src/mainboard/lenovo/t420/mainboard.c | 4 ---- src/mainboard/lenovo/t420s/mainboard.c | 4 ---- src/mainboard/lenovo/t430/mainboard.c | 4 ---- src/mainboard/lenovo/t430s/mainboard.c | 4 ---- src/mainboard/lenovo/t440p/mainboard.c | 4 ---- src/mainboard/lenovo/t520/mainboard.c | 4 ---- src/mainboard/lenovo/t530/mainboard.c | 4 ---- src/mainboard/lenovo/t60/Kconfig | 1 - src/mainboard/lenovo/x131e/mainboard.c | 4 ---- .../lenovo/x1_carbon_gen1/mainboard.c | 5 ----- src/mainboard/lenovo/x200/Makefile.inc | 2 +- src/mainboard/lenovo/x200/dock.h | 2 +- src/mainboard/lenovo/x200/mainboard.c | 3 +++ .../lenovo/x200/variants/x200/dock.c | 2 +- .../lenovo/x200/variants/x301/dock.c | 22 ------------------- src/mainboard/lenovo/x201/dock.c | 2 +- src/mainboard/lenovo/x201/dock.h | 2 +- src/mainboard/lenovo/x201/mainboard.c | 2 ++ src/mainboard/lenovo/x220/mainboard.c | 4 ---- src/mainboard/lenovo/x230/mainboard.c | 4 ---- src/mainboard/lenovo/x60/Kconfig | 1 - 29 files changed, 15 insertions(+), 91 deletions(-) delete mode 100644 src/mainboard/lenovo/x200/variants/x301/dock.c diff --git a/src/ec/lenovo/h8/Kconfig b/src/ec/lenovo/h8/Kconfig index f3df56a6c5..6bd290f50e 100644 --- a/src/ec/lenovo/h8/Kconfig +++ b/src/ec/lenovo/h8/Kconfig @@ -44,7 +44,4 @@ config H8_HAS_PRIMARY_FN_KEYS bool default n -endif - -config H8_DOCK_EARLY_INIT - bool +endif # EC_LENOVO_H8 diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c index 3a99b52dd8..93a771c47d 100644 --- a/src/ec/lenovo/h8/h8.c +++ b/src/ec/lenovo/h8/h8.c @@ -353,10 +353,6 @@ static void h8_enable(struct device *dev) h8_charge_priority(val); h8_set_audio_mute(0); - -#if !CONFIG(H8_DOCK_EARLY_INIT) - h8_mainboard_init_dock(); -#endif } struct chip_operations ec_lenovo_h8_ops = { diff --git a/src/ec/lenovo/h8/h8.h b/src/ec/lenovo/h8/h8.h index 14948c55ce..6dad2889ad 100644 --- a/src/ec/lenovo/h8/h8.h +++ b/src/ec/lenovo/h8/h8.h @@ -36,8 +36,6 @@ int h8_ultrabay_device_present(void); u8 h8_build_id_and_function_spec_version(char *buf, u8 buf_len); void h8_usb_always_on(void); -void h8_mainboard_init_dock (void); - int h8_get_fn_key(void); int h8_get_sense_ready(void); diff --git a/src/mainboard/lenovo/l520/mainboard.c b/src/mainboard/lenovo/l520/mainboard.c index db695b1b4a..88c7884f28 100644 --- a/src/mainboard/lenovo/l520/mainboard.c +++ b/src/mainboard/lenovo/l520/mainboard.c @@ -26,10 +26,6 @@ static void mainboard_enable(struct device *dev) GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); } -void h8_mainboard_init_dock(void) -{ -} - struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, }; diff --git a/src/mainboard/lenovo/t400/Kconfig b/src/mainboard/lenovo/t400/Kconfig index 8d286c442b..a68d1fa13e 100644 --- a/src/mainboard/lenovo/t400/Kconfig +++ b/src/mainboard/lenovo/t400/Kconfig @@ -10,7 +10,6 @@ config BOARD_SPECIFIC_OPTIONS select EC_LENOVO_PMH7 select EC_LENOVO_H8 select H8_HAS_BAT_TRESHOLDS_IMPL - select H8_DOCK_EARLY_INIT select BOARD_ROMSIZE_KB_8192 if !BOARD_LENOVO_R500 select BOARD_ROMSIZE_KB_4096 if BOARD_LENOVO_R500 select DRIVERS_GENERIC_IOAPIC diff --git a/src/mainboard/lenovo/t410/dock.c b/src/mainboard/lenovo/t410/dock.c index 317fb0513c..1575aa1906 100644 --- a/src/mainboard/lenovo/t410/dock.c +++ b/src/mainboard/lenovo/t410/dock.c @@ -22,7 +22,7 @@ #include #include -void h8_mainboard_init_dock(void) +void init_dock(void) { if (dock_present()) { printk(BIOS_DEBUG, "dock is connected\n"); diff --git a/src/mainboard/lenovo/t410/dock.h b/src/mainboard/lenovo/t410/dock.h index 4cd8c857a8..6a08d81836 100644 --- a/src/mainboard/lenovo/t410/dock.h +++ b/src/mainboard/lenovo/t410/dock.h @@ -15,7 +15,7 @@ #ifndef THINKPAD_X201_DOCK_H #define THINKPAD_X201_DOCK_H - +void init_dock(void); void dock_connect(void); void dock_disconnect(void); int dock_present(void); diff --git a/src/mainboard/lenovo/t410/mainboard.c b/src/mainboard/lenovo/t410/mainboard.c index 23b68fabc2..8b6a737e0e 100644 --- a/src/mainboard/lenovo/t410/mainboard.c +++ b/src/mainboard/lenovo/t410/mainboard.c @@ -19,12 +19,14 @@ #include #include #include +#include "dock.h" static void mainboard_enable(struct device *dev) { install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_LFP, 2); + init_dock(); } struct chip_operations mainboard_ops = { diff --git a/src/mainboard/lenovo/t420/mainboard.c b/src/mainboard/lenovo/t420/mainboard.c index 6c85abad29..bc6dcb17dc 100644 --- a/src/mainboard/lenovo/t420/mainboard.c +++ b/src/mainboard/lenovo/t420/mainboard.c @@ -26,10 +26,6 @@ static void mainboard_enable(struct device *dev) GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); } -void h8_mainboard_init_dock(void) -{ -} - struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, }; diff --git a/src/mainboard/lenovo/t420s/mainboard.c b/src/mainboard/lenovo/t420s/mainboard.c index 6c85abad29..bc6dcb17dc 100644 --- a/src/mainboard/lenovo/t420s/mainboard.c +++ b/src/mainboard/lenovo/t420s/mainboard.c @@ -26,10 +26,6 @@ static void mainboard_enable(struct device *dev) GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); } -void h8_mainboard_init_dock(void) -{ -} - struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, }; diff --git a/src/mainboard/lenovo/t430/mainboard.c b/src/mainboard/lenovo/t430/mainboard.c index 99a5bd8536..a86a90e553 100644 --- a/src/mainboard/lenovo/t430/mainboard.c +++ b/src/mainboard/lenovo/t430/mainboard.c @@ -17,10 +17,6 @@ #include #include -void h8_mainboard_init_dock (void) -{ -} - static void mainboard_enable(struct device *dev) { install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, diff --git a/src/mainboard/lenovo/t430s/mainboard.c b/src/mainboard/lenovo/t430s/mainboard.c index 6c85abad29..bc6dcb17dc 100644 --- a/src/mainboard/lenovo/t430s/mainboard.c +++ b/src/mainboard/lenovo/t430s/mainboard.c @@ -26,10 +26,6 @@ static void mainboard_enable(struct device *dev) GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); } -void h8_mainboard_init_dock(void) -{ -} - struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, }; diff --git a/src/mainboard/lenovo/t440p/mainboard.c b/src/mainboard/lenovo/t440p/mainboard.c index dcfd5038fd..0881c2dda6 100644 --- a/src/mainboard/lenovo/t440p/mainboard.c +++ b/src/mainboard/lenovo/t440p/mainboard.c @@ -25,10 +25,6 @@ static void mainboard_enable(struct device *dev) GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); } -void h8_mainboard_init_dock(void) -{ -} - struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, }; diff --git a/src/mainboard/lenovo/t520/mainboard.c b/src/mainboard/lenovo/t520/mainboard.c index bd4292a851..6825b6b29f 100644 --- a/src/mainboard/lenovo/t520/mainboard.c +++ b/src/mainboard/lenovo/t520/mainboard.c @@ -28,10 +28,6 @@ static void mainboard_enable(struct device *dev) GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); } -void h8_mainboard_init_dock (void) -{ -} - struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, }; diff --git a/src/mainboard/lenovo/t530/mainboard.c b/src/mainboard/lenovo/t530/mainboard.c index 29c15e0f5a..144fde7f2e 100644 --- a/src/mainboard/lenovo/t530/mainboard.c +++ b/src/mainboard/lenovo/t530/mainboard.c @@ -29,10 +29,6 @@ static void mainboard_enable(struct device *dev) GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); } -void h8_mainboard_init_dock (void) -{ -} - struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, }; diff --git a/src/mainboard/lenovo/t60/Kconfig b/src/mainboard/lenovo/t60/Kconfig index bc8fa293b2..436b035a1e 100644 --- a/src/mainboard/lenovo/t60/Kconfig +++ b/src/mainboard/lenovo/t60/Kconfig @@ -19,7 +19,6 @@ config BOARD_SPECIFIC_OPTIONS select BOARD_ROMSIZE_KB_2048 select HAVE_ACPI_TABLES select HAVE_ACPI_RESUME - select H8_DOCK_EARLY_INIT select HAVE_CMOS_DEFAULT select I945_LVDS select INTEL_GMA_HAVE_VBT diff --git a/src/mainboard/lenovo/x131e/mainboard.c b/src/mainboard/lenovo/x131e/mainboard.c index 1342aca9bc..50b4de1ee2 100644 --- a/src/mainboard/lenovo/x131e/mainboard.c +++ b/src/mainboard/lenovo/x131e/mainboard.c @@ -24,10 +24,6 @@ static void mainboard_enable(struct device *dev) GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); } -void h8_mainboard_init_dock(void) -{ -} - struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, }; diff --git a/src/mainboard/lenovo/x1_carbon_gen1/mainboard.c b/src/mainboard/lenovo/x1_carbon_gen1/mainboard.c index 64cc15b6fe..bc6dcb17dc 100644 --- a/src/mainboard/lenovo/x1_carbon_gen1/mainboard.c +++ b/src/mainboard/lenovo/x1_carbon_gen1/mainboard.c @@ -29,8 +29,3 @@ static void mainboard_enable(struct device *dev) struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, }; - -/* TODO: this device doesnt have a dock */ -void h8_mainboard_init_dock (void) -{ -} diff --git a/src/mainboard/lenovo/x200/Makefile.inc b/src/mainboard/lenovo/x200/Makefile.inc index f6c2c0c074..7e38a78b4c 100644 --- a/src/mainboard/lenovo/x200/Makefile.inc +++ b/src/mainboard/lenovo/x200/Makefile.inc @@ -13,7 +13,7 @@ ## GNU General Public License for more details. ## -ramstage-y += variants/$(VARIANT_DIR)/dock.c +ramstage-$(CONFIG_BOARD_LENOVO_X200) += variants/$(VARIANT_DIR)/dock.c ramstage-y += cstates.c ramstage-y += blc.c romstage-y += variants/$(VARIANT_DIR)/gpio.c diff --git a/src/mainboard/lenovo/x200/dock.h b/src/mainboard/lenovo/x200/dock.h index 56f3fe0f7a..a129cd04a3 100644 --- a/src/mainboard/lenovo/x200/dock.h +++ b/src/mainboard/lenovo/x200/dock.h @@ -15,7 +15,7 @@ #ifndef THINKPAD_X200_DOCK_H #define THINKPAD_X200_DOCK_H - +void init_dock(void); void dock_connect(void); void dock_disconnect(void); int dock_present(void); diff --git a/src/mainboard/lenovo/x200/mainboard.c b/src/mainboard/lenovo/x200/mainboard.c index 1510ab7b17..37fe865e81 100644 --- a/src/mainboard/lenovo/x200/mainboard.c +++ b/src/mainboard/lenovo/x200/mainboard.c @@ -16,6 +16,7 @@ #include #include #include +#include "dock.h" static void fill_ssdt(struct device *device) { @@ -29,6 +30,8 @@ static void mainboard_enable(struct device *dev) GMA_INT15_BOOT_DISPLAY_DEFAULT, 2); dev->ops->acpi_fill_ssdt_generator = fill_ssdt; + if (CONFIG(BOARD_LENOVO_X200)) + init_dock(); } struct chip_operations mainboard_ops = { diff --git a/src/mainboard/lenovo/x200/variants/x200/dock.c b/src/mainboard/lenovo/x200/variants/x200/dock.c index bdd65a564a..8aa39bbd6e 100644 --- a/src/mainboard/lenovo/x200/variants/x200/dock.c +++ b/src/mainboard/lenovo/x200/variants/x200/dock.c @@ -23,7 +23,7 @@ #include "../../dock.h" -void h8_mainboard_init_dock(void) +void init_dock(void) { if (dock_present()) { printk(BIOS_DEBUG, "dock is connected\n"); diff --git a/src/mainboard/lenovo/x200/variants/x301/dock.c b/src/mainboard/lenovo/x200/variants/x301/dock.c deleted file mode 100644 index f8a2dc4260..0000000000 --- a/src/mainboard/lenovo/x200/variants/x301/dock.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2011 Sven Schnelle - * Copyright (C) 2013 Vladimir Serbinenko - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; version 2 of - * the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include - -void h8_mainboard_init_dock(void) -{ -} diff --git a/src/mainboard/lenovo/x201/dock.c b/src/mainboard/lenovo/x201/dock.c index 652a144104..58510ced89 100644 --- a/src/mainboard/lenovo/x201/dock.c +++ b/src/mainboard/lenovo/x201/dock.c @@ -22,7 +22,7 @@ #include #include -void h8_mainboard_init_dock(void) +void init_dock(void) { if (dock_present()) { printk(BIOS_DEBUG, "dock is connected\n"); diff --git a/src/mainboard/lenovo/x201/dock.h b/src/mainboard/lenovo/x201/dock.h index 4cd8c857a8..6a08d81836 100644 --- a/src/mainboard/lenovo/x201/dock.h +++ b/src/mainboard/lenovo/x201/dock.h @@ -15,7 +15,7 @@ #ifndef THINKPAD_X201_DOCK_H #define THINKPAD_X201_DOCK_H - +void init_dock(void); void dock_connect(void); void dock_disconnect(void); int dock_present(void); diff --git a/src/mainboard/lenovo/x201/mainboard.c b/src/mainboard/lenovo/x201/mainboard.c index c021db185c..a403237e27 100644 --- a/src/mainboard/lenovo/x201/mainboard.c +++ b/src/mainboard/lenovo/x201/mainboard.c @@ -42,6 +42,8 @@ static void mainboard_enable(struct device *dev) install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_LFP, 2); + + init_dock(); } struct chip_operations mainboard_ops = { diff --git a/src/mainboard/lenovo/x220/mainboard.c b/src/mainboard/lenovo/x220/mainboard.c index 29c15e0f5a..144fde7f2e 100644 --- a/src/mainboard/lenovo/x220/mainboard.c +++ b/src/mainboard/lenovo/x220/mainboard.c @@ -29,10 +29,6 @@ static void mainboard_enable(struct device *dev) GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); } -void h8_mainboard_init_dock (void) -{ -} - struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, }; diff --git a/src/mainboard/lenovo/x230/mainboard.c b/src/mainboard/lenovo/x230/mainboard.c index 29c15e0f5a..144fde7f2e 100644 --- a/src/mainboard/lenovo/x230/mainboard.c +++ b/src/mainboard/lenovo/x230/mainboard.c @@ -29,10 +29,6 @@ static void mainboard_enable(struct device *dev) GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); } -void h8_mainboard_init_dock (void) -{ -} - struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, }; diff --git a/src/mainboard/lenovo/x60/Kconfig b/src/mainboard/lenovo/x60/Kconfig index e3aabf3485..a1a5fec7c0 100644 --- a/src/mainboard/lenovo/x60/Kconfig +++ b/src/mainboard/lenovo/x60/Kconfig @@ -22,7 +22,6 @@ config BOARD_SPECIFIC_OPTIONS select HAVE_ACPI_TABLES select HAVE_ACPI_RESUME select USE_OPTION_TABLE - select H8_DOCK_EARLY_INIT select DRIVERS_LENOVO_WACOM select I945_LVDS select INTEL_GMA_HAVE_VBT