Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41887 )
Change subject: dptf: Add support for Critical Policies ......................................................................
dptf: Add support for Critical Policies
This patch adds support for DPTF Critical Policies, which are consist of Method definitions only. They are `_CRT` and `_HOT`, which are defined as temperature thresholds that, when exceeded, will execute a graceful suspend or a graceful shutdown, respectively.
BUG=b:143539650 TEST=compiles
Change-Id: I711ecdcf17ae8f6e653f33069201da4515ace85e Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/acpi/acpigen_dptf.c M src/drivers/intel/dptf/chip.h M src/drivers/intel/dptf/dptf.c M src/include/acpi/acpigen_dptf.h 4 files changed, 52 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/41887/1
diff --git a/src/acpi/acpigen_dptf.c b/src/acpi/acpigen_dptf.c index e2e6015..aff0b2d 100644 --- a/src/acpi/acpigen_dptf.c +++ b/src/acpi/acpigen_dptf.c @@ -323,3 +323,21 @@ write_thermal_relationship_table(policies, max_count); write_all_PSV(policies, max_count); } + +void dptf_write_critical_policies(const struct dptf_critical_policy *policies, int max_count) +{ + int i; + + for (i = 0; i < max_count; ++i) { + if (policies[i].source == DPTF_NONE) + break; + + dptf_write_scope(policies[i].source); + + /* Choose _CRT or _HOT */ + write_simple_return_method(policies[i].type == DPTF_CRITICAL_SUSPEND ? + "_CRT" : "_HOT", to_acpi_temp(policies[i].temp)); + + acpigen_pop_len(); /* Scope */ + } +} diff --git a/src/drivers/intel/dptf/chip.h b/src/drivers/intel/dptf/chip.h index 98bb7d8..aa87e0d 100644 --- a/src/drivers/intel/dptf/chip.h +++ b/src/drivers/intel/dptf/chip.h @@ -10,6 +10,7 @@ struct { struct dptf_enabled_policies enabled; struct dptf_active_policy active[DPTF_MAX_ACTIVE_POLICIES]; + struct dptf_critical_policy critical[DPTF_MAX_CRITICAL_POLICIES]; struct dptf_passive_policy passive[DPTF_MAX_PASSIVE_POLICIES]; } policies; }; diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c index df0d428..3a3af68 100644 --- a/src/drivers/intel/dptf/dptf.c +++ b/src/drivers/intel/dptf/dptf.c @@ -36,6 +36,11 @@ config->policies.passive[i].target == participant) return true;
+ /* Critical? */ + for (i = 0; i < DPTF_MAX_CRITICAL_POLICIES; ++i) + if (config->policies.critical[i].source == participant) + return true; + /* Check fan as well (it's use is implicit in the Active policy) */ if (participant == DPTF_FAN && config->policies.enabled.active) return true; @@ -64,6 +69,10 @@ dptf_write_passive_policies(config->policies.passive, DPTF_MAX_PASSIVE_POLICIES);
+ if (config->policies.enabled.critical) + dptf_write_critical_policies(config->policies.critical, + DPTF_MAX_CRITICAL_POLICIES); + printk(BIOS_INFO, "\_SB.DPTF: %s at %s\n", dev->chip_ops->name, dev_path(dev)); }
diff --git a/src/include/acpi/acpigen_dptf.h b/src/include/acpi/acpigen_dptf.h index 3313fbb..14ad2fa 100644 --- a/src/include/acpi/acpigen_dptf.h +++ b/src/include/acpi/acpigen_dptf.h @@ -28,6 +28,7 @@ DPTF_MAX_ACX = 10, DPTF_MAX_ACTIVE_POLICIES = (DPTF_PARTICIPANT_COUNT-1), DPTF_MAX_PASSIVE_POLICIES = (DPTF_PARTICIPANT_COUNT-1), + DPTF_MAX_CRITICAL_POLICIES = (DPTF_PARTICIPANT_COUNT-1), };
/* Which policies are enabled? */ @@ -66,6 +67,22 @@ uint8_t priority; };
+/* Critical Policy type: graceful suspend or graceful shutdown */ +enum dptf_critical_policy_type { + DPTF_CRITICAL_SUSPEND, + DPTF_CRITICAL_SHUTDOWN, +}; + +/* Critical Policy */ +struct dptf_critical_policy { + /* The device that can trigger a critical event */ + enum dptf_participant source; + /* What type of critical policy */ + enum dptf_critical_policy_type type; + /* Temperature to activate policy, degrees C */ + uint8_t temp; +}; + /* * This function writes out _SB.DPTF.IDSP, which describes the different DPTF policies that * this implementation is using. @@ -87,6 +104,13 @@ */ void dptf_write_passive_policies(const struct dptf_passive_policy *policies, int max_count);
+/* + * Critical policies are temperature thresholds that, when reached, will cause the system to + * take some emergency action in order to eliminate excess temperatures from damaging the + * system. The emergency actions are a graceful suspend or a graceful shutdown. + */ +void dptf_write_critical_policies(const struct dptf_critical_policy *policies, int max_count); + /* Helper method to open the scope for a given participant. */ void dptf_write_scope(enum dptf_participant participant);
Hello build bot (Jenkins), Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/41887
to look at the new patch set (#4).
Change subject: dptf: Add support for Critical Policies ......................................................................
dptf: Add support for Critical Policies
This patch adds support for DPTF Critical Policies, which are consist of Method definitions only. They are `_CRT` and `_HOT`, which are defined as temperature thresholds that, when exceeded, will execute a graceful suspend or a graceful shutdown, respectively.
BUG=b:143539650 TEST=compiles
Change-Id: I711ecdcf17ae8f6e653f33069201da4515ace85e Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/acpi/acpigen_dptf.c M src/drivers/intel/dptf/chip.h M src/drivers/intel/dptf/dptf.c M src/include/acpi/acpigen_dptf.h 4 files changed, 52 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/41887/4
Hello build bot (Jenkins), Furquan Shaikh, Duncan Laurie, Sumeet R Pawnikar, Subrata Banik, Patrick Rudolph, Karthik Ramasubramanian,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/41887
to look at the new patch set (#7).
Change subject: dptf: Add support for Critical Policies ......................................................................
dptf: Add support for Critical Policies
This patch adds support for DPTF Critical Policies, which are consist of Method definitions only. They are `_CRT` and `_HOT`, which are defined as temperature thresholds that, when exceeded, will execute a graceful suspend or a graceful shutdown, respectively.
BUG=b:143539650 TEST=compiles
Change-Id: I711ecdcf17ae8f6e653f33069201da4515ace85e Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/acpi/acpigen_dptf.c M src/drivers/intel/dptf/chip.h M src/drivers/intel/dptf/dptf.c M src/include/acpi/acpigen_dptf.h 4 files changed, 51 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/41887/7
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41887 )
Change subject: dptf: Add support for Critical Policies ......................................................................
Patch Set 10: Code-Review+2
Hello build bot (Jenkins), Furquan Shaikh, Duncan Laurie, Sumeet R Pawnikar, Subrata Banik, Patrick Rudolph, Karthik Ramasubramanian,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/41887
to look at the new patch set (#11).
Change subject: dptf: Add support for Critical Policies ......................................................................
dptf: Add support for Critical Policies
This patch adds support for DPTF Critical Policies, which are consist of Method definitions only. They are `_CRT` and `_HOT`, which are defined as temperature thresholds that, when exceeded, will execute a graceful suspend or a graceful shutdown, respectively.
BUG=b:143539650 TEST=compiles
Change-Id: I711ecdcf17ae8f6e653f33069201da4515ace85e Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/acpi/acpigen_dptf.c M src/drivers/intel/dptf/chip.h M src/drivers/intel/dptf/dptf.c M src/include/acpi/acpigen_dptf.h 4 files changed, 51 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/41887/11
Hello build bot (Jenkins), Furquan Shaikh, Duncan Laurie, Sumeet R Pawnikar, Subrata Banik, Patrick Rudolph, Karthik Ramasubramanian,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/41887
to look at the new patch set (#12).
Change subject: dptf: Add support for Critical Policies ......................................................................
dptf: Add support for Critical Policies
This patch adds support for DPTF Critical Policies, which are consist of Method definitions only. They are `_CRT` and `_HOT`, which are defined as temperature thresholds that, when exceeded, will execute a graceful suspend or a graceful shutdown, respectively.
BUG=b:143539650 TEST=compiles
Change-Id: I711ecdcf17ae8f6e653f33069201da4515ace85e Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/acpi/acpigen_dptf.c M src/drivers/intel/dptf/chip.h M src/drivers/intel/dptf/dptf.c M src/include/acpi/acpigen_dptf.h 4 files changed, 51 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/41887/12
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41887 )
Change subject: dptf: Add support for Critical Policies ......................................................................
Patch Set 13: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/41887 )
Change subject: dptf: Add support for Critical Policies ......................................................................
dptf: Add support for Critical Policies
This patch adds support for DPTF Critical Policies, which are consist of Method definitions only. They are `_CRT` and `_HOT`, which are defined as temperature thresholds that, when exceeded, will execute a graceful suspend or a graceful shutdown, respectively.
BUG=b:143539650 TEST=compiles
Change-Id: I711ecdcf17ae8f6e653f33069201da4515ace85e Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org Reviewed-on: https://review.coreboot.org/c/coreboot/+/41887 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Duncan Laurie dlaurie@chromium.org --- M src/acpi/acpigen_dptf.c M src/drivers/intel/dptf/chip.h M src/drivers/intel/dptf/dptf.c M src/include/acpi/acpigen_dptf.h 4 files changed, 51 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Duncan Laurie: Looks good to me, approved
diff --git a/src/acpi/acpigen_dptf.c b/src/acpi/acpigen_dptf.c index abd99c1..88cf386 100644 --- a/src/acpi/acpigen_dptf.c +++ b/src/acpi/acpigen_dptf.c @@ -262,3 +262,21 @@ write_thermal_relationship_table(policies, max_count); write_all_PSV(policies, max_count); } + +void dptf_write_critical_policies(const struct dptf_critical_policy *policies, int max_count) +{ + int i; + + for (i = 0; i < max_count; ++i) { + if (policies[i].source == DPTF_NONE) + break; + + dptf_write_scope(policies[i].source); + + /* Choose _CRT or _HOT */ + write_simple_return_method(policies[i].type == DPTF_CRITICAL_SHUTDOWN ? + "_CRT" : "_HOT", to_acpi_temp(policies[i].temp)); + + acpigen_pop_len(); /* Scope */ + } +} diff --git a/src/drivers/intel/dptf/chip.h b/src/drivers/intel/dptf/chip.h index 0cd2ad2..8d77603 100644 --- a/src/drivers/intel/dptf/chip.h +++ b/src/drivers/intel/dptf/chip.h @@ -8,6 +8,7 @@ struct drivers_intel_dptf_config { struct { struct dptf_active_policy active[DPTF_MAX_ACTIVE_POLICIES]; + struct dptf_critical_policy critical[DPTF_MAX_CRITICAL_POLICIES]; struct dptf_passive_policy passive[DPTF_MAX_PASSIVE_POLICIES]; } policies; }; diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c index 74f4812..5cad07d 100644 --- a/src/drivers/intel/dptf/dptf.c +++ b/src/drivers/intel/dptf/dptf.c @@ -41,6 +41,11 @@ config->policies.passive[i].target == participant) return true;
+ /* Critical? */ + for (i = 0; i < DPTF_MAX_CRITICAL_POLICIES; ++i) + if (config->policies.critical[i].source == 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; @@ -64,6 +69,9 @@ dptf_write_passive_policies(config->policies.passive, DPTF_MAX_PASSIVE_POLICIES);
+ dptf_write_critical_policies(config->policies.critical, + DPTF_MAX_CRITICAL_POLICIES); + printk(BIOS_INFO, "\_SB.DPTF: %s at %s\n", dev->chip_ops->name, dev_path(dev)); }
diff --git a/src/include/acpi/acpigen_dptf.h b/src/include/acpi/acpigen_dptf.h index 214578a..45fbe8f 100644 --- a/src/include/acpi/acpigen_dptf.h +++ b/src/include/acpi/acpigen_dptf.h @@ -28,6 +28,7 @@ DPTF_MAX_ACX = 10, DPTF_MAX_ACTIVE_POLICIES = (DPTF_PARTICIPANT_COUNT-1), DPTF_MAX_PASSIVE_POLICIES = (DPTF_PARTICIPANT_COUNT-1), + DPTF_MAX_CRITICAL_POLICIES = (DPTF_PARTICIPANT_COUNT-1), };
/* Active Policy */ @@ -59,6 +60,22 @@ uint8_t priority; };
+/* Critical Policy type: graceful S4 transition or graceful shutdown */ +enum dptf_critical_policy_type { + DPTF_CRITICAL_S4, + DPTF_CRITICAL_SHUTDOWN, +}; + +/* Critical Policy */ +struct dptf_critical_policy { + /* The device that can trigger a critical event */ + enum dptf_participant source; + /* What type of critical policy */ + enum dptf_critical_policy_type type; + /* Temperature to activate policy, degrees C */ + uint8_t temp; +}; + /* * 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 @@ -74,6 +91,13 @@ */ void dptf_write_passive_policies(const struct dptf_passive_policy *policies, int max_count);
+/* + * Critical policies are temperature thresholds that, when reached, will cause the system to + * take some emergency action in order to eliminate excess temperatures from damaging the + * system. The emergency actions are a graceful suspend or a graceful shutdown. + */ +void dptf_write_critical_policies(const struct dptf_critical_policy *policies, int max_count); + /* Helper method to open the scope for a given participant. */ void dptf_write_scope(enum dptf_participant participant);