{cpu,soc}/intel: deduplicate cpu code
Move a whole bunch of copy-pasta code from soc/intel/{bdw,skl,cnl,icl, tgl,ehl,jsl,adl} and cpu/intel/{hsw,model_*} to cpu/intel/common. This change just moves the code. Rework is done in CB:46588. Change-Id: Ib0cc834de8492d59c423317598e1c11847a0b1ab Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46274 Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
29a52c8308
commit
10ae1cf2cd
|
@ -33,4 +33,10 @@ bool intel_ht_sibling(void);
|
|||
*/
|
||||
void set_aesni_lock(void);
|
||||
|
||||
void enable_lapic_tpr(void);
|
||||
|
||||
void configure_dca_cap(void);
|
||||
|
||||
void set_energy_perf_bias(u8 policy);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <arch/cpu.h>
|
||||
#include <console/console.h>
|
||||
#include <cpu/intel/msr.h>
|
||||
#include <cpu/x86/lapic.h>
|
||||
#include <cpu/x86/msr.h>
|
||||
#include "common.h"
|
||||
|
||||
|
@ -286,3 +287,45 @@ void set_aesni_lock(void)
|
|||
|
||||
msr_set(MSR_FEATURE_CONFIG, AESNI_LOCK);
|
||||
}
|
||||
|
||||
void enable_lapic_tpr(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
msr = rdmsr(MSR_PIC_MSG_CONTROL);
|
||||
msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */
|
||||
wrmsr(MSR_PIC_MSG_CONTROL, msr);
|
||||
}
|
||||
|
||||
void configure_dca_cap(void)
|
||||
{
|
||||
uint32_t feature_flag;
|
||||
msr_t msr;
|
||||
|
||||
/* Check feature flag in CPUID.(EAX=1):ECX[18]==1 */
|
||||
feature_flag = cpu_get_feature_flags_ecx();
|
||||
if (feature_flag & CPUID_DCA) {
|
||||
msr = rdmsr(IA32_PLATFORM_DCA_CAP);
|
||||
msr.lo |= 1;
|
||||
wrmsr(IA32_PLATFORM_DCA_CAP, msr);
|
||||
}
|
||||
}
|
||||
|
||||
void set_energy_perf_bias(u8 policy)
|
||||
{
|
||||
msr_t msr;
|
||||
int ecx;
|
||||
|
||||
/* Determine if energy efficient policy is supported. */
|
||||
ecx = cpuid_ecx(0x6);
|
||||
if (!(ecx & (1 << 3)))
|
||||
return;
|
||||
|
||||
/* Energy Policy is bits 3:0 */
|
||||
msr = rdmsr(IA32_ENERGY_PERF_BIAS);
|
||||
msr.lo &= ~0xf;
|
||||
msr.lo |= policy & 0xf;
|
||||
wrmsr(IA32_ENERGY_PERF_BIAS, msr);
|
||||
|
||||
printk(BIOS_DEBUG, "cpu: energy policy set to %u\n", policy);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#define MSR_TEMPERATURE_TARGET 0x1a2
|
||||
#define MSR_LT_LOCK_MEMORY 0x2e7
|
||||
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
#define MSR_PLATFORM_INFO 0xce
|
||||
#define PLATFORM_INFO_SET_TDP (1 << 29)
|
||||
#define MSR_PKG_CST_CONFIG_CONTROL 0xe2
|
||||
|
|
|
@ -577,29 +577,6 @@ static void configure_misc(void)
|
|||
wrmsr(IA32_PACKAGE_THERM_INTERRUPT, msr);
|
||||
}
|
||||
|
||||
static void enable_lapic_tpr(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
msr = rdmsr(MSR_PIC_MSG_CONTROL);
|
||||
msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */
|
||||
wrmsr(MSR_PIC_MSG_CONTROL, msr);
|
||||
}
|
||||
|
||||
static void configure_dca_cap(void)
|
||||
{
|
||||
uint32_t feature_flag;
|
||||
msr_t msr;
|
||||
|
||||
/* Check feature flag in CPUID.(EAX=1):ECX[18]==1 */
|
||||
feature_flag = cpu_get_feature_flags_ecx();
|
||||
if (feature_flag & CPUID_DCA) {
|
||||
msr = rdmsr(IA32_PLATFORM_DCA_CAP);
|
||||
msr.lo |= 1;
|
||||
wrmsr(IA32_PLATFORM_DCA_CAP, msr);
|
||||
}
|
||||
}
|
||||
|
||||
static void set_max_ratio(void)
|
||||
{
|
||||
msr_t msr, perf_ctl;
|
||||
|
@ -622,25 +599,6 @@ static void set_max_ratio(void)
|
|||
((perf_ctl.lo >> 8) & 0xff) * HASWELL_BCLK);
|
||||
}
|
||||
|
||||
static void set_energy_perf_bias(u8 policy)
|
||||
{
|
||||
msr_t msr;
|
||||
int ecx;
|
||||
|
||||
/* Determine if energy efficient policy is supported. */
|
||||
ecx = cpuid_ecx(0x6);
|
||||
if (!(ecx & (1 << 3)))
|
||||
return;
|
||||
|
||||
/* Energy Policy is bits 3:0 */
|
||||
msr = rdmsr(IA32_ENERGY_PERF_BIAS);
|
||||
msr.lo &= ~0xf;
|
||||
msr.lo |= policy & 0xf;
|
||||
wrmsr(IA32_ENERGY_PERF_BIAS, msr);
|
||||
|
||||
printk(BIOS_DEBUG, "CPU: energy policy set to %u\n", policy);
|
||||
}
|
||||
|
||||
static void configure_mca(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#define IA32_FERR_CAPABILITY 0x1f1
|
||||
#define FERR_ENABLE (1 << 0)
|
||||
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
#define MSR_PLATFORM_INFO 0xce
|
||||
#define PLATFORM_INFO_SET_TDP (1 << 29)
|
||||
|
||||
|
|
|
@ -148,15 +148,6 @@ static void configure_misc(void)
|
|||
wrmsr(IA32_THERM_INTERRUPT, msr);
|
||||
}
|
||||
|
||||
static void enable_lapic_tpr(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
msr = rdmsr(MSR_PIC_MSG_CONTROL);
|
||||
msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */
|
||||
wrmsr(MSR_PIC_MSG_CONTROL, msr);
|
||||
}
|
||||
|
||||
static void set_max_ratio(void)
|
||||
{
|
||||
msr_t msr, perf_ctl;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#define FLEX_RATIO_EN (1 << 16)
|
||||
#define MSR_TEMPERATURE_TARGET 0x1a2
|
||||
#define MSR_LT_LOCK_MEMORY 0x2e7
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
#define MSR_PLATFORM_INFO 0xce
|
||||
#define PLATFORM_INFO_SET_TDP (1 << 29)
|
||||
|
||||
|
|
|
@ -338,29 +338,6 @@ static void configure_misc(void)
|
|||
wrmsr(IA32_PACKAGE_THERM_INTERRUPT, msr);
|
||||
}
|
||||
|
||||
static void enable_lapic_tpr(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
msr = rdmsr(MSR_PIC_MSG_CONTROL);
|
||||
msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */
|
||||
wrmsr(MSR_PIC_MSG_CONTROL, msr);
|
||||
}
|
||||
|
||||
static void configure_dca_cap(void)
|
||||
{
|
||||
uint32_t feature_flag;
|
||||
msr_t msr;
|
||||
|
||||
/* Check feature flag in CPUID.(EAX=1):ECX[18]==1 */
|
||||
feature_flag = cpu_get_feature_flags_ecx();
|
||||
if (feature_flag & CPUID_DCA) {
|
||||
msr = rdmsr(IA32_PLATFORM_DCA_CAP);
|
||||
msr.lo |= 1;
|
||||
wrmsr(IA32_PLATFORM_DCA_CAP, msr);
|
||||
}
|
||||
}
|
||||
|
||||
static void set_max_ratio(void)
|
||||
{
|
||||
msr_t msr, perf_ctl;
|
||||
|
@ -383,20 +360,6 @@ static void set_max_ratio(void)
|
|||
((perf_ctl.lo >> 8) & 0xff) * SANDYBRIDGE_BCLK);
|
||||
}
|
||||
|
||||
static void set_energy_perf_bias(u8 policy)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
/* Energy Policy is bits 3:0 */
|
||||
msr = rdmsr(IA32_ENERGY_PERF_BIAS);
|
||||
msr.lo &= ~0xf;
|
||||
msr.lo |= policy & 0xf;
|
||||
wrmsr(IA32_ENERGY_PERF_BIAS, msr);
|
||||
|
||||
printk(BIOS_DEBUG, "model_x06ax: energy policy set to %u\n",
|
||||
policy);
|
||||
}
|
||||
|
||||
static void configure_mca(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
|
|
@ -9,4 +9,6 @@
|
|||
#define AESNI_DISABLE (1 << 1)
|
||||
#define AESNI_LOCK (1 << 0)
|
||||
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
|
||||
#endif /* CPU_INTEL_MSR_H */
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <cpu/x86/msr.h>
|
||||
#include <cpu/intel/smm_reloc.h>
|
||||
#include <cpu/intel/turbo.h>
|
||||
#include <cpu/intel/common/common.h>
|
||||
#include <fsp/api.h>
|
||||
#include <intelblocks/cpulib.h>
|
||||
#include <intelblocks/mp_init.h>
|
||||
|
@ -86,29 +87,6 @@ static void configure_misc(void)
|
|||
wrmsr(MSR_POWER_CTL, msr);
|
||||
}
|
||||
|
||||
static void enable_lapic_tpr(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
msr = rdmsr(MSR_PIC_MSG_CONTROL);
|
||||
msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */
|
||||
wrmsr(MSR_PIC_MSG_CONTROL, msr);
|
||||
}
|
||||
|
||||
static void configure_dca_cap(void)
|
||||
{
|
||||
uint32_t feature_flag;
|
||||
msr_t msr;
|
||||
|
||||
/* Check feature flag in CPUID.(EAX=1):ECX[18]==1 */
|
||||
feature_flag = cpu_get_feature_flags_ecx();
|
||||
if (feature_flag & CPUID_DCA) {
|
||||
msr = rdmsr(IA32_PLATFORM_DCA_CAP);
|
||||
msr.lo |= 1;
|
||||
wrmsr(IA32_PLATFORM_DCA_CAP, msr);
|
||||
}
|
||||
}
|
||||
|
||||
static void enable_pm_timer_emulation(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
@ -128,23 +106,6 @@ static void enable_pm_timer_emulation(void)
|
|||
wrmsr(MSR_EMULATE_PM_TIMER, msr);
|
||||
}
|
||||
|
||||
static void set_energy_perf_bias(u8 policy)
|
||||
{
|
||||
msr_t msr;
|
||||
int ecx;
|
||||
|
||||
/* Determine if energy efficient policy is supported. */
|
||||
ecx = cpuid_ecx(0x6);
|
||||
if (!(ecx & (1 << 3)))
|
||||
return;
|
||||
|
||||
/* Energy Policy is bits 3:0 */
|
||||
msr = rdmsr(IA32_ENERGY_PERF_BIAS);
|
||||
msr.lo &= ~0xf;
|
||||
msr.lo |= policy & 0xf;
|
||||
wrmsr(IA32_ENERGY_PERF_BIAS, msr);
|
||||
}
|
||||
|
||||
/* All CPUs including BSP will run the following function. */
|
||||
void soc_core_init(struct device *cpu)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <intelblocks/msr.h>
|
||||
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
#define MSR_VR_MISC_CONFIG2 0x636
|
||||
|
||||
#endif
|
||||
|
|
|
@ -311,29 +311,6 @@ static void configure_misc(void)
|
|||
wrmsr(IA32_PACKAGE_THERM_INTERRUPT, msr);
|
||||
}
|
||||
|
||||
static void enable_lapic_tpr(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
msr = rdmsr(MSR_PIC_MSG_CONTROL);
|
||||
msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */
|
||||
wrmsr(MSR_PIC_MSG_CONTROL, msr);
|
||||
}
|
||||
|
||||
static void configure_dca_cap(void)
|
||||
{
|
||||
uint32_t feature_flag;
|
||||
msr_t msr;
|
||||
|
||||
/* Check feature flag in CPUID.(EAX=1):ECX[18]==1 */
|
||||
feature_flag = cpu_get_feature_flags_ecx();
|
||||
if (feature_flag & CPUID_DCA) {
|
||||
msr = rdmsr(IA32_PLATFORM_DCA_CAP);
|
||||
msr.lo |= 1;
|
||||
wrmsr(IA32_PLATFORM_DCA_CAP, msr);
|
||||
}
|
||||
}
|
||||
|
||||
static void set_max_ratio(void)
|
||||
{
|
||||
msr_t msr, perf_ctl;
|
||||
|
@ -359,25 +336,6 @@ static void set_max_ratio(void)
|
|||
((perf_ctl.lo >> 8) & 0xff) * CPU_BCLK);
|
||||
}
|
||||
|
||||
static void set_energy_perf_bias(u8 policy)
|
||||
{
|
||||
msr_t msr;
|
||||
int ecx;
|
||||
|
||||
/* Determine if energy efficient policy is supported. */
|
||||
ecx = cpuid_ecx(0x6);
|
||||
if (!(ecx & (1 << 3)))
|
||||
return;
|
||||
|
||||
/* Energy Policy is bits 3:0 */
|
||||
msr = rdmsr(IA32_ENERGY_PERF_BIAS);
|
||||
msr.lo &= ~0xf;
|
||||
msr.lo |= policy & 0xf;
|
||||
wrmsr(IA32_ENERGY_PERF_BIAS, msr);
|
||||
|
||||
printk(BIOS_DEBUG, "CPU: energy policy set to %u\n", policy);
|
||||
}
|
||||
|
||||
static void configure_mca(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <intelblocks/msr.h>
|
||||
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
#define MSR_CORE_THREAD_COUNT 0x35
|
||||
#define MSR_PLATFORM_INFO 0xce
|
||||
#define PLATFORM_INFO_SET_TDP (1 << 29)
|
||||
|
|
|
@ -83,29 +83,6 @@ static void configure_misc(void)
|
|||
wrmsr(MSR_POWER_CTL, msr);
|
||||
}
|
||||
|
||||
static void enable_lapic_tpr(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
msr = rdmsr(MSR_PIC_MSG_CONTROL);
|
||||
msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */
|
||||
wrmsr(MSR_PIC_MSG_CONTROL, msr);
|
||||
}
|
||||
|
||||
static void configure_dca_cap(void)
|
||||
{
|
||||
uint32_t feature_flag;
|
||||
msr_t msr;
|
||||
|
||||
/* Check feature flag in CPUID.(EAX=1):ECX[18]==1 */
|
||||
feature_flag = cpu_get_feature_flags_ecx();
|
||||
if (feature_flag & CPUID_DCA) {
|
||||
msr = rdmsr(IA32_PLATFORM_DCA_CAP);
|
||||
msr.lo |= 1;
|
||||
wrmsr(IA32_PLATFORM_DCA_CAP, msr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The emulated ACPI timer allows replacing of the ACPI timer
|
||||
* (PM1_TMR) to have no impart on the system.
|
||||
|
@ -129,24 +106,6 @@ static void enable_pm_timer_emulation(void)
|
|||
wrmsr(MSR_EMULATE_PM_TIMER, msr);
|
||||
}
|
||||
|
||||
|
||||
static void set_energy_perf_bias(u8 policy)
|
||||
{
|
||||
msr_t msr;
|
||||
int ecx;
|
||||
|
||||
/* Determine if energy efficient policy is supported. */
|
||||
ecx = cpuid_ecx(0x6);
|
||||
if (!(ecx & (1 << 3)))
|
||||
return;
|
||||
|
||||
/* Energy Policy is bits 3:0 */
|
||||
msr = rdmsr(IA32_ENERGY_PERF_BIAS);
|
||||
msr.lo &= ~0xf;
|
||||
msr.lo |= policy & 0xf;
|
||||
wrmsr(IA32_ENERGY_PERF_BIAS, msr);
|
||||
}
|
||||
|
||||
static void configure_c_states(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <intelblocks/msr.h>
|
||||
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
#define MSR_VR_CURRENT_CONFIG 0x601
|
||||
#define MSR_PL3_CONTROL 0x615
|
||||
#define MSR_VR_MISC_CONFIG2 0x636
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#ifndef _DENVERTON_NS_MSR_H_
|
||||
#define _DENVERTON_NS_MSR_H_
|
||||
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
#define MSR_CORE_THREAD_COUNT 0x35
|
||||
#define MSR_PLATFORM_INFO 0xce
|
||||
#define PLATFORM_INFO_SET_TDP (1 << 29)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <console/console.h>
|
||||
#include <cpu/intel/smm_reloc.h>
|
||||
#include <cpu/intel/turbo.h>
|
||||
#include <cpu/intel/common/common.h>
|
||||
#include <cpu/x86/lapic.h>
|
||||
#include <cpu/x86/mp.h>
|
||||
#include <cpu/x86/msr.h>
|
||||
|
@ -80,29 +81,6 @@ static void configure_misc(void)
|
|||
wrmsr(MSR_POWER_CTL, msr);
|
||||
}
|
||||
|
||||
static void enable_lapic_tpr(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
msr = rdmsr(MSR_PIC_MSG_CONTROL);
|
||||
msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */
|
||||
wrmsr(MSR_PIC_MSG_CONTROL, msr);
|
||||
}
|
||||
|
||||
static void configure_dca_cap(void)
|
||||
{
|
||||
uint32_t feature_flag;
|
||||
msr_t msr;
|
||||
|
||||
/* Check feature flag in CPUID.(EAX=1):ECX[18]==1 */
|
||||
feature_flag = cpu_get_feature_flags_ecx();
|
||||
if (feature_flag & CPUID_DCA) {
|
||||
msr = rdmsr(IA32_PLATFORM_DCA_CAP);
|
||||
msr.lo |= 1;
|
||||
wrmsr(IA32_PLATFORM_DCA_CAP, msr);
|
||||
}
|
||||
}
|
||||
|
||||
static void enable_pm_timer_emulation(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
@ -122,23 +100,6 @@ static void enable_pm_timer_emulation(void)
|
|||
wrmsr(MSR_EMULATE_PM_TIMER, msr);
|
||||
}
|
||||
|
||||
static void set_energy_perf_bias(u8 policy)
|
||||
{
|
||||
msr_t msr;
|
||||
int ecx;
|
||||
|
||||
/* Determine if energy efficient policy is supported. */
|
||||
ecx = cpuid_ecx(0x6);
|
||||
if (!(ecx & (1 << 3)))
|
||||
return;
|
||||
|
||||
/* Energy Policy is bits 3:0 */
|
||||
msr = rdmsr(IA32_ENERGY_PERF_BIAS);
|
||||
msr.lo &= ~0xf;
|
||||
msr.lo |= policy & 0xf;
|
||||
wrmsr(IA32_ENERGY_PERF_BIAS, msr);
|
||||
}
|
||||
|
||||
/* All CPUs including BSP will run the following function. */
|
||||
void soc_core_init(struct device *cpu)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <intelblocks/msr.h>
|
||||
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
#define MSR_VR_MISC_CONFIG2 0x636
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,6 +32,7 @@ config CPU_SPECIFIC_OPTIONS
|
|||
select REG_SCRIPT
|
||||
select PMC_GLOBAL_RESET_ENABLE_LOCK
|
||||
select PMC_LOW_POWER_MODE_PROGRAM
|
||||
select CPU_INTEL_COMMON
|
||||
select CPU_INTEL_COMMON_SMM
|
||||
select SOC_INTEL_COMMON
|
||||
select SOC_INTEL_COMMON_ACPI_WAKE_SOURCE
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <cpu/x86/msr.h>
|
||||
#include <cpu/intel/smm_reloc.h>
|
||||
#include <cpu/intel/turbo.h>
|
||||
#include <cpu/intel/common/common.h>
|
||||
#include <fsp/api.h>
|
||||
#include <intelblocks/cpulib.h>
|
||||
#include <intelblocks/mp_init.h>
|
||||
|
@ -80,29 +81,6 @@ static void configure_misc(void)
|
|||
wrmsr(MSR_POWER_CTL, msr);
|
||||
}
|
||||
|
||||
static void enable_lapic_tpr(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
msr = rdmsr(MSR_PIC_MSG_CONTROL);
|
||||
msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */
|
||||
wrmsr(MSR_PIC_MSG_CONTROL, msr);
|
||||
}
|
||||
|
||||
static void configure_dca_cap(void)
|
||||
{
|
||||
uint32_t feature_flag;
|
||||
msr_t msr;
|
||||
|
||||
/* Check feature flag in CPUID.(EAX=1):ECX[18]==1 */
|
||||
feature_flag = cpu_get_feature_flags_ecx();
|
||||
if (feature_flag & CPUID_DCA) {
|
||||
msr = rdmsr(IA32_PLATFORM_DCA_CAP);
|
||||
msr.lo |= 1;
|
||||
wrmsr(IA32_PLATFORM_DCA_CAP, msr);
|
||||
}
|
||||
}
|
||||
|
||||
static void enable_pm_timer_emulation(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
@ -122,23 +100,6 @@ static void enable_pm_timer_emulation(void)
|
|||
wrmsr(MSR_EMULATE_PM_TIMER, msr);
|
||||
}
|
||||
|
||||
static void set_energy_perf_bias(u8 policy)
|
||||
{
|
||||
msr_t msr;
|
||||
int ecx;
|
||||
|
||||
/* Determine if energy efficient policy is supported. */
|
||||
ecx = cpuid_ecx(0x6);
|
||||
if (!(ecx & (1 << 3)))
|
||||
return;
|
||||
|
||||
/* Energy Policy is bits 3:0 */
|
||||
msr = rdmsr(IA32_ENERGY_PERF_BIAS);
|
||||
msr.lo &= ~0xf;
|
||||
msr.lo |= policy & 0xf;
|
||||
wrmsr(IA32_ENERGY_PERF_BIAS, msr);
|
||||
}
|
||||
|
||||
static void configure_c_states(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <intelblocks/msr.h>
|
||||
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
#define MSR_VR_MISC_CONFIG2 0x636
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <cpu/x86/msr.h>
|
||||
#include <cpu/intel/smm_reloc.h>
|
||||
#include <cpu/intel/turbo.h>
|
||||
#include <cpu/intel/common/common.h>
|
||||
#include <fsp/api.h>
|
||||
#include <intelblocks/cpulib.h>
|
||||
#include <intelblocks/mp_init.h>
|
||||
|
@ -80,29 +81,6 @@ static void configure_misc(void)
|
|||
wrmsr(MSR_POWER_CTL, msr);
|
||||
}
|
||||
|
||||
static void enable_lapic_tpr(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
msr = rdmsr(MSR_PIC_MSG_CONTROL);
|
||||
msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */
|
||||
wrmsr(MSR_PIC_MSG_CONTROL, msr);
|
||||
}
|
||||
|
||||
static void configure_dca_cap(void)
|
||||
{
|
||||
uint32_t feature_flag;
|
||||
msr_t msr;
|
||||
|
||||
/* Check feature flag in CPUID.(EAX=1):ECX[18]==1 */
|
||||
feature_flag = cpu_get_feature_flags_ecx();
|
||||
if (feature_flag & CPUID_DCA) {
|
||||
msr = rdmsr(IA32_PLATFORM_DCA_CAP);
|
||||
msr.lo |= 1;
|
||||
wrmsr(IA32_PLATFORM_DCA_CAP, msr);
|
||||
}
|
||||
}
|
||||
|
||||
static void enable_pm_timer_emulation(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
@ -122,23 +100,6 @@ static void enable_pm_timer_emulation(void)
|
|||
wrmsr(MSR_EMULATE_PM_TIMER, msr);
|
||||
}
|
||||
|
||||
static void set_energy_perf_bias(u8 policy)
|
||||
{
|
||||
msr_t msr;
|
||||
int ecx;
|
||||
|
||||
/* Determine if energy efficient policy is supported. */
|
||||
ecx = cpuid_ecx(0x6);
|
||||
if (!(ecx & (1 << 3)))
|
||||
return;
|
||||
|
||||
/* Energy Policy is bits 3:0 */
|
||||
msr = rdmsr(IA32_ENERGY_PERF_BIAS);
|
||||
msr.lo &= ~0xf;
|
||||
msr.lo |= policy & 0xf;
|
||||
wrmsr(IA32_ENERGY_PERF_BIAS, msr);
|
||||
}
|
||||
|
||||
/* All CPUs including BSP will run the following function. */
|
||||
void soc_core_init(struct device *cpu)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <intelblocks/msr.h>
|
||||
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
#define MSR_VR_MISC_CONFIG2 0x636
|
||||
|
||||
#endif
|
||||
|
|
|
@ -83,48 +83,6 @@ static void configure_misc(void)
|
|||
wrmsr(MSR_POWER_CTL, msr);
|
||||
}
|
||||
|
||||
static void enable_lapic_tpr(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
msr = rdmsr(MSR_PIC_MSG_CONTROL);
|
||||
msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */
|
||||
wrmsr(MSR_PIC_MSG_CONTROL, msr);
|
||||
}
|
||||
|
||||
static void configure_dca_cap(void)
|
||||
{
|
||||
uint32_t feature_flag;
|
||||
msr_t msr;
|
||||
|
||||
/* Check feature flag in CPUID.(EAX=1):ECX[18]==1 */
|
||||
feature_flag = cpu_get_feature_flags_ecx();
|
||||
if (feature_flag & CPUID_DCA) {
|
||||
msr = rdmsr(IA32_PLATFORM_DCA_CAP);
|
||||
msr.lo |= 1;
|
||||
wrmsr(IA32_PLATFORM_DCA_CAP, msr);
|
||||
}
|
||||
}
|
||||
|
||||
static void set_energy_perf_bias(u8 policy)
|
||||
{
|
||||
msr_t msr;
|
||||
int ecx;
|
||||
|
||||
/* Determine if energy efficient policy is supported. */
|
||||
ecx = cpuid_ecx(0x6);
|
||||
if (!(ecx & (1 << 3)))
|
||||
return;
|
||||
|
||||
/* Energy Policy is bits 3:0 */
|
||||
msr = rdmsr(IA32_ENERGY_PERF_BIAS);
|
||||
msr.lo &= ~0xf;
|
||||
msr.lo |= policy & 0xf;
|
||||
wrmsr(IA32_ENERGY_PERF_BIAS, msr);
|
||||
|
||||
printk(BIOS_DEBUG, "cpu: energy policy set to %u\n", policy);
|
||||
}
|
||||
|
||||
static void configure_c_states(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <intelblocks/msr.h>
|
||||
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
#define MSR_LT_LOCK_MEMORY 0x2e7
|
||||
#define MSR_UNCORE_PRMRR_PHYS_BASE 0x2f4
|
||||
#define MSR_UNCORE_PRMRR_PHYS_MASK 0x2f5
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <cpu/x86/msr.h>
|
||||
#include <cpu/intel/smm_reloc.h>
|
||||
#include <cpu/intel/turbo.h>
|
||||
#include <cpu/intel/common/common.h>
|
||||
#include <fsp/api.h>
|
||||
#include <intelblocks/cpulib.h>
|
||||
#include <intelblocks/mp_init.h>
|
||||
|
@ -86,29 +87,6 @@ static void configure_misc(void)
|
|||
wrmsr(MSR_POWER_CTL, msr);
|
||||
}
|
||||
|
||||
static void enable_lapic_tpr(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
||||
msr = rdmsr(MSR_PIC_MSG_CONTROL);
|
||||
msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */
|
||||
wrmsr(MSR_PIC_MSG_CONTROL, msr);
|
||||
}
|
||||
|
||||
static void configure_dca_cap(void)
|
||||
{
|
||||
uint32_t feature_flag;
|
||||
msr_t msr;
|
||||
|
||||
/* Check feature flag in CPUID.(EAX=1):ECX[18]==1 */
|
||||
feature_flag = cpu_get_feature_flags_ecx();
|
||||
if (feature_flag & CPUID_DCA) {
|
||||
msr = rdmsr(IA32_PLATFORM_DCA_CAP);
|
||||
msr.lo |= 1;
|
||||
wrmsr(IA32_PLATFORM_DCA_CAP, msr);
|
||||
}
|
||||
}
|
||||
|
||||
static void enable_pm_timer_emulation(void)
|
||||
{
|
||||
msr_t msr;
|
||||
|
@ -128,23 +106,6 @@ static void enable_pm_timer_emulation(void)
|
|||
wrmsr(MSR_EMULATE_PM_TIMER, msr);
|
||||
}
|
||||
|
||||
static void set_energy_perf_bias(u8 policy)
|
||||
{
|
||||
msr_t msr;
|
||||
int ecx;
|
||||
|
||||
/* Determine if energy efficient policy is supported. */
|
||||
ecx = cpuid_ecx(0x6);
|
||||
if (!(ecx & (1 << 3)))
|
||||
return;
|
||||
|
||||
/* Energy Policy is bits 3:0 */
|
||||
msr = rdmsr(IA32_ENERGY_PERF_BIAS);
|
||||
msr.lo &= ~0xf;
|
||||
msr.lo |= policy & 0xf;
|
||||
wrmsr(IA32_ENERGY_PERF_BIAS, msr);
|
||||
}
|
||||
|
||||
/* All CPUs including BSP will run the following function. */
|
||||
void soc_core_init(struct device *cpu)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <intelblocks/msr.h>
|
||||
|
||||
#define MSR_PIC_MSG_CONTROL 0x2e
|
||||
#define MSR_VR_MISC_CONFIG2 0x636
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue