summaryrefslogtreecommitdiff
path: root/src/soc/amd/picasso/mca.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd/picasso/mca.c')
-rw-r--r--src/soc/amd/picasso/mca.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/soc/amd/picasso/mca.c b/src/soc/amd/picasso/mca.c
index 7561a5609c..973b3b5277 100644
--- a/src/soc/amd/picasso/mca.c
+++ b/src/soc/amd/picasso/mca.c
@@ -164,24 +164,12 @@ 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)
+static void mca_check_all_banks(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;
const unsigned int num_banks = mca_get_bank_count();
- for (i = 0 ; i < num_banks ; i++) {
+ for (unsigned int i = 0 ; i < num_banks ; i++) {
mci.bank = i;
mci.sts = rdmsr(MCAX_STATUS_MSR(i));
if (mci.sts.hi || mci.sts.lo) {
@@ -191,6 +179,21 @@ void check_mca(void)
build_bert_mca_error(&mci);
}
}
+}
+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)
+{
+ mca_check_all_banks();
mca_clear_errors();
}