summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2021-04-09 12:15:21 -0600
committerPatrick Georgi <pgeorgi@google.com>2021-04-13 08:22:49 +0000
commit7f7c3882a6ac776ba215551a3c5cd9a7379933b5 (patch)
tree49e5a36cecd0a05a34a2600102156f7381195472
parent24ea3f3364711f352a8a174e6fc0f22885725ed5 (diff)
downloadcoreboot-7f7c3882a6ac776ba215551a3c5cd9a7379933b5.tar.gz
coreboot-7f7c3882a6ac776ba215551a3c5cd9a7379933b5.tar.bz2
coreboot-7f7c3882a6ac776ba215551a3c5cd9a7379933b5.zip
dptf: Move platform-specific information to `struct dptf_platform_info`
DPTF HIDs are different per-platform going forward, so refactor these into SoC-specific structures which the DPTF driver can query at runtime for platform-specific information. Change-Id: I6307f9d28f4274b851323ad69180ff4ae35053da Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52220 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Sumeet R Pawnikar <sumeet.r.pawnikar@intel.com>
-rw-r--r--src/drivers/intel/dptf/Kconfig10
-rw-r--r--src/drivers/intel/dptf/dptf.c61
-rw-r--r--src/drivers/intel/dptf/dptf.h21
-rw-r--r--src/mainboard/google/dedede/Kconfig1
-rw-r--r--src/mainboard/google/hatch/Kconfig1
-rw-r--r--src/mainboard/intel/jasperlake_rvp/Kconfig1
-rw-r--r--src/soc/intel/cannonlake/Makefile.inc1
-rw-r--r--src/soc/intel/cannonlake/dptf.c18
-rw-r--r--src/soc/intel/jasperlake/Makefile.inc1
-rw-r--r--src/soc/intel/jasperlake/dptf.c18
-rw-r--r--src/soc/intel/tigerlake/Makefile.inc1
-rw-r--r--src/soc/intel/tigerlake/dptf.c18
12 files changed, 107 insertions, 45 deletions
diff --git a/src/drivers/intel/dptf/Kconfig b/src/drivers/intel/dptf/Kconfig
index c3af32036cf2..ebdb6509a8cd 100644
--- a/src/drivers/intel/dptf/Kconfig
+++ b/src/drivers/intel/dptf/Kconfig
@@ -5,13 +5,3 @@ config DRIVERS_INTEL_DPTF
help
When enabled, entries in the devicetree are used to generate
Intel DPTF Tables at runtime in the SSDT.
-
-config DPTF_USE_EISA_HID
- bool
- depends on DRIVERS_INTEL_DPTF
- default n
- help
- Prior to Tiger Lake, all DPTF devices used 7-character EISA
- IDs. If selected, the 7-character _HIDs will be emitted,
- otherwise, it will use the "new" style, which are regular
- 8-character _HIDs.
diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c
index 1713e7230930..7d19df596047 100644
--- a/src/drivers/intel/dptf/dptf.c
+++ b/src/drivers/intel/dptf/dptf.c
@@ -5,6 +5,7 @@
#include <console/console.h>
#include <device/device.h>
#include "chip.h"
+#include "dptf.h"
/* Generic DPTF participants have a PTYP field to distinguish them */
enum dptf_generic_participant_type {
@@ -14,14 +15,6 @@ enum dptf_generic_participant_type {
#define DEFAULT_CHARGER_STR "Battery Charger"
-#define DPTF_DEVICE_HID_EISAID "INT3400"
-#define GENERIC_HID_EISAID "INT3403"
-#define FAN_HID_EISAID "INT3404"
-
-#define DPTF_DEVICE_HID "INTC1040"
-#define GENERIC_HID "INTC1043"
-#define FAN_HID "INTC1044"
-
/*
* Helper method to determine if a device is "used" (called out anywhere as a source or a target
* of any policies, and therefore should be included in the ACPI tables.
@@ -67,20 +60,26 @@ static int get_STA_value(const struct drivers_intel_dptf_config *config,
ACPI_STATUS_DEVICE_ALL_OFF;
}
+static void dptf_write_hid(bool is_eisa, const char *hid)
+{
+ if (is_eisa)
+ acpigen_emit_eisaid(hid);
+ else
+ acpigen_write_string(hid);
+}
+
/* Devices with GENERIC _HID (distinguished by PTYP) */
static void dptf_write_generic_participant(const char *name,
enum dptf_generic_participant_type ptype,
- const char *str, int sta_val)
+ const char *str, int sta_val,
+ const struct dptf_platform_info *platform_info)
{
/* Auto-incrementing UID for generic participants */
static int generic_uid = 0;
acpigen_write_device(name);
acpigen_write_name("_HID");
- if (CONFIG(DPTF_USE_EISA_HID))
- acpigen_emit_eisaid(GENERIC_HID_EISAID);
- else
- acpigen_write_string(GENERIC_HID);
+ dptf_write_hid(platform_info->use_eisa_hids, platform_info->generic_hid);
acpigen_write_name_integer("_UID", generic_uid++);
acpigen_write_STA(sta_val);
@@ -107,49 +106,46 @@ static void write_tcpu(const struct device *pci_dev,
}
/* \_SB.DPTF.TFN1 */
-static void write_fan(const struct drivers_intel_dptf_config *config)
+static void write_fan(const struct drivers_intel_dptf_config *config,
+ const struct dptf_platform_info *platform_info)
{
acpigen_write_device("TFN1");
acpigen_write_name("_HID");
- if (CONFIG(DPTF_USE_EISA_HID))
- acpigen_emit_eisaid(FAN_HID_EISAID);
- else
- acpigen_write_string(FAN_HID);
-
+ dptf_write_hid(platform_info->use_eisa_hids, platform_info->fan_hid);
acpigen_write_name_integer("_UID", 0);
acpigen_write_STA(get_STA_value(config, DPTF_FAN));
acpigen_pop_len(); /* Device */
}
/* \_SB.DPTF.xxxx */
-static void write_generic_devices(const struct drivers_intel_dptf_config *config)
+static void write_generic_devices(const struct drivers_intel_dptf_config *config,
+ const struct dptf_platform_info *platform_info)
{
enum dptf_participant participant;
char name[ACPI_NAME_BUFFER_SIZE];
int i;
dptf_write_generic_participant("TCHG", DPTF_GENERIC_PARTICIPANT_TYPE_CHARGER,
- DEFAULT_CHARGER_STR, get_STA_value(config,
- DPTF_CHARGER));
+ DEFAULT_CHARGER_STR,
+ get_STA_value(config, DPTF_CHARGER),
+ platform_info);
for (i = 0, participant = DPTF_TEMP_SENSOR_0; i < 4; ++i, ++participant) {
snprintf(name, sizeof(name), "TSR%1d", i);
dptf_write_generic_participant(name, DPTF_GENERIC_PARTICIPANT_TYPE_TSR,
- NULL, get_STA_value(config, participant));
+ NULL, get_STA_value(config, participant),
+ platform_info);
}
}
/* \_SB.DPTF - note: leaves the Scope open for child devices*/
-static void write_open_dptf_device(const struct device *dev)
+static void write_open_dptf_device(const struct device *dev,
+ const struct dptf_platform_info *platform_info)
{
acpigen_write_scope("\\_SB");
acpigen_write_device(acpi_device_name(dev));
acpigen_write_name("_HID");
- if (CONFIG(DPTF_USE_EISA_HID))
- acpigen_emit_eisaid(DPTF_DEVICE_HID_EISAID);
- else
- acpigen_write_string(DPTF_DEVICE_HID);
-
+ dptf_write_hid(platform_info->use_eisa_hids, platform_info->dptf_device_hid);
acpigen_write_name_integer("_UID", 0);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
}
@@ -157,6 +153,7 @@ static void write_open_dptf_device(const struct device *dev)
/* Add minimal definitions of DPTF devices into the SSDT */
static void write_device_definitions(const struct device *dev)
{
+ const struct dptf_platform_info *platform_info = get_dptf_platform_info();
const struct drivers_intel_dptf_config *config;
struct device *parent;
@@ -170,9 +167,9 @@ static void write_device_definitions(const struct device *dev)
config = config_of(dev);
write_tcpu(parent, config);
- write_open_dptf_device(dev);
- write_fan(config);
- write_generic_devices(config);
+ write_open_dptf_device(dev, platform_info);
+ write_fan(config, platform_info);
+ write_generic_devices(config, platform_info);
acpigen_pop_len(); /* DPTF Device (write_open_dptf_device) */
acpigen_pop_len(); /* Scope */
diff --git a/src/drivers/intel/dptf/dptf.h b/src/drivers/intel/dptf/dptf.h
new file mode 100644
index 000000000000..2eeec7bc0d48
--- /dev/null
+++ b/src/drivers/intel/dptf/dptf.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _DRIVERS_INTEL_DPTF_H_
+#define _DRIVERS_INTEL_DPTF_H_
+
+#include <types.h>
+
+struct dptf_platform_info {
+ /*
+ * True indicates the platform-specific HIDs are to be emitted in EISA
+ * format instead of a string.
+ */
+ bool use_eisa_hids;
+ const char *dptf_device_hid;
+ const char *generic_hid;
+ const char *fan_hid;
+};
+
+const struct dptf_platform_info *get_dptf_platform_info(void);
+
+#endif /* _DRIVERS_INTEL_DPTF_H_ */
diff --git a/src/mainboard/google/dedede/Kconfig b/src/mainboard/google/dedede/Kconfig
index 1190e96920e8..1dca1b677185 100644
--- a/src/mainboard/google/dedede/Kconfig
+++ b/src/mainboard/google/dedede/Kconfig
@@ -1,7 +1,6 @@
config BOARD_GOOGLE_BASEBOARD_DEDEDE
def_bool n
select BOARD_ROMSIZE_KB_16384 if !BOARD_ROMSIZE_KB_32768
- select DPTF_USE_EISA_HID
select DRIVERS_GENERIC_GPIO_KEYS
select DRIVERS_I2C_GENERIC
select DRIVERS_I2C_GPIO_MUX
diff --git a/src/mainboard/google/hatch/Kconfig b/src/mainboard/google/hatch/Kconfig
index ef0e36e35d82..64cee45272f3 100644
--- a/src/mainboard/google/hatch/Kconfig
+++ b/src/mainboard/google/hatch/Kconfig
@@ -13,7 +13,6 @@ config BOARD_GOOGLE_BASEBOARD_PUFF
select SPD_READ_BY_WORD
select SOC_INTEL_CSE_LITE_SKU
select DRIVERS_INTEL_DPTF
- select DPTF_USE_EISA_HID
config BOARD_GOOGLE_HATCH_COMMON
def_bool n
diff --git a/src/mainboard/intel/jasperlake_rvp/Kconfig b/src/mainboard/intel/jasperlake_rvp/Kconfig
index 9bd2f5ef156f..26c96aa74dba 100644
--- a/src/mainboard/intel/jasperlake_rvp/Kconfig
+++ b/src/mainboard/intel/jasperlake_rvp/Kconfig
@@ -3,7 +3,6 @@ if BOARD_INTEL_JASPERLAKE_RVP || BOARD_INTEL_JASPERLAKE_RVP_EXT_EC
config BOARD_SPECIFIC_OPTIONS
def_bool y
select BOARD_ROMSIZE_KB_16384
- select DPTF_USE_EISA_HID
select DRIVERS_I2C_DA7219
select DRIVERS_I2C_HID
select DRIVERS_INTEL_DPTF
diff --git a/src/soc/intel/cannonlake/Makefile.inc b/src/soc/intel/cannonlake/Makefile.inc
index dc1bcf03e772..99a6bac2cac1 100644
--- a/src/soc/intel/cannonlake/Makefile.inc
+++ b/src/soc/intel/cannonlake/Makefile.inc
@@ -32,6 +32,7 @@ romstage-y += uart.c
ramstage-y += acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
+ramstage-y += dptf.c
ramstage-y += elog.c
ramstage-y += finalize.c
ramstage-y += fsp_params.c
diff --git a/src/soc/intel/cannonlake/dptf.c b/src/soc/intel/cannonlake/dptf.c
new file mode 100644
index 000000000000..d84285871205
--- /dev/null
+++ b/src/soc/intel/cannonlake/dptf.c
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <drivers/intel/dptf/dptf.h>
+
+static const struct dptf_platform_info cnl_dptf_platform_info = {
+ .use_eisa_hids = true,
+ /* _HID for the toplevel DPTF device, typically \_SB.DPTF */
+ .dptf_device_hid = "INT3400",
+ /* _HID for Intel DPTF Generic Device (these require PTYP as well) */
+ .generic_hid = "INT3403",
+ /* _HID for Intel DPTF Fan Device */
+ .fan_hid = "INT3404",
+};
+
+const struct dptf_platform_info *get_dptf_platform_info(void)
+{
+ return &cnl_dptf_platform_info;
+}
diff --git a/src/soc/intel/jasperlake/Makefile.inc b/src/soc/intel/jasperlake/Makefile.inc
index d570cc81d5b2..c4b5fedba9e6 100644
--- a/src/soc/intel/jasperlake/Makefile.inc
+++ b/src/soc/intel/jasperlake/Makefile.inc
@@ -30,6 +30,7 @@ romstage-y += reset.c
ramstage-y += acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
+ramstage-y += dptf.c
ramstage-y += elog.c
ramstage-y += espi.c
ramstage-y += finalize.c
diff --git a/src/soc/intel/jasperlake/dptf.c b/src/soc/intel/jasperlake/dptf.c
new file mode 100644
index 000000000000..be6804cd45a2
--- /dev/null
+++ b/src/soc/intel/jasperlake/dptf.c
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <drivers/intel/dptf/dptf.h>
+
+static const struct dptf_platform_info jsl_dptf_platform_info = {
+ .use_eisa_hids = true,
+ /* _HID for the toplevel DPTF device, typically \_SB.DPTF */
+ .dptf_device_hid = "INT3400",
+ /* _HID for Intel DPTF Generic Device (these require PTYP as well) */
+ .generic_hid = "INT3403",
+ /* _HID for Intel DPTF Fan Device */
+ .fan_hid = "INT3404",
+};
+
+const struct dptf_platform_info *get_dptf_platform_info(void)
+{
+ return &jsl_dptf_platform_info;
+}
diff --git a/src/soc/intel/tigerlake/Makefile.inc b/src/soc/intel/tigerlake/Makefile.inc
index 572b96ee562d..ae6101d88007 100644
--- a/src/soc/intel/tigerlake/Makefile.inc
+++ b/src/soc/intel/tigerlake/Makefile.inc
@@ -30,6 +30,7 @@ romstage-y += reset.c
ramstage-y += acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
+ramstage-y += dptf.c
ramstage-y += elog.c
ramstage-y += espi.c
ramstage-y += finalize.c
diff --git a/src/soc/intel/tigerlake/dptf.c b/src/soc/intel/tigerlake/dptf.c
new file mode 100644
index 000000000000..2f0427e6c755
--- /dev/null
+++ b/src/soc/intel/tigerlake/dptf.c
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <drivers/intel/dptf/dptf.h>
+
+static const struct dptf_platform_info tgl_dptf_platform_info = {
+ .use_eisa_hids = false,
+ /* _HID for the toplevel DPTF device, typically \_SB.DPTF */
+ .dptf_device_hid = "INTC1040",
+ /* _HID for Intel DPTF Generic Device (these require PTYP as well) */
+ .generic_hid = "INTC1043",
+ /* _HID for Intel DPTF Fan Device */
+ .fan_hid = "INTC1044",
+};
+
+const struct dptf_platform_info *get_dptf_platform_info(void)
+{
+ return &tgl_dptf_platform_info;
+}