From 52ef869b94b43ec9065350dc17ba9057b8a509e1 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Tue, 16 Feb 2021 13:16:25 +0100 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50798 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/mainboard/prodrive/hermes/mainboard.c | 32 ++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/mainboard/prodrive/hermes/mainboard.c b/src/mainboard/prodrive/hermes/mainboard.c index c9ed7c12fb..2bc719a392 100644 --- a/src/mainboard/prodrive/hermes/mainboard.c +++ b/src/mainboard/prodrive/hermes/mainboard.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -136,11 +137,6 @@ static void mainboard_init(void *chip_info) 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 @@ struct chip_operations mainboard_ops = { .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); -- cgit v1.2.3