diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2021-07-12 22:29:18 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-07-14 02:23:21 +0000 |
commit | 7830e3a8363bf804ac72ca3ec4681f79ef9cde46 (patch) | |
tree | 3f3791e0fc1eca08f34ea6fab57da4fdb05d74bf /src/soc/amd | |
parent | 2d0346a52126326bf888a9a3d778dc38515d2235 (diff) |
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>
Diffstat (limited to 'src/soc/amd')
-rw-r--r-- | src/soc/amd/picasso/mca.c | 17 | ||||
-rw-r--r-- | src/soc/amd/stoneyridge/mca.c | 17 |
2 files changed, 22 insertions, 12 deletions
diff --git a/src/soc/amd/picasso/mca.c b/src/soc/amd/picasso/mca.c index e525d03c1a..7561a5609c 100644 --- a/src/soc/amd/picasso/mca.c +++ b/src/soc/amd/picasso/mca.c @@ -164,12 +164,21 @@ static void mca_print_error(unsigned int bank) 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 @@ void check_mca(void) } } - /* 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 06b35bbf95..a64b01dd8e 100644 --- a/src/soc/amd/stoneyridge/mca.c +++ b/src/soc/amd/stoneyridge/mca.c @@ -164,11 +164,20 @@ static void mca_print_error(unsigned int bank) 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 @@ void check_mca(void) } } - /* 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(); } |