mb/google/rex/var/baseboard/ovis: Support CPU power limits per variant

There is no direct way to override CPU default power_limits for
different SKUs.

This CL add structure variant_get_soc_power_limit_config() for
variants to define and configure the values of soc_power_limits_config
for current CPU SKU.

Variants can override these values i.e. pl1, pl2, psyspl2
in variant_devtree_update().

BUG=b:320410462
BRANCH=firmware-rex-15709.B
TEST=FSP debug emerge-ovis coreboot intelfsp
     check overrides setting

Change-Id: Ib60fa4e3fc502d0aeb0c94ad46ba5a55b4dd027c
Signed-off-by: Tony Huang <tony-huang@quanta.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82199
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Eric Lai <ericllai@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Tony Huang
2024-05-06 16:11:28 +08:00
committed by Felix Held
parent ff79993e95
commit 3d4128299f
2 changed files with 30 additions and 0 deletions

View File

@@ -24,6 +24,9 @@ int variant_memory_sku(void);
bool variant_is_half_populated(void);
void variant_update_soc_chip_config(struct soc_intel_meteorlake_config *config);
/* Get soc power limit config struct for current CPU sku */
struct soc_power_limits_config *variant_get_soc_power_limit_config(void);
enum s0ix_entry {
S0IX_EXIT,
S0IX_ENTRY,

View File

@@ -1,8 +1,35 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <baseboard/variants.h>
#include <console/console.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <intelblocks/power_limit.h>
#include <soc/pci_devs.h>
struct soc_power_limits_config *variant_get_soc_power_limit_config(void)
{
config_t *config = config_of_soc();
uint16_t mchid = pci_s_read_config16(PCI_DEV(0, 0, 0), PCI_DEVICE_ID);
u8 tdp = get_cpu_tdp();
size_t i = 0;
if (mchid == 0xffff)
return NULL;
for (i = 0; i < ARRAY_SIZE(cpuid_to_mtl); i++) {
if (mchid == cpuid_to_mtl[i].cpu_id && tdp == cpuid_to_mtl[i].cpu_tdp) {
return &config->power_limits_config[cpuid_to_mtl[i].limits];
}
}
if (i == ARRAY_SIZE(cpuid_to_mtl)) {
printk(BIOS_ERR, "Cannot find correct ovis sku index.\n");
return NULL;
}
return NULL;
}
/*
* SKU_ID, TDP (Watts), pl1_min (milliWatts), pl1_max (milliWatts),