summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPratik Prajapati <pratikkumar.v.prajapati@intel.com>2017-08-28 12:16:23 -0700
committerMartin Roth <martinroth@google.com>2017-09-02 15:18:50 +0000
commit4e203070523a04f10252a0bb68cb4467b32748fc (patch)
tree35933644ca753fbb4fcf10ecd5cc522bcf90d8ef /src
parent1f3daeab41826028e8f78afd64a32aab986b406b (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/common/block/cpu/cpulib.c18
-rw-r--r--src/soc/intel/common/block/include/intelblocks/cpulib.h3
2 files changed, 21 insertions, 0 deletions
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 */