Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/56311 )
Change subject: soc/amd/stoneyridge/mca: implement and use mca_has_expected_bank_count ......................................................................
soc/amd/stoneyridge/mca: implement and use mca_has_expected_bank_count
This aligns the mca_check_all_banks implementation in the common mca.c with the one in the common mcax.c file. Do the MCA bank count check before the !is_warm_reset() check, so that a mismatch also gets printed on the cold boot path.
Change-Id: Idbd3e9ce9c7483f84f87adab7adac47335cd59aa Signed-off-by: Felix Held felix-coreboot@felixheld.de --- M src/soc/amd/common/block/cpu/mca/mca.c M src/soc/amd/stoneyridge/mca.c 2 files changed, 9 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/56311/1
diff --git a/src/soc/amd/common/block/cpu/mca/mca.c b/src/soc/amd/common/block/cpu/mca/mca.c index 2d91894..b5fd6a2 100644 --- a/src/soc/amd/common/block/cpu/mca/mca.c +++ b/src/soc/amd/common/block/cpu/mca/mca.c @@ -33,6 +33,9 @@ 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"); + if (!is_warm_reset()) return;
diff --git a/src/soc/amd/stoneyridge/mca.c b/src/soc/amd/stoneyridge/mca.c index 240e75d..7ca16a8 100644 --- a/src/soc/amd/stoneyridge/mca.c +++ b/src/soc/amd/stoneyridge/mca.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <amdblocks/mca.h> +#include <cpu/x86/msr.h> #include <types.h>
static const char *const mca_bank_name[] = { @@ -15,6 +16,11 @@ [6] = "Floating point unit" };
+bool mca_has_expected_bank_count(void) +{ + return ARRAY_SIZE(mca_bank_name) == mca_get_bank_count(); +} + bool mca_is_valid_bank(unsigned int bank) { return (bank < ARRAY_SIZE(mca_bank_name) && mca_bank_name[bank] != NULL);