1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <amdblocks/mca.h>
4 #include <cpu/x86/msr.h>
7 static const char *const mca_bank_name
[] = {
8 [0] = "Load-store unit",
9 [1] = "Instruction fetch unit",
10 [2] = "Combined unit",
11 /* Bank 3 is reserved and not all corresponding MSRs are implemented in Family 15h.
12 Accessing non-existing MSRs causes a general protection fault. */
15 [5] = "Execution unit",
16 [6] = "Floating point unit"
19 bool mca_has_expected_bank_count(void)
21 return ARRAY_SIZE(mca_bank_name
) == mca_get_bank_count();
24 bool mca_is_valid_bank(unsigned int bank
)
26 return (bank
< ARRAY_SIZE(mca_bank_name
) && mca_bank_name
[bank
] != NULL
);
29 const char *mca_get_bank_name(unsigned int bank
)
31 if (mca_is_valid_bank(bank
))
32 return mca_bank_name
[bank
];