diff options
author | Sumeet R Pawnikar <sumeet.r.pawnikar@intel.com> | 2021-05-11 20:05:20 +0530 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-07-01 12:12:33 +0000 |
commit | 3657187789ee72834539b82cac6dda525421e4ed (patch) | |
tree | 248a9ff564ed93bd1101d6d9709494f491d40475 /src/drivers/intel | |
parent | b2287718ef2ab8051d917702185f91c33cb61aa3 (diff) |
drivers/intel/dptf: Add OEM variables support
This adds OEM variables feature under DPTF as per BWG doc #541817. Using
this, platform vendors can expose an array of OEM-specific values as OEM
variables to be used in determining DPTF policy. These are obtained via
the ODVP method, and then simply exposed under sysfs. In addition, these
gets updated when a notification is received or when the DPTF policy is
changed by userspace.
BRANCH=None
BUG=b:187253038
TEST=Built and tested on dedede board
Change-Id: Iaf3cf7b40e9a441b41d0c659d76895a58669c2fb
Signed-off-by: Sumeet R Pawnikar <sumeet.r.pawnikar@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50127
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Diffstat (limited to 'src/drivers/intel')
-rw-r--r-- | src/drivers/intel/dptf/chip.h | 8 | ||||
-rw-r--r-- | src/drivers/intel/dptf/dptf.c | 48 |
2 files changed, 56 insertions, 0 deletions
diff --git a/src/drivers/intel/dptf/chip.h b/src/drivers/intel/dptf/chip.h index 5408d9e0d5..59b1e251b3 100644 --- a/src/drivers/intel/dptf/chip.h +++ b/src/drivers/intel/dptf/chip.h @@ -12,6 +12,9 @@ {.source = DPTF_##src, .temp = (tmp), .type = DPTF_CRITICAL_##typ} #define TEMP_PCT(t, p) {.temp = (t), .fan_pct = (p)} +/* Total number of OEM variables */ +#define DPTF_OEM_VARIABLE_COUNT 6 + struct drivers_intel_dptf_config { struct { struct dptf_active_policy active[DPTF_MAX_ACTIVE_POLICIES]; @@ -51,6 +54,11 @@ struct drivers_intel_dptf_config { const char *desc; } tsr[DPTF_MAX_TSR]; } options; + + /* OEM variables */ + struct { + uint32_t oem_variables[DPTF_OEM_VARIABLE_COUNT]; + } oem_data; }; #endif /* _DRIVERS_INTEL_DPTF_CHIP_H_ */ diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c index 7d19df5960..f9b4dee5c5 100644 --- a/src/drivers/intel/dptf/dptf.c +++ b/src/drivers/intel/dptf/dptf.c @@ -117,6 +117,53 @@ static void write_fan(const struct drivers_intel_dptf_config *config, acpigen_pop_len(); /* Device */ } +/* \_SB.DPTF */ +static void write_oem_variables(const struct drivers_intel_dptf_config *config) +{ + int i; + + acpigen_write_name("ODVX"); + acpigen_write_package(DPTF_OEM_VARIABLE_COUNT); + for (i = 0; i < DPTF_OEM_VARIABLE_COUNT; i++) + acpigen_write_dword(config->oem_data.oem_variables[i]); + acpigen_write_package_end(); + + /* + * Method (ODUP, 2) + * Arg0 = Index of ODVX to update + * Arg1 = Value to place in ODVX[Arg0] + */ + acpigen_write_method_serialized("ODUP", 2); + /* ODVX[Arg0] = Arg1 */ + acpigen_write_store(); + acpigen_emit_byte(ARG1_OP); + acpigen_emit_byte(INDEX_OP); + acpigen_emit_namestring("ODVX"); + acpigen_emit_byte(ARG0_OP); + acpigen_emit_byte(ZERO_OP); /* Ignore Index() Destination */ + acpigen_write_method_end(); + + /* + * Method (ODGT, 1) + * Arg0 = Index of ODVX to get + */ + acpigen_write_method_serialized("ODGT", 1); + /* Return (ODVX[Arg0]) */ + acpigen_emit_byte(RETURN_OP); + acpigen_emit_byte(DEREF_OP); + acpigen_emit_byte(INDEX_OP); + acpigen_emit_namestring("ODVX"); + acpigen_emit_byte(ARG0_OP); + acpigen_emit_byte(ZERO_OP); /* Ignore Index() Destination */ + acpigen_write_method_end(); + + /* Method (ODVP) { Return (ODVX) } */ + acpigen_write_method_serialized("ODVP", 0); + acpigen_emit_byte(RETURN_OP); + acpigen_emit_namestring("ODVX"); + acpigen_write_method_end(); +} + /* \_SB.DPTF.xxxx */ static void write_generic_devices(const struct drivers_intel_dptf_config *config, const struct dptf_platform_info *platform_info) @@ -169,6 +216,7 @@ static void write_device_definitions(const struct device *dev) write_tcpu(parent, config); write_open_dptf_device(dev, platform_info); write_fan(config, platform_info); + write_oem_variables(config); write_generic_devices(config, platform_info); acpigen_pop_len(); /* DPTF Device (write_open_dptf_device) */ |