Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/56258 )
Change subject: include/cpu/x86/msr: add mca_clear_status function ......................................................................
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 --- M src/include/cpu/x86/msr.h 1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/58/56258/1
diff --git a/src/include/cpu/x86/msr.h b/src/include/cpu/x86/msr.h index dd969d7..51ef2e0 100644 --- a/src/include/cpu/x86/msr.h +++ b/src/include/cpu/x86/msr.h @@ -166,6 +166,16 @@ 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)