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 <persmule@hardenedlinux.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36385
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Bill XIE 2019-10-28 00:16:05 +08:00 committed by Patrick Georgi
parent 9764bc126e
commit 72f13e534b
29 changed files with 15 additions and 91 deletions

View File

@ -44,7 +44,4 @@ config H8_HAS_PRIMARY_FN_KEYS
bool
default n
endif
config H8_DOCK_EARLY_INIT
bool
endif # EC_LENOVO_H8

View File

@ -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 = {

View File

@ -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);

View File

@ -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,
};

View File

@ -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

View File

@ -22,7 +22,7 @@
#include <ec/lenovo/h8/h8.h>
#include <ec/acpi/ec.h>
void h8_mainboard_init_dock(void)
void init_dock(void)
{
if (dock_present()) {
printk(BIOS_DEBUG, "dock is connected\n");

View File

@ -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);

View File

@ -19,12 +19,14 @@
#include <device/device.h>
#include <arch/acpi.h>
#include <drivers/intel/gma/int15.h>
#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 = {

View File

@ -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,
};

View File

@ -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,
};

View File

@ -17,10 +17,6 @@
#include <drivers/intel/gma/int15.h>
#include <ec/lenovo/h8/h8.h>
void h8_mainboard_init_dock (void)
{
}
static void mainboard_enable(struct device *dev)
{
install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS,

View File

@ -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,
};

View File

@ -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,
};

View File

@ -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,
};

View File

@ -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,
};

View File

@ -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

View File

@ -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,
};

View File

@ -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)
{
}

View File

@ -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

View File

@ -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);

View File

@ -16,6 +16,7 @@
#include <device/device.h>
#include <drivers/intel/gma/int15.h>
#include <drivers/lenovo/lenovo.h>
#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 = {

View File

@ -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");

View File

@ -1,22 +0,0 @@
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2011 Sven Schnelle <svens@stackframe.org>
* Copyright (C) 2013 Vladimir Serbinenko <phcoder@gmail.com>
*
* 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 <ec/lenovo/h8/h8.h>
void h8_mainboard_init_dock(void)
{
}

View File

@ -22,7 +22,7 @@
#include <ec/lenovo/h8/h8.h>
#include <ec/acpi/ec.h>
void h8_mainboard_init_dock(void)
void init_dock(void)
{
if (dock_present()) {
printk(BIOS_DEBUG, "dock is connected\n");

View File

@ -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);

View File

@ -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 = {

View File

@ -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,
};

View File

@ -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,
};

View File

@ -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