Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41891 )
Change subject: dptf: Add support for Fan and TSR options
......................................................................
dptf: Add support for Fan and TSR options
DPTF has several options on how to control the fan (fine-grained speed
control, minimum speed change in percentage points, and whether or not
the DPTF device should notify the Fan if it detects low speed).
Individual TSRs can also set GTSH, which is the amount of hysteresis
inherent in the measurement, either from circuitry (if analog), or in
firmware (if digital).
BUG=b:143539650
TEST=compiles
Change-Id: I42d789d877da28c163e394d7de5fb1ff339264eb
Signed-off-by: Tim Wawrzynczak <twawrzynczak(a)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, 84 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/41891/1
diff --git a/src/acpi/acpigen_dptf.c b/src/acpi/acpigen_dptf.c
index 18b5a6c..745e233 100644
--- a/src/acpi/acpigen_dptf.c
+++ b/src/acpi/acpigen_dptf.c
@@ -460,3 +460,31 @@
acpigen_pop_len(); /* Method */
acpigen_pop_len(); /* Scope */
}
+
+void dptf_write_STR(enum dptf_participant participant, const char *str)
+{
+ if (!str)
+ return;
+
+ acpigen_write_name_string("_STR", str);
+}
+
+void dptf_write_fan_options(bool fine_grained, int step_size, bool low_speed_notify)
+{
+ acpigen_write_name("_FIF");
+ acpigen_write_package(4);
+
+ acpigen_write_integer(0); /* Revision */
+ acpigen_write_integer(fine_grained);
+ acpigen_write_integer(step_size);
+ acpigen_write_integer(low_speed_notify);
+ acpigen_pop_len(); /* Package */
+}
+
+void dptf_write_tsr_hysteresis(uint8_t hysteresis)
+{
+ if (!hysteresis)
+ return;
+
+ acpigen_write_name_integer("GTSH", hysteresis);
+}
diff --git a/src/drivers/intel/dptf/chip.h b/src/drivers/intel/dptf/chip.h
index 5ea32d9..3932968 100644
--- a/src/drivers/intel/dptf/chip.h
+++ b/src/drivers/intel/dptf/chip.h
@@ -19,6 +19,25 @@
struct dptf_fan_perf fan_perf[DPTF_MAX_FAN_PERF_STATES];
struct dptf_power_limits power_limits;
} controls;
+
+ struct {
+ struct {
+ /* True means _FSL is percentages, False means _FSL is Control values */
+ bool fine_grained_control;
+ /* Recommended minimum step size in percentage points to adjust fan
+ * speed when utilizing fine-grained control (1-9) */
+ uint8_t step_size;
+ /* True means the platform will issue a Notify (0x80) to the fan device
+ * if a a low fan speed is detected */
+ bool low_speed_notify;
+ } fan;
+ struct {
+ /* The amount of hysteresis implemented in circuitry or in the platform
+ * EC's firmware implementation. */
+ uint8_t hysteresis; /* GTSH */
+ const char *desc;
+ } tsr[DPTF_MAX_TSR];
+ } options;
};
#endif /* _DRIVERS_INTEL_DPTF_CHIP_H_ */
diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c
index 70af050..8c1d8d8 100644
--- a/src/drivers/intel/dptf/dptf.c
+++ b/src/drivers/intel/dptf/dptf.c
@@ -57,6 +57,12 @@
static void dptf_fill_ssdt(const struct device *dev)
{
struct drivers_intel_dptf_config *config = dev->chip_info;
+ enum dptf_participant p;
+ bool tsr_en[DPTF_MAX_TSR] = {false};
+ int i;
+
+ for (p = DPTF_TSR0, i = 0; p <= DPTF_TSR3; ++p, ++i)
+ tsr_en[i] = is_participant_used(config, p);
/* Policies */
dptf_write_enabled_policies(&config->policies.enabled);
@@ -78,6 +84,22 @@
dptf_write_fan_perf(config->controls.fan_perf, DPTF_MAX_FAN_PERF_STATES);
dptf_write_power_limits(&config->controls.power_limits);
+ /* Fan options */
+ dptf_write_fan_options(config->options.fan.fine_grained_control,
+ config->options.fan.step_size,
+ config->options.fan.low_speed_notify);
+
+ /* TSR options */
+ for (p = DPTF_TSR0, i = 0; p <= DPTF_TSR3; ++p, ++i) {
+ if (tsr_en[i]) {
+ /* Open scope to the TSR; write GTSH and _STR */
+ dptf_write_scope(p);
+ dptf_write_tsr_hysteresis(config->options.tsr[i].hysteresis);
+ dptf_write_STR(p, config->options.tsr[i].desc);
+ acpigen_pop_len(); /* Scope */
+ }
+ }
+
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 33a9961..aa355df 100644
--- a/src/include/acpi/acpigen_dptf.h
+++ b/src/include/acpi/acpigen_dptf.h
@@ -36,6 +36,9 @@
/* From ACPI spec 6.3 */
DPTF_FIELD_UNUSED = 0xFFFFFFFFull,
+
+ /* Max supported by DPTF */
+ DPTF_MAX_TSR = 4,
};
/* Which policies are enabled? */
@@ -182,6 +185,18 @@
*/
void dptf_write_power_limits(const struct dptf_power_limits *limits);
+/* Set the _STR Name for the given participant */
+void dptf_write_STR(enum dptf_participant participant, const char *str);
+
+/* Set options in the _FIF table */
+void dptf_write_fan_options(bool fine_grained, int step_size, bool low_speed_notify);
+
+/*
+ * Sets the amount of inherent hysteresis in temperature sensor readings (either from hardware
+ * circuitry or possibly from the EC's firmware implementation.
+ */
+void dptf_write_tsr_hysteresis(uint8_t hysteresis);
+
/* Helper method to open the scope for a given participant. */
void dptf_write_scope(enum dptf_participant participant);
--
To view, visit https://review.coreboot.org/c/coreboot/+/41891
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I42d789d877da28c163e394d7de5fb1ff339264eb
Gerrit-Change-Number: 41891
Gerrit-PatchSet: 1
Gerrit-Owner: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-MessageType: newchange