diff options
author | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2020-06-03 16:27:30 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-07-07 17:23:47 +0000 |
commit | 03465f4b0f69cb2ca2077ff83958f5b1185da5b1 (patch) | |
tree | b4bc33c8014581c799a357cdfea04197229729e3 /src | |
parent | e4d8ebcef783f89fb9645d26d339dfb33065530f (diff) |
dptf: Add support for IDSP
\_SB.DPTF.IDSP adverties to the DPTF daemon which policies the
implementation supports. Added a new acpigen function to figure out
which policies are used, and fills out IDSP appropriately.
Change-Id: Idf67a23bf38de4481c02f98ffb27afb8ca2d1b7b
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42081
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/acpi/acpigen_dptf.c | 42 | ||||
-rw-r--r-- | src/drivers/intel/dptf/dptf.c | 5 | ||||
-rw-r--r-- | src/include/acpi/acpigen_dptf.h | 11 |
3 files changed, 58 insertions, 0 deletions
diff --git a/src/acpi/acpigen_dptf.c b/src/acpi/acpigen_dptf.c index 59afa551a5..c8849261d6 100644 --- a/src/acpi/acpigen_dptf.c +++ b/src/acpi/acpigen_dptf.c @@ -9,6 +9,11 @@ /* Defaults */ #define DEFAULT_RAW_UNIT "ma" +/* DPTF-specific UUIDs */ +#define DPTF_PASSIVE_POLICY_1_0_UUID "42A441D6-AE6A-462B-A84B-4A8CE79027D3" +#define DPTF_CRITICAL_POLICY_UUID "97C68AE7-15FA-499c-B8C9-5DA81D606E0A" +#define DPTF_ACTIVE_POLICY_UUID "3A95C389-E4B8-4629-A526-C52C88626BAE" + enum { ART_REVISION = 0, DEFAULT_PRIORITY = 100, @@ -432,3 +437,40 @@ void dptf_write_tsr_hysteresis(uint8_t hysteresis) acpigen_write_name_integer("GTSH", hysteresis); } + +void dptf_write_enabled_policies(const struct dptf_active_policy *active_policies, + int active_count, + const struct dptf_passive_policy *passive_policies, + int passive_count, + const struct dptf_critical_policy *critical_policies, + int critical_count) +{ + bool is_active_used; + bool is_passive_used; + bool is_critical_used; + int pkg_count; + + is_active_used = (active_count && active_policies[0].target != DPTF_NONE); + is_passive_used = (passive_count && passive_policies[0].target != DPTF_NONE); + is_critical_used = (critical_count && critical_policies[0].source != DPTF_NONE); + pkg_count = is_active_used + is_passive_used + is_critical_used; + + if (!pkg_count) + return; + + acpigen_write_scope(TOPLEVEL_DPTF_SCOPE); + acpigen_write_name("IDSP"); + acpigen_write_package(pkg_count); + + if (is_active_used) + acpigen_write_uuid(DPTF_ACTIVE_POLICY_UUID); + + if (is_passive_used) + acpigen_write_uuid(DPTF_PASSIVE_POLICY_1_0_UUID); + + if (is_critical_used) + acpigen_write_uuid(DPTF_CRITICAL_POLICY_UUID); + + acpigen_pop_len(); /* Package */ + acpigen_pop_len(); /* Scope */ +} diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c index 1fe9653eb7..1e4063e40f 100644 --- a/src/drivers/intel/dptf/dptf.c +++ b/src/drivers/intel/dptf/dptf.c @@ -69,6 +69,11 @@ static void dptf_fill_ssdt(const struct device *dev) for (p = DPTF_TEMP_SENSOR_0, i = 0; p <= DPTF_TEMP_SENSOR_3; ++p, ++i) tsr_en[i] = is_participant_used(config, p); + /* Policies */ + dptf_write_enabled_policies(config->policies.active, DPTF_MAX_ACTIVE_POLICIES, + config->policies.passive, DPTF_MAX_PASSIVE_POLICIES, + config->policies.critical, DPTF_MAX_CRITICAL_POLICIES); + dptf_write_active_policies(config->policies.active, DPTF_MAX_ACTIVE_POLICIES); diff --git a/src/include/acpi/acpigen_dptf.h b/src/include/acpi/acpigen_dptf.h index 496840b8b4..89b64f3728 100644 --- a/src/include/acpi/acpigen_dptf.h +++ b/src/include/acpi/acpigen_dptf.h @@ -127,6 +127,17 @@ struct dptf_power_limits { }; /* + * This function writes out \_SB.DPTF.IDSP, which describes the different DPTF policies that + * this implementation is using. + */ +void dptf_write_enabled_policies(const struct dptf_active_policy *active_policies, + int active_count, + const struct dptf_passive_policy *passive_policies, + int passive_count, + const struct dptf_critical_policy *critical_policies, + int critical_count); + +/* * This function provides tables of temperature and corresponding fan or percent. When the * temperature thresholds are met (_AC0 - _AC9), the fan is driven to corresponding percentage * of full speed. |