Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41884 )
Change subject: drivers/intel/dptf: Add current participant Devices to DSDT ......................................................................
drivers/intel/dptf: Add current participant Devices to DSDT
In this DPTF implementation, the participant device objects are written into the DSDT with only minimal Names attached (_HID/_ADR, _STA, _UID, PTYP, and _STR). All other Methods & Names will be written into the SSDT.
BUG=b:143539650 TEST=Compiles.
Change-Id: Ief69a57adce9ee0b19056ce6a11ed8a5b51b3f87 Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/drivers/intel/dptf/dptf.c 1 file changed, 70 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/41884/1
diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c index bf9e98a..e3e4efd 100644 --- a/src/drivers/intel/dptf/dptf.c +++ b/src/drivers/intel/dptf/dptf.c @@ -5,6 +5,27 @@ #include <device/device.h> #include "chip.h"
+enum { + /* Generic DPTF participants have a PTYP field */ + DPTF_GENERIC_PARTICIPANT_TYPE_CHARGER = 0xB, + DPTF_GENERIC_PARTICIPANT_TYPE_TSR = 0x3, +#ifndef CONFIG_DPTF_CPU_ADDR + CONFIG_DPTF_CPU_ADDR = 0x00040000ul, +#endif +}; + +#define DEFAULT_CHARGER_NAME "Battery Charger" + +/* + * Helper method to determine if a device is "used" (called out anywhere as a source or a target + * of any policies, and therefore should be included in the ACPI tables. + */ +static bool is_participant_used(const struct drivers_intel_dptf_config *config, + enum dptf_participant participant) +{ + return false; +} + static const char *dptf_acpi_name(const struct device *dev) { return "DPTF"; @@ -25,10 +46,22 @@ static void dptf_inject_dsdt(const struct device *dev) { const struct drivers_intel_dptf_config *config; + enum dptf_participant p; + char name[5]; + int uid; + int id;
config = dev->chip_info; acpigen_write_scope("\_SB");
+ /* DPTF CPU device */ + if (is_participant_used(config, DPTF_CPU)) { + acpigen_write_device("TCPU"); + acpigen_write_name_integer("_ADR", CONFIG_DPTF_CPU_ADDR); + dptf_write_STA(); + acpigen_pop_len(); /* Device */ + } + /* Toplevel DPTF device */ acpigen_write_device("DPTF"); acpigen_write_name("_HID"); @@ -36,6 +69,43 @@ acpigen_write_name_integer("_UID", 0); dptf_write_STA();
+ /* Fan device */ + if (is_participant_used(config, DPTF_FAN)) { + acpigen_write_device("TFN1"); + acpigen_write_name("_HID"); + acpigen_emit_eisaid("INT3404"); + acpigen_write_name_integer("_UID", 0); + dptf_write_STA(); + acpigen_pop_len(); /* Device */ + } + + /* Charger */ + if (is_participant_used(config, DPTF_CHARGER)) { + acpigen_write_device("TCHG"); + acpigen_write_name("_HID"); + acpigen_emit_eisaid("INT3403"); + acpigen_write_name_integer("_UID", 0); + acpigen_write_name_integer("PTYP", DPTF_GENERIC_PARTICIPANT_TYPE_CHARGER); + acpigen_write_name_string("_STR", DEFAULT_CHARGER_NAME); + dptf_write_STA(); + acpigen_pop_len(); /* Device */ + } + + /* TSR0 - TSR3 */ + for (p = DPTF_TSR0, uid = 1, id = 0; p <= DPTF_TSR3; ++p, ++uid, ++id) { + if (is_participant_used(config, p)) { + snprintf(name, sizeof(name), "TSR%1d", id); + acpigen_write_device(name); + acpigen_write_name("_HID"); + acpigen_emit_eisaid("INT3403"); + acpigen_write_name_integer("TMPI", id); + acpigen_write_name_integer("_UID", uid); + acpigen_write_name_integer("PTYP", DPTF_GENERIC_PARTICIPANT_TYPE_TSR); + dptf_write_STA(); + acpigen_pop_len(); /* Device */ + } + } + acpigen_pop_len(); /* DPTF Device */ acpigen_pop_len(); /* Scope */ }