summaryrefslogtreecommitdiff
path: root/src/soc/amd
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-07-13 22:29:12 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-07-14 21:56:24 +0000
commit040d7646bcba7c2a22b6a6ae8f460ff75db8e5bf (patch)
treec4f09f4aaa9f18bba62c804d5b771a09f2a5b68b /src/soc/amd
parent07ad2d9439749c5d0681f3c0e988b300865dbadb (diff)
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 <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/56275 Reviewed-by: Raul Rangel <rrangel@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/amd')
-rw-r--r--src/soc/amd/picasso/mca.c8
1 files changed, 8 insertions, 0 deletions
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) {