Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/56240 )
Change subject: soc/amd/picasso,stoneyridge/mca: factor out mca_clear_errors ......................................................................
soc/amd/picasso,stoneyridge/mca: factor out mca_clear_errors
Change-Id: Id7a716a2598a6a7bea2d2d56898ea6329b5a3bec Signed-off-by: Felix Held felix-coreboot@felixheld.de Reviewed-on: https://review.coreboot.org/c/coreboot/+/56240 Reviewed-by: Raul Rangel rrangel@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/soc/amd/picasso/mca.c M src/soc/amd/stoneyridge/mca.c 2 files changed, 22 insertions(+), 12 deletions(-)
Approvals: build bot (Jenkins): Verified Raul Rangel: Looks good to me, approved
diff --git a/src/soc/amd/picasso/mca.c b/src/soc/amd/picasso/mca.c index e525d03..7561a56 100644 --- a/src/soc/amd/picasso/mca.c +++ b/src/soc/amd/picasso/mca.c @@ -164,12 +164,21 @@ printk(BIOS_WARNING, " MC%u_CTL_MASK = %08x_%08x\n", bank, msr.hi, msr.lo); }
+static void mca_clear_errors(void) +{ + const unsigned int num_banks = mca_get_bank_count(); + const msr_t msr = {.lo = 0, .hi = 0}; + + /* Zero all machine check error status registers */ + for (unsigned int i = 0 ; i < num_banks ; i++) + wrmsr(MCAX_STATUS_MSR(i), msr); +} + /* Check the Machine Check Architecture Extension registers */ void check_mca(void) { unsigned int i; struct mca_bank_status mci; - msr_t msr; const unsigned int num_banks = mca_get_bank_count();
for (i = 0 ; i < num_banks ; i++) { @@ -183,9 +192,5 @@ } }
- /* zero the machine check error status registers */ - msr.lo = 0; - msr.hi = 0; - for (i = 0 ; i < num_banks ; i++) - wrmsr(MCAX_STATUS_MSR(i), msr); + mca_clear_errors(); } diff --git a/src/soc/amd/stoneyridge/mca.c b/src/soc/amd/stoneyridge/mca.c index 06b35bb..a64b01d 100644 --- a/src/soc/amd/stoneyridge/mca.c +++ b/src/soc/amd/stoneyridge/mca.c @@ -164,11 +164,20 @@ printk(BIOS_WARNING, " MC%u_CTL_MASK = %08x_%08x\n", bank, msr.hi, msr.lo); }
+static void mca_clear_errors(void) +{ + const unsigned int num_banks = mca_get_bank_count(); + const msr_t msr = {.lo = 0, .hi = 0}; + + /* Zero all machine check error status registers */ + for (unsigned int i = 0 ; i < num_banks ; i++) + wrmsr(IA32_MC0_STATUS + (i * 4), msr); +} + void check_mca(void) { unsigned int i; struct mca_bank_status mci; - msr_t msr; const unsigned int num_banks = mca_get_bank_count();
if (is_warm_reset()) { @@ -187,9 +196,5 @@ } }
- /* zero the machine check error status registers */ - msr.lo = 0; - msr.hi = 0; - for (i = 0 ; i < num_banks ; i++) - wrmsr(IA32_MC0_STATUS + (i * 4), msr); + mca_clear_errors(); }