mb/prodrive/hermes/mb: Update SoC config in PRE_DEVICE
As one option is consumed by MPinit, update the soc config even earlier.
Tested on Prodrive hermes:
Turbo can be disabled and cores won't exceed their base frequency.
Change-Id: I9f444c3b91d2ee1a613ebac1922f1e6b60363c0b
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50798
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/src/mainboard/prodrive/hermes/mainboard.c b/src/mainboard/prodrive/hermes/mainboard.c
index c9ed7c1..2bc719a 100644
--- a/src/mainboard/prodrive/hermes/mainboard.c
+++ b/src/mainboard/prodrive/hermes/mainboard.c
@@ -5,6 +5,7 @@
#include <cbmem.h>
#include <console/console.h>
#include <crc_byte.h>
+#include <bootstate.h>
#include <device/device.h>
#include <device/dram/spd.h>
#include <intelblocks/pmclib.h>
@@ -136,11 +137,6 @@
if (!board_cfg)
return;
- /* Set Deep Sx */
- config_t *config = config_of_soc();
- config->deep_s5_enable_ac = board_cfg->deep_sx_enabled;
- config->deep_s5_enable_dc = board_cfg->deep_sx_enabled;
-
/* Enable internal speaker amplifier */
if (board_cfg->internal_audio_connection == 2)
mb_hda_amp_enable(1);
@@ -222,3 +218,29 @@
.init = mainboard_init,
.enable_dev = mainboard_enable,
};
+
+/* Must happen before MPinit */
+static void mainboard_early(void *unused)
+{
+ const struct eeprom_board_settings *const board_cfg = get_board_settings();
+ config_t *config = config_of_soc();
+
+ if (board_cfg) {
+ /* Set Deep Sx */
+ config->deep_s5_enable_ac = board_cfg->deep_sx_enabled;
+ config->deep_s5_enable_dc = board_cfg->deep_sx_enabled;
+ }
+
+ if (check_signature(offsetof(struct eeprom_layout, supd), FSPS_UPD_SIGNATURE)) {
+ struct {
+ struct {
+ u8 TurboMode;
+ } FspsConfig;
+ } supd = {0};
+
+ READ_EEPROM_FSP_S((&supd), FspsConfig.TurboMode);
+ config->cpu_turbo_disable = !supd.FspsConfig.TurboMode;
+ }
+}
+
+BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_EXIT, mainboard_early, NULL);