diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2021-07-14 01:16:30 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-07-15 17:03:30 +0000 |
commit | e84c3f189876630acfc2e09310300de8048e4fc6 (patch) | |
tree | da36a9f665129118906f7b0ccc700cbd21c058d3 /src/soc/amd/stoneyridge | |
parent | 64077de176312638dd81c8743debac9223768edb (diff) |
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/stoneyridge')
-rw-r--r-- | src/soc/amd/stoneyridge/mca.c | 51 |
1 files changed, 2 insertions, 49 deletions
diff --git a/src/soc/amd/stoneyridge/mca.c b/src/soc/amd/stoneyridge/mca.c index 566f54ca8b..240e75db31 100644 --- a/src/soc/amd/stoneyridge/mca.c +++ b/src/soc/amd/stoneyridge/mca.c @@ -1,11 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include <amdblocks/mca.h> -#include <amdblocks/reset.h> -#include <cpu/amd/msr.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[] = { @@ -20,57 +15,15 @@ static const char *const mca_bank_name[] = { [6] = "Floating point unit" }; -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(IA32_MC_STATUS(bank)); - printk(BIOS_WARNING, " MC%u_STATUS = %08x_%08x\n", bank, msr.hi, msr.lo); - msr = rdmsr(IA32_MC_ADDR(bank)); - printk(BIOS_WARNING, " MC%u_ADDR = %08x_%08x\n", bank, msr.hi, msr.lo); - msr = rdmsr(IA32_MC_MISC(bank)); - printk(BIOS_WARNING, " MC%u_MISC = %08x_%08x\n", bank, msr.hi, msr.lo); - msr = rdmsr(IA32_MC_CTL(bank)); - printk(BIOS_WARNING, " MC%u_CTL = %08x_%08x\n", bank, msr.hi, msr.lo); - msr = rdmsr(MC_CTL_MASK(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 (!is_warm_reset()) - return; - - for (unsigned int i = 0 ; i < num_banks ; i++) { - if (!mca_is_valid_bank(i)) - continue; - - mci.bank = i; - mci.sts = rdmsr(IA32_MC_STATUS(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); - } - } -} |