From 64077de176312638dd81c8743debac9223768edb Mon Sep 17 00:00:00 2001 From: Felix Held Date: Wed, 14 Jul 2021 01:34:59 +0200 Subject: [PATCH] soc/amd/picasso/mca: factor out mca_has_expected_bank_count To factor out the rest of the common MCAX code, mca_bank_name[] may only be accessed by accessor functions, so implement this for the last place that still accessed mca_bank_name[] directly. Change-Id: Ic6548d3ceeb9c00ad344fc0bb3d97893e17a43a9 Signed-off-by: Felix Held Reviewed-on: https://review.coreboot.org/c/coreboot/+/56294 Reviewed-by: Martin Roth Tested-by: build bot (Jenkins) --- src/soc/amd/picasso/mca.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/soc/amd/picasso/mca.c b/src/soc/amd/picasso/mca.c index 3c5b63f361..c41708c4ad 100644 --- a/src/soc/amd/picasso/mca.c +++ b/src/soc/amd/picasso/mca.c @@ -33,6 +33,11 @@ static const char *const mca_bank_name[] = { [22] = "PIE", }; +static bool mca_has_expected_bank_count(void) +{ + return ARRAY_SIZE(mca_bank_name) == mca_get_bank_count(); +} + static bool mca_is_valid_bank(unsigned int bank) { return (bank < ARRAY_SIZE(mca_bank_name) && mca_bank_name[bank] != NULL); @@ -70,7 +75,7 @@ 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) + if (!mca_has_expected_bank_count()) printk(BIOS_WARNING, "CPU has an unexpected number of MCA banks!\n"); for (unsigned int i = 0 ; i < num_banks ; i++) {