From c41f7f15c192d06b5dfdeb1b74f99278cee66110 Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Fri, 29 May 2020 13:56:37 -0600 Subject: dptf: Add support for generation of Active Policies This change adds support for generating the different pieces of DPTF Active Policies. This includes the Active Relationship Table, in addition to _ACx methods. BUG=b:143539650 TEST=compiles Change-Id: Iea0ccbd96f88d0f3a8f2c77a7d0f3a284e5ee463 Signed-off-by: Tim Wawrzynczak Reviewed-on: https://review.coreboot.org/c/coreboot/+/41885 Tested-by: build bot (Jenkins) Reviewed-by: Sumeet R Pawnikar Reviewed-by: Duncan Laurie --- src/drivers/intel/dptf/dptf.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/drivers/intel/dptf/dptf.c') diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c index 060864adc1..20f8d9b4ae 100644 --- a/src/drivers/intel/dptf/dptf.c +++ b/src/drivers/intel/dptf/dptf.c @@ -5,18 +5,6 @@ #include #include "chip.h" -enum dptf_participant { - DPTF_NONE, - DPTF_CPU, - DPTF_CHARGER, - DPTF_FAN, - DPTF_TEMP_SENSOR_0, - DPTF_TEMP_SENSOR_1, - DPTF_TEMP_SENSOR_2, - DPTF_TEMP_SENSOR_3, - DPTF_PARTICIPANT_COUNT, -}; - /* Generic DPTF participants have a PTYP field to distinguish them */ enum dptf_generic_participant_type { DPTF_GENERIC_PARTICIPANT_TYPE_TSR = 0x3, @@ -40,6 +28,17 @@ enum dptf_generic_participant_type { static bool is_participant_used(const struct drivers_intel_dptf_config *config, enum dptf_participant participant) { + int i; + + /* Active? */ + for (i = 0; i < DPTF_MAX_ACTIVE_POLICIES; ++i) + if (config->policies.active[i].target == participant) + return true; + + /* Check fan as well (its use is implicit in the Active policy) */ + if (participant == DPTF_FAN && config->policies.active[0].target != DPTF_NONE) + return true; + return false; } @@ -53,6 +52,9 @@ static void dptf_fill_ssdt(const struct device *dev) { struct drivers_intel_dptf_config *config = config_of(dev); + dptf_write_active_policies(config->policies.active, + DPTF_MAX_ACTIVE_POLICIES); + printk(BIOS_INFO, "\\_SB.DPTF: %s at %s\n", dev->chip_ops->name, dev_path(dev)); } -- cgit v1.2.3