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 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/soc/intel/common/block/cpu') 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}); + } +} -- cgit v1.2.3