soc/intel/cpulib: Remove redundent enable/disable functions
This patch removes multiple enable/disable function definitions and make use of single function with argument to know feature status (enable/disable). Change-Id: I502cd2497b07e9de062df453ecbb9c11df692f5a Signed-off-by: Subrata Banik <subrata.banik@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/32282 Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Lijian Zhao <lijian.zhao@intel.com> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
459df6697a
commit
6d569163ab
|
@ -94,10 +94,12 @@ void soc_core_init(struct device *cpu)
|
||||||
/* Set Max Non-Turbo ratio if RAPL is disabled. */
|
/* Set Max Non-Turbo ratio if RAPL is disabled. */
|
||||||
if (CONFIG(APL_SKIP_SET_POWER_LIMITS)) {
|
if (CONFIG(APL_SKIP_SET_POWER_LIMITS)) {
|
||||||
cpu_set_p_state_to_max_non_turbo_ratio();
|
cpu_set_p_state_to_max_non_turbo_ratio();
|
||||||
cpu_disable_eist();
|
/* Disable speed step */
|
||||||
|
cpu_set_eist(false);
|
||||||
} else if (CONFIG(APL_SET_MIN_CLOCK_RATIO)) {
|
} else if (CONFIG(APL_SET_MIN_CLOCK_RATIO)) {
|
||||||
cpu_set_p_state_to_min_clock_ratio();
|
cpu_set_p_state_to_min_clock_ratio();
|
||||||
cpu_disable_eist();
|
/* Disable speed step */
|
||||||
|
cpu_set_eist(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,10 +197,10 @@ void set_max_freq(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable burst mode */
|
/* Enable burst mode */
|
||||||
cpu_enable_burst_mode();
|
cpu_burst_mode(true);
|
||||||
|
|
||||||
/* Enable speed step. */
|
/* Enable speed step. */
|
||||||
cpu_enable_eist();
|
cpu_set_eist(true);
|
||||||
|
|
||||||
/* Set P-State ratio */
|
/* Set P-State ratio */
|
||||||
cpu_set_p_state_to_turbo_ratio();
|
cpu_set_p_state_to_turbo_ratio();
|
||||||
|
|
|
@ -269,10 +269,8 @@ static void configure_misc(void)
|
||||||
msr = rdmsr(IA32_MISC_ENABLE);
|
msr = rdmsr(IA32_MISC_ENABLE);
|
||||||
msr.lo |= (1 << 0); /* Fast String enable */
|
msr.lo |= (1 << 0); /* Fast String enable */
|
||||||
msr.lo |= (1 << 3); /* TM1/TM2/EMTTM enable */
|
msr.lo |= (1 << 3); /* TM1/TM2/EMTTM enable */
|
||||||
if (conf && conf->eist_enable)
|
/* Set EIST status */
|
||||||
cpu_enable_eist();
|
cpu_set_eist(conf->eist_enable);
|
||||||
else
|
|
||||||
cpu_disable_eist();
|
|
||||||
wrmsr(IA32_MISC_ENABLE, msr);
|
wrmsr(IA32_MISC_ENABLE, msr);
|
||||||
|
|
||||||
/* Disable Thermal interrupts */
|
/* Disable Thermal interrupts */
|
||||||
|
|
|
@ -185,50 +185,36 @@ int cpu_get_burst_mode_state(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable Burst mode.
|
* Program CPU Burst mode
|
||||||
|
* true = Enable Burst mode.
|
||||||
|
* false = Disable Burst mode.
|
||||||
*/
|
*/
|
||||||
void cpu_enable_burst_mode(void)
|
void cpu_burst_mode(bool burst_mode_status)
|
||||||
{
|
{
|
||||||
msr_t msr;
|
msr_t msr;
|
||||||
|
|
||||||
msr = rdmsr(IA32_MISC_ENABLE);
|
msr = rdmsr(IA32_MISC_ENABLE);
|
||||||
|
if (burst_mode_status)
|
||||||
msr.hi &= ~BURST_MODE_DISABLE;
|
msr.hi &= ~BURST_MODE_DISABLE;
|
||||||
wrmsr(IA32_MISC_ENABLE, msr);
|
else
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Disable Burst mode.
|
|
||||||
*/
|
|
||||||
void cpu_disable_burst_mode(void)
|
|
||||||
{
|
|
||||||
msr_t msr;
|
|
||||||
|
|
||||||
msr = rdmsr(IA32_MISC_ENABLE);
|
|
||||||
msr.hi |= BURST_MODE_DISABLE;
|
msr.hi |= BURST_MODE_DISABLE;
|
||||||
wrmsr(IA32_MISC_ENABLE, msr);
|
wrmsr(IA32_MISC_ENABLE, msr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable Intel Enhanced Speed Step Technology.
|
* Program Enhanced Intel Speed Step Technology
|
||||||
|
* true = Enable EIST.
|
||||||
|
* false = Disable EIST.
|
||||||
*/
|
*/
|
||||||
void cpu_enable_eist(void)
|
void cpu_set_eist(bool eist_status)
|
||||||
{
|
{
|
||||||
msr_t msr;
|
msr_t msr;
|
||||||
|
|
||||||
msr = rdmsr(IA32_MISC_ENABLE);
|
msr = rdmsr(IA32_MISC_ENABLE);
|
||||||
msr.lo |= (1 << 16); /* Enhanced SpeedStep Enable */
|
if (eist_status)
|
||||||
wrmsr(IA32_MISC_ENABLE, msr);
|
msr.lo |= (1 << 16);
|
||||||
}
|
else
|
||||||
|
msr.lo &= ~(1 << 16);
|
||||||
/*
|
|
||||||
* Disable Intel Enhanced Speed Step Technology.
|
|
||||||
*/
|
|
||||||
void cpu_disable_eist(void)
|
|
||||||
{
|
|
||||||
msr_t msr;
|
|
||||||
|
|
||||||
msr = rdmsr(IA32_MISC_ENABLE);
|
|
||||||
msr.lo &= ~(1 << 16); /* Enhanced SpeedStep Disable */
|
|
||||||
wrmsr(IA32_MISC_ENABLE, msr);
|
wrmsr(IA32_MISC_ENABLE, msr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,24 +97,18 @@ enum {
|
||||||
int cpu_get_burst_mode_state(void);
|
int cpu_get_burst_mode_state(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable Burst mode.
|
* Program CPU Burst mode
|
||||||
|
* true = Enable Burst mode.
|
||||||
|
* false = Disable Burst mode.
|
||||||
*/
|
*/
|
||||||
void cpu_enable_burst_mode(void);
|
void cpu_burst_mode(bool burst_mode_status);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disable Burst mode.
|
* Program Enhanced Intel Speed Step Technology
|
||||||
|
* true = Enable EIST.
|
||||||
|
* false = Disable EIST.
|
||||||
*/
|
*/
|
||||||
void cpu_disable_burst_mode(void);
|
void cpu_set_eist(bool eist_status);
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable Intel Enhanced Speed Step Technology.
|
|
||||||
*/
|
|
||||||
void cpu_enable_eist(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Disable Intel Enhanced Speed Step Technology.
|
|
||||||
*/
|
|
||||||
void cpu_disable_eist(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set Bit 6 (ENABLE_IA_UNTRUSTED_MODE) of MSR 0x120
|
* Set Bit 6 (ENABLE_IA_UNTRUSTED_MODE) of MSR 0x120
|
||||||
|
|
|
@ -73,10 +73,8 @@ static void configure_misc(void)
|
||||||
msr = rdmsr(IA32_MISC_ENABLE);
|
msr = rdmsr(IA32_MISC_ENABLE);
|
||||||
msr.lo |= (1 << 0); /* Fast String enable */
|
msr.lo |= (1 << 0); /* Fast String enable */
|
||||||
msr.lo |= (1 << 3); /* TM1/TM2/EMTTM enable */
|
msr.lo |= (1 << 3); /* TM1/TM2/EMTTM enable */
|
||||||
if (conf->eist_enable)
|
/* Set EIST status */
|
||||||
cpu_enable_eist();
|
cpu_set_eist(conf->eist_enable);
|
||||||
else
|
|
||||||
cpu_disable_eist();
|
|
||||||
wrmsr(IA32_MISC_ENABLE, msr);
|
wrmsr(IA32_MISC_ENABLE, msr);
|
||||||
|
|
||||||
/* Disable Thermal interrupts */
|
/* Disable Thermal interrupts */
|
||||||
|
|
Loading…
Reference in New Issue