summaryrefslogtreecommitdiff
path: root/src/soc/amd/picasso
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-07-12 22:10:24 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-07-14 02:22:59 +0000
commit2d0346a52126326bf888a9a3d778dc38515d2235 (patch)
tree2ab8d9f7d7793e6537babcdffecaf4f417c4213e /src/soc/amd/picasso
parent82af7491c267bfd74c6c3c4f63fe091b10814fb1 (diff)
soc/amd/picasso,stoneyridge/mca: factor out mca_print_error()
Change-Id: I7cd05a389c34c2e5f3d0ab4cd06d60a7e3e5cad9 Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/56239 Reviewed-by: Raul Rangel <rrangel@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/amd/picasso')
-rw-r--r--src/soc/amd/picasso/mca.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/soc/amd/picasso/mca.c b/src/soc/amd/picasso/mca.c
index 07e700ee24..e525d03c1a 100644
--- a/src/soc/amd/picasso/mca.c
+++ b/src/soc/amd/picasso/mca.c
@@ -145,6 +145,25 @@ static const char *const mca_bank_name[] = {
"L3 cache unit"
};
+static void mca_print_error(unsigned int bank)
+{
+ msr_t msr;
+
+ printk(BIOS_WARNING, "#MC Error: core %u, bank %u %s\n", initial_lapicid(), bank,
+ bank < ARRAY_SIZE(mca_bank_name) ? mca_bank_name[bank] : "");
+
+ msr = rdmsr(MCAX_STATUS_MSR(bank));
+ printk(BIOS_WARNING, " MC%u_STATUS = %08x_%08x\n", bank, msr.hi, msr.lo);
+ msr = rdmsr(MCAX_ADDR_MSR(bank));
+ printk(BIOS_WARNING, " MC%u_ADDR = %08x_%08x\n", bank, msr.hi, msr.lo);
+ msr = rdmsr(MCAX_MISC0_MSR(bank));
+ printk(BIOS_WARNING, " MC%u_MISC = %08x_%08x\n", bank, msr.hi, msr.lo);
+ msr = rdmsr(MCAX_CTL_MSR(bank));
+ printk(BIOS_WARNING, " MC%u_CTL = %08x_%08x\n", bank, msr.hi, msr.lo);
+ msr = rdmsr(MCA_CTL_MASK_MSR(bank));
+ printk(BIOS_WARNING, " MC%u_CTL_MASK = %08x_%08x\n", bank, msr.hi, msr.lo);
+}
+
/* Check the Machine Check Architecture Extension registers */
void check_mca(void)
{
@@ -154,28 +173,11 @@ void check_mca(void)
const unsigned int num_banks = mca_get_bank_count();
for (i = 0 ; i < num_banks ; i++) {
+ mci.bank = i;
mci.sts = rdmsr(MCAX_STATUS_MSR(i));
if (mci.sts.hi || mci.sts.lo) {
- printk(BIOS_WARNING, "#MC Error: core %u, bank %u %s\n",
- initial_lapicid(), i,
- i < ARRAY_SIZE(mca_bank_name) ? mca_bank_name[i] : "");
-
- printk(BIOS_WARNING, " MC%u_STATUS = %08x_%08x\n",
- i, mci.sts.hi, mci.sts.lo);
- msr = rdmsr(MCAX_ADDR_MSR(i));
- printk(BIOS_WARNING, " MC%u_ADDR = %08x_%08x\n",
- i, msr.hi, msr.lo);
- msr = rdmsr(MCAX_MISC0_MSR(i));
- printk(BIOS_WARNING, " MC%u_MISC = %08x_%08x\n",
- i, msr.hi, msr.lo);
- msr = rdmsr(MCAX_CTL_MSR(i));
- printk(BIOS_WARNING, " MC%u_CTL = %08x_%08x\n",
- i, msr.hi, msr.lo);
- msr = rdmsr(MCA_CTL_MASK_MSR(i));
- printk(BIOS_WARNING, " MC%u_CTL_MASK = %08x_%08x\n",
- i, msr.hi, msr.lo);
-
- mci.bank = i;
+ mca_print_error(i);
+
if (CONFIG(ACPI_BERT) && mca_valid(mci.sts))
build_bert_mca_error(&mci);
}