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] = "L2 cache unit",
13 [5] = "Execution unit",
14 [6] = "Floating point unit",
15 [7] = "L3 cache unit",
16 [8] = "L3 cache unit",
17 [9] = "L3 cache unit",
18 [10] = "L3 cache unit",
27 bool mca_has_expected_bank_count(void)
29 return ARRAY_SIZE(mca_bank_name
) == mca_get_bank_count();
32 bool mca_is_valid_bank(unsigned int bank
)
34 return (bank
< ARRAY_SIZE(mca_bank_name
) && mca_bank_name
[bank
] != NULL
);
37 const char *mca_get_bank_name(unsigned int bank
)
39 if (mca_is_valid_bank(bank
))
40 return mca_bank_name
[bank
];