summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-07-14 01:34:59 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-07-15 16:55:47 +0000
commit64077de176312638dd81c8743debac9223768edb (patch)
tree3fe7e1a0ce8cc0a3c1450867df1d5ddaea2e0c5b /src
parenta83a58fe62236793fa51677e3af3b1103c2eb8bf (diff)
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 <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/56294 Reviewed-by: Martin Roth <martinroth@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/picasso/mca.c7
1 files changed, 6 insertions, 1 deletions
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++) {