soc/amd/picasso: check length of mca_bank_name array

The length of mca_bank_name should match the return value of
mca_get_bank_count which gets the number of MCA banks from an MSR.

TEST=No error message on serial console on amd/mandolin

Change-Id: Ibdad51a7ef27266e110dfbb43188361952618342
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56274
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Felix Held 2021-07-13 21:07:12 +02:00
parent 799742af3d
commit 07ad2d9439
1 changed files with 3 additions and 0 deletions

View File

@ -184,6 +184,9 @@ static void mca_check_all_banks(void)
struct mca_bank_status mci; struct mca_bank_status mci;
const unsigned int num_banks = mca_get_bank_count(); const unsigned int num_banks = mca_get_bank_count();
if (ARRAY_SIZE(mca_bank_name) != num_banks)
printk(BIOS_WARNING, "CPU has an unexpected number of MCA banks!\n");
for (unsigned int i = 0 ; i < num_banks ; i++) { for (unsigned int i = 0 ; i < num_banks ; i++) {
mci.bank = i; mci.bank = i;
mci.sts = rdmsr(MCAX_STATUS_MSR(i)); mci.sts = rdmsr(MCAX_STATUS_MSR(i));