Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41889 )
Change subject: dptf: Add support for Fan Performance States ......................................................................
dptf: Add support for Fan Performance States
This change adds support for generating the _FPS table for the DPTF Fan object. The table describes different levels of fan activity that may be applied to the system in order to actively cool it. The information includes fan speed at a (rough) percentage level, fan speed in RPM, potential noise level in centibels, and power in mA.
BUG=b:143539650 TEST=compiles
Change-Id: I5591eb527f496d0c4c613352d2a87625d47d9273 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, 63 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/41889/1
diff --git a/src/acpi/acpigen_dptf.c b/src/acpi/acpigen_dptf.c index db5d676..0aebf8f 100644 --- a/src/acpi/acpigen_dptf.c +++ b/src/acpi/acpigen_dptf.c @@ -19,6 +19,7 @@ enum { ART_REVISION = 0, DEFAULT_PRIORITY = 100, + DEFAULT_TRIP_POINT = 0xFFFFFFFFull, DEFAULT_WEIGHT = 100, DPTF_MAX_ART_THRESHOLDS = 10, }; @@ -382,3 +383,36 @@ acpigen_pop_len(); /* Method PPSS */ acpigen_pop_len(); /* Scope */ } + +void dptf_write_fan_perf(const struct dptf_fan_perf *states, int max_count) +{ + char *pkg_count; + int i; + + if (!max_count || !states[0].percent) + return; + + dptf_write_scope(DPTF_FAN); + + /* _FPS - Fan Performance States */ + acpigen_write_name("_FPS"); + pkg_count = acpigen_write_package(0); + + for (i = 0; i < max_count; ++i) + { + if (!states[i].percent) + break; + + (*pkg_count)++; + acpigen_write_package(5); + acpigen_write_integer(states[i].percent); + acpigen_write_integer(DEFAULT_TRIP_POINT); + acpigen_write_integer(states[i].speed); + acpigen_write_integer(states[i].noise_level); + acpigen_write_integer(states[i].power); + acpigen_pop_len(); /* inner Package */ + } + + acpigen_pop_len(); /* Package */ + acpigen_pop_len(); /* Scope */ +} diff --git a/src/drivers/intel/dptf/chip.h b/src/drivers/intel/dptf/chip.h index f13acee..cffc74d 100644 --- a/src/drivers/intel/dptf/chip.h +++ b/src/drivers/intel/dptf/chip.h @@ -16,6 +16,7 @@
struct { struct dptf_charger_perf charger_perf[DPTF_MAX_CHARGER_PERF_STATES]; + struct dptf_fan_perf fan_perf[DPTF_MAX_FAN_PERF_STATES]; } controls; };
diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c index ce77d1c..c075ef1 100644 --- a/src/drivers/intel/dptf/dptf.c +++ b/src/drivers/intel/dptf/dptf.c @@ -75,6 +75,7 @@
/* Controls */ dptf_write_charger_perf(config->controls.charger_perf, DPTF_MAX_CHARGER_PERF_STATES); + dptf_write_fan_perf(config->controls.fan_perf, DPTF_MAX_FAN_PERF_STATES);
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 344337d..dd608d3 100644 --- a/src/include/acpi/acpigen_dptf.h +++ b/src/include/acpi/acpigen_dptf.h @@ -32,6 +32,10 @@
/* Maximum found by automatic inspection (awk) */ DPTF_MAX_CHARGER_PERF_STATES = 10, + DPTF_MAX_FAN_PERF_STATES = 10, + + /* From ACPI spec 6.3 */ + DPTF_FIELD_UNUSED = 0xFFFFFFFFull, };
/* Which policies are enabled? */ @@ -94,6 +98,18 @@ uint16_t raw_perf; };
+/* Different levels of fan activity, chosen by active policies */ +struct dptf_fan_perf { + /* Fan percentage level */ + uint8_t percent; + /* Fan speed, in RPM */ + uint16_t speed; + /* Noise level, in 0.1 dBs */ + uint16_t noise_level; + /* Power in mA */ + uint16_t power; +}; + /* * This function writes out _SB.DPTF.IDSP, which describes the different DPTF policies that * this implementation is using. @@ -128,6 +144,17 @@ */ void dptf_write_charger_perf(const struct dptf_charger_perf *perf, int max_count);
+/* + * This function writes an ACPI table describing various performance levels possible for active + * policies. They indicate, for a given fan percentage level: + * 1) What the corresponding speed is (in RPM) + * 2) The expected noise level (in tenths of decibels AKA centibels, or DPTF_FIELD_UNUSED) + * 3) The power consumption (in mW, or DPTF_FIELD_UNUSED to indicate this field is unused). + * 4) The corresponding active cooling trip point (from _ART) (typically left as + * DPTF_FIELD_UNUSED). + */ +void dptf_write_fan_perf(const struct dptf_fan_perf *perf, int max_count); + /* Helper method to open the scope for a given participant. */ void dptf_write_scope(enum dptf_participant participant);