From 4e203070523a04f10252a0bb68cb4467b32748fc Mon Sep 17 00:00:00 2001 From: Pratik Prajapati Date: Mon, 28 Aug 2017 12:16:23 -0700 Subject: 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 Reviewed-on: https://review.coreboot.org/21239 Tested-by: build bot (Jenkins) Reviewed-by: Lijian Zhao Reviewed-by: Aaron Durbin --- src/soc/intel/common/block/cpu/cpulib.c | 18 ++++++++++++++++++ .../intel/common/block/include/intelblocks/cpulib.h | 3 +++ 2 files changed, 21 insertions(+) (limited to 'src/soc') diff --git a/src/soc/intel/common/block/cpu/cpulib.c b/src/soc/intel/common/block/cpu/cpulib.c index 2272e69edb..0d6dacc628 100644 --- a/src/soc/intel/common/block/cpu/cpulib.c +++ b/src/soc/intel/common/block/cpu/cpulib.c @@ -296,3 +296,21 @@ uint32_t cpu_get_max_turbo_ratio(void) msr = rdmsr(MSR_TURBO_RATIO_LIMIT); 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}); + } +} diff --git a/src/soc/intel/common/block/include/intelblocks/cpulib.h b/src/soc/intel/common/block/include/intelblocks/cpulib.h index 3d40a920c6..34caf4c252 100644 --- a/src/soc/intel/common/block/include/intelblocks/cpulib.h +++ b/src/soc/intel/common/block/include/intelblocks/cpulib.h @@ -156,4 +156,7 @@ uint32_t cpu_get_power_max(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 */ -- cgit v1.2.3