diff options
Diffstat (limited to 'src/soc/intel/jasperlake/systemagent.c')
-rw-r--r-- | src/soc/intel/jasperlake/systemagent.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/soc/intel/jasperlake/systemagent.c b/src/soc/intel/jasperlake/systemagent.c index fd04be589f..f0e9d44bbb 100644 --- a/src/soc/intel/jasperlake/systemagent.c +++ b/src/soc/intel/jasperlake/systemagent.c @@ -1,5 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <chip.h> +#include <console/console.h> #include <device/device.h> #include <delay.h> #include <device/pci.h> @@ -48,6 +50,9 @@ void soc_systemagent_init(struct device *dev) { struct soc_power_limits_config *soc_config; config_t *config; + uint16_t sa_pci_id; + uint8_t tdp; + size_t i = 0; /* Enable Power Aware Interrupt Routing */ enable_power_aware_intr(); @@ -57,6 +62,29 @@ void soc_systemagent_init(struct device *dev) mdelay(1); config = config_of_soc(); - soc_config = &config->power_limits_config; - set_power_limits(MOBILE_SKU_PL1_TIME_SEC, soc_config); + + /* Get System Agent PCI ID */ + sa_pci_id = dev ? pci_read_config16(dev, PCI_DEVICE_ID) : 0xFFFF; + + if (sa_pci_id != 0xFFFF) { + tdp = get_cpu_tdp(); + + /* Choose power limits configuration based on the CPU SA PCI ID and + * CPU TDP value. */ + for (i = 0; i < ARRAY_SIZE(cpuid_to_jsl); i++) { + if (sa_pci_id == cpuid_to_jsl[i].pci_did && + tdp == cpuid_to_jsl[i].cpu_tdp) { + soc_config = &config->power_limits_config[cpuid_to_jsl[i].limits]; + set_power_limits(MOBILE_SKU_PL1_TIME_SEC, soc_config); + break; + } + } + } + + if (i == ARRAY_SIZE(cpuid_to_jsl) || sa_pci_id == 0xFFFF) { + printk(BIOS_ERR, "unknown SA ID: 0x%4x, can't find its TDP." + " Skipped power limits configuration.\n", + sa_pci_id); + return; + } } |