summaryrefslogtreecommitdiff
path: root/src/soc/amd/picasso/mca.c
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-07-13 21:07:12 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-07-14 21:55:57 +0000
commit07ad2d9439749c5d0681f3c0e988b300865dbadb (patch)
treecfe0727d195863165e238e01f31786480c494e2e /src/soc/amd/picasso/mca.c
parent799742af3d40dc6449c1dcb9109300e1c9d8f58b (diff)
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>
Diffstat (limited to 'src/soc/amd/picasso/mca.c')
-rw-r--r--src/soc/amd/picasso/mca.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/soc/amd/picasso/mca.c b/src/soc/amd/picasso/mca.c
index fcc9d3e155..ade8c503e0 100644
--- a/src/soc/amd/picasso/mca.c
+++ b/src/soc/amd/picasso/mca.c
@@ -184,6 +184,9 @@ static void mca_check_all_banks(void)
struct mca_bank_status mci;
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++) {
mci.bank = i;
mci.sts = rdmsr(MCAX_STATUS_MSR(i));