Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/57096 )
Change subject: drivers/intel/dptf: Add new thermal control mechanism for pch device ......................................................................
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 --- M src/drivers/intel/dptf/Kconfig M src/drivers/intel/dptf/dptf.c M src/drivers/intel/dptf/dptf.h 3 files changed, 58 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Tim Wawrzynczak: Looks good to me, approved
diff --git a/src/drivers/intel/dptf/Kconfig b/src/drivers/intel/dptf/Kconfig index ebdb650..6f590b9 100644 --- a/src/drivers/intel/dptf/Kconfig +++ b/src/drivers/intel/dptf/Kconfig @@ -5,3 +5,10 @@ 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 24a371d..a202a27 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 @@ } }
-/* _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 @@ 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 2eeec7b..f23ae25 100644 --- a/src/drivers/intel/dptf/dptf.h +++ b/src/drivers/intel/dptf/dptf.h @@ -14,6 +14,9 @@ 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);