summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard')
-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),