Subrata Banik has uploaded this change for review.

View Change

soc/intel/cannonlake: Add kconfig to override CPU flex ratio

This patch provides options to override FIT default CPU flex
ratio from coreboot code. CONFIG_CPU_FLEX_RATIO to provide the
required CPU ratio and CONFIG_OVERRIDE_CPU_FLEX_RATIO to tell if
override is required.

TEST=Without override flex_ratio is 0 and verified booting to
OS after overriding with flex_ratio value 5.

Change-Id: Ib01650f52f3d402f669e7e7f5b28a648b86f08ec
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
---
M src/soc/intel/cannonlake/Kconfig
M src/soc/intel/cannonlake/romstage/fsp_params.c
2 files changed, 17 insertions(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/36864/1
diff --git a/src/soc/intel/cannonlake/Kconfig b/src/soc/intel/cannonlake/Kconfig
index 5731cff..3f7afea 100644
--- a/src/soc/intel/cannonlake/Kconfig
+++ b/src/soc/intel/cannonlake/Kconfig
@@ -332,4 +332,17 @@
hex
default 0x40000 # 256KB

+config OVERRIDE_CPU_FLEX_RATIO
+ bool
+ help
+ Provide an option to override CPU ratio value.
+
+config CPU_FLEX_RATIO
+ hex
+ depends on OVERRIDE_CPU_FLEX_RATIO
+ default 0
+ help
+ CPU ratio value controls the maximum processor non-turbo ratio.
+ Valid Range 0 to 63. CPU Ratio is 0 when disabled.
+
endif
diff --git a/src/soc/intel/cannonlake/romstage/fsp_params.c b/src/soc/intel/cannonlake/romstage/fsp_params.c
index 996c135..5c0328b 100644
--- a/src/soc/intel/cannonlake/romstage/fsp_params.c
+++ b/src/soc/intel/cannonlake/romstage/fsp_params.c
@@ -77,7 +77,10 @@
/* Set CpuRatio to match existing MSR value */
msr_t flex_ratio;
flex_ratio = rdmsr(MSR_FLEX_RATIO);
- m_cfg->CpuRatio = (flex_ratio.lo >> 8) & 0xff;
+ if (CONFIG(OVERRIDE_CPU_FLEX_RATIO))
+ m_cfg->CpuRatio = CONFIG_CPU_FLEX_RATIO;
+ else
+ m_cfg->CpuRatio = (flex_ratio.lo >> 8) & 0xff;

/* If ISH is enabled, enable ISH elements */
if (!dev)

To view, visit change 36864. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ib01650f52f3d402f669e7e7f5b28a648b86f08ec
Gerrit-Change-Number: 36864
Gerrit-PatchSet: 1
Gerrit-Owner: Subrata Banik <subrata.banik@intel.com>
Gerrit-MessageType: newchange