From 040d7646bcba7c2a22b6a6ae8f460ff75db8e5bf Mon Sep 17 00:00:00 2001 From: Felix Held Date: Tue, 13 Jul 2021 22:29:12 +0200 Subject: soc/amd/picasso: implement and use mca_is_valid_bank In mca_check_all_banks only check valid MCA banks for errors. This aligns the Picasso code a bit more with the Stoneyridge code base which will be updated in a follow-up patch. This is a preparation for commonizing the MCA(X) handing in the soc/amd sub-tree. Change-Id: I0c7f3066afd220e6b8bf8308a321189d7a2679f6 Signed-off-by: Felix Held Reviewed-on: https://review.coreboot.org/c/coreboot/+/56275 Reviewed-by: Raul Rangel Tested-by: build bot (Jenkins) --- src/soc/amd/picasso/mca.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/soc/amd/picasso/mca.c b/src/soc/amd/picasso/mca.c index ade8c503e0..b03df9004b 100644 --- a/src/soc/amd/picasso/mca.c +++ b/src/soc/amd/picasso/mca.c @@ -160,6 +160,11 @@ static const char *const mca_bank_name[] = { [22] = "PIE", }; +static bool mca_is_valid_bank(unsigned int bank) +{ + return (bank < ARRAY_SIZE(mca_bank_name) && mca_bank_name[bank] != NULL); +} + static void mca_print_error(unsigned int bank) { msr_t msr; @@ -188,6 +193,9 @@ static void mca_check_all_banks(void) 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) { -- cgit v1.2.3