From bf1f1df41ba998a1c3898cd513a47ebdfd05609d Mon Sep 17 00:00:00 2001 From: Felix Held Date: Tue, 13 Jul 2021 03:18:41 +0200 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56258 Reviewed-by: Raul Rangel Tested-by: build bot (Jenkins) --- src/include/cpu/x86/msr.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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) -- cgit v1.2.3