summaryrefslogtreecommitdiffstats
path: root/src/soc/amd/picasso/mca.c
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-07-14 01:16:30 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-07-15 17:03:30 +0000
commite84c3f189876630acfc2e09310300de8048e4fc6 (patch)
treeda36a9f665129118906f7b0ccc700cbd21c058d3 /src/soc/amd/picasso/mca.c
parent64077de176312638dd81c8743debac9223768edb (diff)
downloadcoreboot-e84c3f189876630acfc2e09310300de8048e4fc6.tar.gz
coreboot-e84c3f189876630acfc2e09310300de8048e4fc6.tar.bz2
coreboot-e84c3f189876630acfc2e09310300de8048e4fc6.zip
soc/amd/*/mca: factor out common MCA/MCAX check & print functionality
For Cezanne stubs are added for the functions that the SoC-specific code needs to provide. Since the mca_is_valid_bank stub on Cezanne always returns false, the checks get skipped for it at the moment. The actual functionality will be added in a later patch. Change-Id: Ic31e9b1ca7f8fac0721c95935c79150d7f774aa4 Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/56290 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/soc/amd/picasso/mca.c')
-rw-r--r--src/soc/amd/picasso/mca.c51
1 files changed, 3 insertions, 48 deletions
diff --git a/src/soc/amd/picasso/mca.c b/src/soc/amd/picasso/mca.c
index c41708c4ad1f..91b58ac3e5d0 100644
--- a/src/soc/amd/picasso/mca.c
+++ b/src/soc/amd/picasso/mca.c
@@ -1,10 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <amdblocks/mca.h>
-#include <amdblocks/msr_zen.h>
-#include <cpu/x86/lapic.h>
#include <cpu/x86/msr.h>
-#include <console/console.h>
#include <types.h>
static const char *const mca_bank_name[] = {
@@ -33,62 +30,20 @@ static const char *const mca_bank_name[] = {
[22] = "PIE",
};
-static bool mca_has_expected_bank_count(void)
+bool mca_has_expected_bank_count(void)
{
return ARRAY_SIZE(mca_bank_name) == mca_get_bank_count();
}
-static bool mca_is_valid_bank(unsigned int bank)
+bool mca_is_valid_bank(unsigned int bank)
{
return (bank < ARRAY_SIZE(mca_bank_name) && mca_bank_name[bank] != NULL);
}
-static const char *mca_get_bank_name(unsigned int bank)
+const char *mca_get_bank_name(unsigned int bank)
{
if (mca_is_valid_bank(bank))
return mca_bank_name[bank];
else
return "";
}
-
-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,
- mca_get_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);
-}
-
-void mca_check_all_banks(void)
-{
- struct mca_bank_status mci;
- const unsigned int num_banks = mca_get_bank_count();
-
- if (!mca_has_expected_bank_count())
- printk(BIOS_WARNING, "CPU has an unexpected number of MCA banks!\n");
-
- for (unsigned int i = 0 ; i < num_banks ; i++) {
- if (!mca_is_valid_bank(i))
- continue;
-
- mci.bank = i;
- mci.sts = rdmsr(MCAX_STATUS_MSR(i));
- if (mci.sts.hi || mci.sts.lo) {
- mca_print_error(i);
-
- if (CONFIG(ACPI_BERT) && mca_valid(mci.sts))
- build_bert_mca_error(&mci);
- }
- }
-}