intel/common/cpulib: Add API to configure MCA

Add mca_configure() API to configure Intel Machine Check
Architecture (MCA).

Change-Id: I5e88c7527ce350824e48892caa978b2b78f1de20
Signed-off-by: Pratik Prajapati <pratikkumar.v.prajapati@intel.com>
Reviewed-on: https://review.coreboot.org/21239
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lijian Zhao <lijian.zhao@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Pratik Prajapati 2017-08-28 12:16:23 -07:00 committed by Martin Roth
parent 1f3daeab41
commit 4e20307052
2 changed files with 21 additions and 0 deletions

View File

@ -296,3 +296,21 @@ uint32_t cpu_get_max_turbo_ratio(void)
msr = rdmsr(MSR_TURBO_RATIO_LIMIT); msr = rdmsr(MSR_TURBO_RATIO_LIMIT);
return msr.lo & 0xff; return msr.lo & 0xff;
} }
void mca_configure(void)
{
msr_t msr;
int i;
int num_banks;
msr = rdmsr(IA32_MCG_CAP);
num_banks = msr.lo & 0xff;
msr.lo = msr.hi = 0;
for (i = 0; i < num_banks; i++) {
/* Clear the machine check status */
wrmsr(IA32_MC0_STATUS + (i * 4), msr);
/* Initialize machine checks */
wrmsr(IA32_MC0_CTL + i * 4,
(msr_t) {.lo = 0xffffffff, .hi = 0xffffffff});
}
}

View File

@ -156,4 +156,7 @@ uint32_t cpu_get_power_max(void);
*/ */
uint32_t cpu_get_max_turbo_ratio(void); uint32_t cpu_get_max_turbo_ratio(void);
/* Configure Machine Check Architecture support */
void mca_configure(void);
#endif /* SOC_INTEL_COMMON_BLOCK_CPULIB_H */ #endif /* SOC_INTEL_COMMON_BLOCK_CPULIB_H */