summaryrefslogtreecommitdiff
path: root/src/soc/intel/alderlake/systemagent.c
diff options
context:
space:
mode:
authorSumeet Pawnikar <sumeet.r.pawnikar@intel.com>2021-05-07 20:11:53 +0530
committerTim Wawrzynczak <twawrzynczak@chromium.org>2021-06-07 19:02:02 +0000
commitaa49608a2bf474355f0a7cf767e10326259254ed (patch)
treecf105fd3ea9503085c6b32042a214a1ad21c1981 /src/soc/intel/alderlake/systemagent.c
parent29405483cedca2035d1d0229a2ec893e53a6dcc9 (diff)
soc/intel/adl: Add SKU specific power limits support
Power limits (PL1 and PL2) depend on the specific SKU of the CPU. By expanding the SoC chip config power_limits_config member to an array indexed by ADL_*_POWER_LIMITS_*_CORE macros, the appropriate power limits are applied. Using this the correct set of power limits are being selected from the array based on system agent PCI ID. Based on this, chipset.cb file contains the set of power limits being used by varieties of ADL boards. These power limit values are as per document 619501. BUG=None BRANCH=None TEST=Built and verified the following console output on below boards On adlrvp (482): CPU PL1 = 28 Watts CPU PL2 = 64 Watts On adlrvp (682): CPU PL1 = 45 Watts CPU PL2 = 115 Watts On brya (282): CPU PL1 = 15 Watts CPU PL2 = 55 Watts Change-Id: Ic1676e2b4d611cdc85e770f131d5b6d5ecd180be Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/54676 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Selma Bensaid <selma.bensaid@intel.com>
Diffstat (limited to 'src/soc/intel/alderlake/systemagent.c')
-rw-r--r--src/soc/intel/alderlake/systemagent.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/soc/intel/alderlake/systemagent.c b/src/soc/intel/alderlake/systemagent.c
index eb1defc87a..acdaded685 100644
--- a/src/soc/intel/alderlake/systemagent.c
+++ b/src/soc/intel/alderlake/systemagent.c
@@ -6,8 +6,10 @@
* Chapter number: 3
*/
+#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
+#include <device/pci_ids.h>
#include <delay.h>
#include <intelblocks/power_limit.h>
#include <intelblocks/systemagent.h>
@@ -52,6 +54,8 @@ void soc_add_fixed_mmio_resources(struct device *dev, int *index)
void soc_systemagent_init(struct device *dev)
{
struct soc_power_limits_config *soc_config;
+ struct device *sa;
+ uint16_t sa_pci_id;
config_t *config;
/* Enable Power Aware Interrupt Routing */
@@ -63,7 +67,32 @@ void soc_systemagent_init(struct device *dev)
/* Configure turbo power limits 1ms after reset complete bit */
mdelay(1);
config = config_of_soc();
- soc_config = &config->power_limits_config;
+
+ /* Get System Agent PCI ID */
+ sa = pcidev_path_on_root(SA_DEVFN_ROOT);
+ sa_pci_id = sa ? pci_read_config16(sa, PCI_DEVICE_ID) : 0xFFFF;
+
+ /* Choose a power limits configuration based on the SoC SKU type,
+ * differentiated here based on SA PCI ID. */
+ switch (sa_pci_id) {
+ case PCI_DEVICE_ID_INTEL_ADL_P_ID_7:
+ soc_config = &config->power_limits_config[ADL_P_POWER_LIMITS_282_CORE];
+ break;
+ case PCI_DEVICE_ID_INTEL_ADL_P_ID_5:
+ soc_config = &config->power_limits_config[ADL_P_POWER_LIMITS_482_CORE];
+ break;
+ case PCI_DEVICE_ID_INTEL_ADL_P_ID_3:
+ soc_config = &config->power_limits_config[ADL_P_POWER_LIMITS_682_CORE];
+ break;
+ case PCI_DEVICE_ID_INTEL_ADL_M_ID_1:
+ soc_config = &config->power_limits_config[ADL_M_POWER_LIMITS_282_CORE];
+ break;
+ default:
+ printk(BIOS_ERR, "ADL: unknown SA ID: 0x%4x, skipping power limits configuration\n",
+ sa_pci_id);
+ return;
+ }
+
set_power_limits(MOBILE_SKU_PL1_TIME_SEC, soc_config);
}