summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-07-13 03:18:41 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-07-14 17:32:45 +0000
commitbf1f1df41ba998a1c3898cd513a47ebdfd05609d (patch)
tree4a805c5637209ee20b7f4b107f845d5b0c69c278 /src
parentbb0ecd49f26a3346c320d5996c872a35943835c1 (diff)
include/cpu/x86/msr: add mca_clear_status function
In multiple locations within the coreboot tree all available IA32_MC_STATUS registers are cleared, so add this to the common code to avoid duplication of code. Change-Id: I04af23c16021b0ce90f7105f7a3856bd26ffa736 Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/56258 Reviewed-by: Raul Rangel <rrangel@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/include/cpu/x86/msr.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/include/cpu/x86/msr.h b/src/include/cpu/x86/msr.h
index dd969d765d..51ef2e08ea 100644
--- a/src/include/cpu/x86/msr.h
+++ b/src/include/cpu/x86/msr.h
@@ -166,6 +166,16 @@ static inline unsigned int mca_get_bank_count(void)
return msr.lo & MCA_BANKS_MASK;
}
+/* Clear all MCA status registers */
+static inline void mca_clear_status(void)
+{
+ const unsigned int num_banks = mca_get_bank_count();
+ const msr_t msr = {.lo = 0, .hi = 0};
+
+ for (unsigned int i = 0 ; i < num_banks ; i++)
+ wrmsr(IA32_MC_STATUS(i), msr);
+}
+
/* Helpers for interpreting MC[i]_STATUS */
static inline int mca_valid(msr_t msr)