summaryrefslogtreecommitdiff
path: root/src/mainboard/google/rex/variants/baseboard
diff options
context:
space:
mode:
authorTony Huang <tony-huang@quanta.corp-partner.google.com>2024-05-06 16:11:28 +0800
committerFelix Held <felix-coreboot@felixheld.de>2024-05-16 11:28:58 +0000
commit3d4128299f87681b82a1485fa116ed59680eca97 (patch)
tree964dd2089c01b4a840159abd30eae2376d5c6b65 /src/mainboard/google/rex/variants/baseboard
parentff79993e958c548ad79535b178bbfd4c0da07992 (diff)
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>
Diffstat (limited to 'src/mainboard/google/rex/variants/baseboard')
-rw-r--r--src/mainboard/google/rex/variants/baseboard/include/baseboard/variants.h3
-rw-r--r--src/mainboard/google/rex/variants/baseboard/ovis/ramstage.c27
2 files changed, 30 insertions, 0 deletions
diff --git a/src/mainboard/google/rex/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/rex/variants/baseboard/include/baseboard/variants.h
index bd3d535c16..8a97d00deb 100644
--- a/src/mainboard/google/rex/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/google/rex/variants/baseboard/include/baseboard/variants.h
@@ -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,
diff --git a/src/mainboard/google/rex/variants/baseboard/ovis/ramstage.c b/src/mainboard/google/rex/variants/baseboard/ovis/ramstage.c
index 1eec1ec01b..2798be6c7b 100644
--- a/src/mainboard/google/rex/variants/baseboard/ovis/ramstage.c
+++ b/src/mainboard/google/rex/variants/baseboard/ovis/ramstage.c
@@ -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),