summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorSumeet Pawnikar <sumeet.r.pawnikar@intel.com>2021-08-30 23:19:38 +0530
committerFelix Held <felix-coreboot@felixheld.de>2021-09-05 19:27:54 +0000
commita91d93111470475d3b9deafefc49f0cf23ab48de (patch)
tree6b7217b3fa4223427f49b1b390faa846280bf827 /src/drivers
parent30fba61502f6cc19c846fa4a219b65823bfd6728 (diff)
drivers/intel/dptf: Add new thermal control mechanism for pch device
Add new thermal control mechanism for pch device under dptf driver. This provides support of different control knobs for FIVR. BUG=b:198582766 BRANCH=None TEST=Build FW and test on brya0 board Change-Id: I035d2844b9ba6a9532ae006fc1c43e34cb94328a Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/57096 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/intel/dptf/Kconfig7
-rw-r--r--src/drivers/intel/dptf/dptf.c49
-rw-r--r--src/drivers/intel/dptf/dptf.h3
3 files changed, 58 insertions, 1 deletions
diff --git a/src/drivers/intel/dptf/Kconfig b/src/drivers/intel/dptf/Kconfig
index ebdb6509a8..6f590b9246 100644
--- a/src/drivers/intel/dptf/Kconfig
+++ b/src/drivers/intel/dptf/Kconfig
@@ -5,3 +5,10 @@ config DRIVERS_INTEL_DPTF
help
When enabled, entries in the devicetree are used to generate
Intel DPTF Tables at runtime in the SSDT.
+
+config DRIVERS_INTEL_DPTF_SUPPORTS_TPCH
+ def_bool n
+ depends on HAVE_ACPI_TABLES && PMC_IPC_ACPI_INTERFACE
+ help
+ When enabled, chip driver/intel/dptf will publish information to the
+ SSDT for the TPCH device.
diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c
index 24a371dda6..a202a27129 100644
--- a/src/drivers/intel/dptf/dptf.c
+++ b/src/drivers/intel/dptf/dptf.c
@@ -4,6 +4,7 @@
#include <acpi/acpigen_pci.h>
#include <console/console.h>
#include <device/device.h>
+#include <intelblocks/pmc_ipc.h>
#include "chip.h"
#include "dptf.h"
@@ -194,7 +195,50 @@ static void write_generic_devices(const struct drivers_intel_dptf_config *config
}
}
-/* \_SB.DPTF - note: leaves the Scope open for child devices*/
+/* \_SB.DPTF.TPCH.RFC methods */
+static void write_tpch_rfc_methods(const char *tpch_rfc_method_name,
+ unsigned int ipc_subcmd_ctrl_value)
+{
+ acpigen_write_method_serialized(tpch_rfc_method_name, 1);
+ acpigen_emit_namestring("IPCS");
+ acpigen_write_integer(PMC_IPC_CMD_COMMAND_FIVR);
+ acpigen_write_integer(PMC_IPC_CMD_CMD_ID_FIVR_WRITE);
+ acpigen_write_integer(0x8);
+ acpigen_write_integer(ipc_subcmd_ctrl_value);
+ acpigen_emit_byte(ARG0_OP);
+ acpigen_write_dword(0);
+ acpigen_write_dword(0);
+ /* The reason for returning a value here is a W/A for the ESIF shell */
+ acpigen_emit_byte(RETURN_OP);
+ acpigen_write_package(0);
+ acpigen_write_package_end();
+ acpigen_write_method_end();
+}
+
+static void write_create_tpch(const struct dptf_platform_info *platform_info)
+{
+ acpigen_write_device("TPCH");
+ acpigen_write_name("_HID");
+ dptf_write_hid(platform_info->use_eisa_hids, platform_info->tpch_device_hid);
+ acpigen_write_name_integer("_UID", 0);
+ acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
+}
+
+static void write_tpch_methods(const struct dptf_platform_info *platform_info)
+{
+ write_create_tpch(platform_info);
+
+ /* Create RFC0 method */
+ write_tpch_rfc_methods(platform_info->tpch_rfc0_method,
+ PMC_IPC_SUBCMD_RFI_CTRL0_LOGIC);
+ /* Create RFC1 method */
+ write_tpch_rfc_methods(platform_info->tpch_rfc1_method,
+ PMC_IPC_SUBCMD_RFI_CTRL4_LOGIC);
+
+ acpigen_write_device_end(); /* TPCH Device */
+}
+
+/* \_SB.DPTF - note: leaves the Scope open for child devices */
static void write_open_dptf_device(const struct device *dev,
const struct dptf_platform_info *platform_info)
{
@@ -229,6 +273,9 @@ static void write_device_definitions(const struct device *dev)
write_imok();
write_generic_devices(config, platform_info);
+ if (CONFIG(DRIVERS_INTEL_DPTF_SUPPORTS_TPCH))
+ write_tpch_methods(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
index 2eeec7bc0d..f23ae25721 100644
--- a/src/drivers/intel/dptf/dptf.h
+++ b/src/drivers/intel/dptf/dptf.h
@@ -14,6 +14,9 @@ struct dptf_platform_info {
const char *dptf_device_hid;
const char *generic_hid;
const char *fan_hid;
+ const char *tpch_device_hid;
+ const char *tpch_rfc0_method;
+ const char *tpch_rfc1_method;
};
const struct dptf_platform_info *get_dptf_platform_info(void);