soc/intel/skylake: clear MCA before booting to OS

mca_configure needs to be called for each core before
booting to OS, else OS would keep dumping MCEs

Change-Id: I95ca46fda7be65d74714bdb344e339922cbb6305
Signed-off-by: Pratik Prajapati <pratikkumar.v.prajapati@intel.com>
Reviewed-on: https://review.coreboot.org/26392
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
diff --git a/src/soc/intel/skylake/finalize.c b/src/soc/intel/skylake/finalize.c
index 12dbab4..4c8a129 100644
--- a/src/soc/intel/skylake/finalize.c
+++ b/src/soc/intel/skylake/finalize.c
@@ -2,7 +2,7 @@
  * This file is part of the coreboot project.
  *
  * Copyright (C) 2014 Google Inc.
- * Copyright (C) 2015 Intel Corporation.
+ * Copyright (C) 2015-2018 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,8 +19,10 @@
 #include <chip.h>
 #include <console/console.h>
 #include <console/post_codes.h>
+#include <cpu/x86/mp.h>
 #include <cpu/x86/smm.h>
 #include <device/pci.h>
+#include <intelblocks/cpulib.h>
 #include <intelblocks/lpc_lib.h>
 #include <intelblocks/p2sb.h>
 #include <intelblocks/pcr.h>
@@ -35,6 +37,7 @@
 #include <soc/systemagent.h>
 #include <soc/thermal.h>
 #include <stdlib.h>
+#include <timer.h>
 
 #define PSF_BASE_ADDRESS	0xA00
 #define PCR_PSFX_T0_SHDW_PCIEN	0x1C
@@ -136,6 +139,9 @@
 
 	pch_finalize_script(dev);
 
+	printk(BIOS_DEBUG, "Clearing MCA.\n");
+	mp_run_on_all_cpus(mca_configure, NULL, 17 * USECS_PER_SEC);
+
 	soc_lockdown(dev);
 
 	printk(BIOS_DEBUG, "Finalizing SMM.\n");