Attention is currently required from: Patrick Rudolph. Sumeet R Pawnikar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/57925 )
Change subject: drivers/intel/dptf: Add support for PCH methods ......................................................................
drivers/intel/dptf: Add support for PCH methods
Add various methods support for pch device under dptf driver. This provides support of different control knobs for FIVR.
BUG=b:198582766 BRANCH=None TEST=Build FW and test on brya0 board
Change-Id: I2d40fff98cb4eb9144d55fd5383d9946e4cb0558 Signed-off-by: Sumeet Pawnikar sumeet.r.pawnikar@intel.com --- M src/drivers/intel/dptf/dptf.c M src/drivers/intel/dptf/dptf.h 2 files changed, 109 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/25/57925/1
diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c index a202a27..901d725 100644 --- a/src/drivers/intel/dptf/dptf.c +++ b/src/drivers/intel/dptf/dptf.c @@ -5,16 +5,19 @@ #include <console/console.h> #include <device/device.h> #include <intelblocks/pmc_ipc.h> +#include <soc/pci_devs.h> #include "chip.h" #include "dptf.h"
/* Generic DPTF participants have a PTYP field to distinguish them */ enum dptf_generic_participant_type { DPTF_GENERIC_PARTICIPANT_TYPE_TSR = 0x3, + DPTF_GENERIC_PARTICIPANT_TYPE_TPCH = 0x5, DPTF_GENERIC_PARTICIPANT_TYPE_CHARGER = 0xB, };
#define DEFAULT_CHARGER_STR "Battery Charger" +#define DEFAULT_TPCH_STR "Intel PCH FIVR Participant"
/* * Helper method to determine if a device is "used" (called out anywhere as a source or a target @@ -195,32 +198,102 @@ } }
-/* _SB.DPTF.TPCH.RFC methods */ -static void write_tpch_rfc_methods(const char *tpch_rfc_method_name, +static const char *get_pmc_ipcs_method(void) +{ + const char *method = acpi_device_path_join( + pcidev_path_on_root(PCH_DEVFN_PMC), "IPCS"); + if (!method) { + printk(BIOS_ERR, "%s: Unable to find PMC device IPCS method\n", __func__); + return NULL; + } + return method; +} + +static void write_tpch_write_methods(const char *tpch_write_method_name, unsigned int ipc_subcmd_ctrl_value) { - acpigen_write_method_serialized(tpch_rfc_method_name, 1); - acpigen_emit_namestring("IPCS"); + const char *ipcs = get_pmc_ipcs_method(); + acpigen_write_method_serialized(tpch_write_method_name, 1); + acpigen_emit_namestring(ipcs); acpigen_write_integer(PMC_IPC_CMD_COMMAND_FIVR); acpigen_write_integer(PMC_IPC_CMD_CMD_ID_FIVR_WRITE); acpigen_write_integer(0x8); acpigen_write_integer(ipc_subcmd_ctrl_value); acpigen_emit_byte(ARG0_OP); - acpigen_write_dword(0); - acpigen_write_dword(0); + acpigen_write_zero(); + acpigen_write_zero(); /* The reason for returning a value here is a W/A for the ESIF shell */ acpigen_emit_byte(RETURN_OP); - acpigen_write_package(0); + acpigen_write_package(1); + acpigen_write_zero(); acpigen_write_package_end(); acpigen_write_method_end(); }
+static void write_ppkg_package(const uint8_t i) +{ + acpigen_write_store(); + acpigen_emit_byte(DEREF_OP); + acpigen_emit_byte(INDEX_OP); + acpigen_emit_byte(ARG0_OP); + acpigen_write_integer(i); + acpigen_emit_byte(ZERO_OP); + acpigen_emit_byte(INDEX_OP); + acpigen_emit_namestring("PPKG"); + acpigen_write_integer(i); + acpigen_emit_byte(ZERO_OP); +} + +static void write_pkgc_method(void) +{ + acpigen_write_method_serialized("PKGC", 1); + acpigen_write_name("PPKG"); + acpigen_write_package(2); + acpigen_write_zero(); + acpigen_write_zero(); + acpigen_write_package_end(); + + write_ppkg_package(0); + write_ppkg_package(1); + + acpigen_write_return_namestr("PPKG"); + acpigen_write_method_end(); +} + +static void write_tpch_read_methods(const char *tpch_read_method_name, + unsigned int ipc_subcmd_ctrl_value) +{ + const char *ipcs = get_pmc_ipcs_method(); + acpigen_write_method_serialized(tpch_read_method_name, 0); + acpigen_write_store(); + acpigen_emit_namestring(ipcs); + acpigen_write_integer(PMC_IPC_CMD_COMMAND_FIVR); + acpigen_write_integer(PMC_IPC_CMD_CMD_ID_FIVR_READ); + acpigen_write_integer(0x8); + acpigen_write_integer(PMC_IPC_SUBCMD_RFI_CTRL0_LOGIC); + acpigen_write_integer(ipc_subcmd_ctrl_value); + acpigen_write_zero(); + acpigen_write_zero(); + acpigen_emit_byte(LOCAL0_OP); + + acpigen_write_store(); + acpigen_emit_namestring("\_SB_.DPTF.TPCH.PKGC"); + acpigen_emit_byte(LOCAL0_OP); + acpigen_emit_byte(LOCAL1_OP); + + acpigen_emit_byte(RETURN_OP); + acpigen_emit_byte(LOCAL1_OP); + acpigen_write_method_end(); +} + static void write_create_tpch(const struct dptf_platform_info *platform_info) { acpigen_write_device("TPCH"); acpigen_write_name("_HID"); dptf_write_hid(platform_info->use_eisa_hids, platform_info->tpch_device_hid); - acpigen_write_name_integer("_UID", 0); + acpigen_write_name_string("_UID", "TPCH"); + acpigen_write_name_string("_STR", DEFAULT_TPCH_STR); + acpigen_write_name_integer("PTYP", DPTF_GENERIC_PARTICIPANT_TYPE_TPCH); acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON); }
@@ -229,11 +302,31 @@ write_create_tpch(platform_info);
/* Create RFC0 method */ - write_tpch_rfc_methods(platform_info->tpch_rfc0_method, + write_tpch_write_methods(platform_info->tpch_rfc0_method, PMC_IPC_SUBCMD_RFI_CTRL0_LOGIC); /* Create RFC1 method */ - write_tpch_rfc_methods(platform_info->tpch_rfc1_method, + write_tpch_write_methods(platform_info->tpch_rfc1_method, PMC_IPC_SUBCMD_RFI_CTRL4_LOGIC); + /* Create SEMI method */ + write_tpch_write_methods(platform_info->tpch_semi_method, + PMC_IPC_SUBCMD_EMI_CTRL0_LOGIC); + + write_pkgc_method(); + /* Create GFC0 method */ + write_tpch_read_methods(platform_info->tpch_gfc0_method, + PMC_IPC_SUBCMD_RFI_CTRL0_LOGIC); + /* Create GFC1 method */ + write_tpch_read_methods(platform_info->tpch_gfc1_method, + PMC_IPC_SUBCMD_RFI_CTRL4_LOGIC); + /* Create GEMI method */ + write_tpch_read_methods(platform_info->tpch_gemi_method, + PMC_IPC_SUBCMD_EMI_CTRL0_LOGIC); + /* Create GFFS method */ + write_tpch_read_methods(platform_info->tpch_gffs_method, + PMC_IPC_SUBCMD_FFFC_FAULT_STATUS); + /* Create GFCS method */ + write_tpch_read_methods(platform_info->tpch_gfcs_method, + PMC_IPC_SUBCMD_FFFC_RFI_STATUS);
acpigen_write_device_end(); /* TPCH Device */ } diff --git a/src/drivers/intel/dptf/dptf.h b/src/drivers/intel/dptf/dptf.h index f23ae25..3ce558a 100644 --- a/src/drivers/intel/dptf/dptf.h +++ b/src/drivers/intel/dptf/dptf.h @@ -17,6 +17,12 @@ const char *tpch_device_hid; const char *tpch_rfc0_method; const char *tpch_rfc1_method; + const char *tpch_semi_method; + const char *tpch_gfc0_method; + const char *tpch_gfc1_method; + const char *tpch_gemi_method; + const char *tpch_gffs_method; + const char *tpch_gfcs_method; };
const struct dptf_platform_info *get_dptf_platform_info(void);