summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2020-05-29 13:56:37 -0600
committerPatrick Georgi <pgeorgi@google.com>2020-07-07 17:20:13 +0000
commitc41f7f15c192d06b5dfdeb1b74f99278cee66110 (patch)
tree4e8e33a2268c837f329fafb05d42837ac119fae9 /src/include
parentff2f6b2478dac8cd957695e528f13babaa49a963 (diff)
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 <twawrzynczak@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41885 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Sumeet R Pawnikar <sumeet.r.pawnikar@intel.com> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/acpi/acpigen_dptf.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/include/acpi/acpigen_dptf.h b/src/include/acpi/acpigen_dptf.h
new file mode 100644
index 0000000000..a082b62fd9
--- /dev/null
+++ b/src/include/acpi/acpigen_dptf.h
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef ACPI_ACPIGEN_DPTF_H
+#define ACPI_ACPIGEN_DPTF_H
+
+#include <device/device.h>
+#include <stdbool.h>
+
+/* A common idiom is to use a default value if none is provided (i.e., == 0) */
+#define DEFAULT_IF_0(thing, default_) ((thing) ? (thing) : (default_))
+
+/* List of available participants (i.e., they can participate in policies) */
+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,
+};
+
+/* DPTF compile-time constants */
+enum {
+ /* A device can only define _AC0 .. _AC9 i.e. between 0 and 10 Active Cooling Methods */
+ DPTF_MAX_ACX = 10,
+ DPTF_MAX_ACTIVE_POLICIES = (DPTF_PARTICIPANT_COUNT-1),
+};
+
+/* Active Policy */
+struct dptf_active_policy {
+ /* Device capable of being affected by the fan */
+ enum dptf_participant target;
+ /* Source's contribution to the Target's cooling capability as a percentage */
+ uint8_t weight;
+ /* When target reaches temperature 'temp', the source will turn on at 'fan_pct' % */
+ struct {
+ /* (degrees C) */
+ uint8_t temp;
+ /* 0 - 100 */
+ uint8_t fan_pct;
+ } thresholds[DPTF_MAX_ACX];
+};
+
+/*
+ * 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.
+ */
+void dptf_write_active_policies(const struct dptf_active_policy *policies, int max_count);
+
+/* Helper method to open the scope for a given participant. */
+void dptf_write_scope(enum dptf_participant participant);
+
+/*
+ * Write out a _STA that will check the value of the DPTE field in GNVS, and return 0xF if DPTE
+ * is 1, otherwise it will return 0.
+ */
+void dptf_write_STA(void);
+
+#endif /* ACPI_ACPIGEN_DPTF_H */