summaryrefslogtreecommitdiff
path: root/src/soc/amd/stoneyridge
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-07-13 22:35:39 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-07-14 21:58:27 +0000
commit65deb24a8e908825789d74950bcdaf4637697929 (patch)
tree6ed498ea325345d4e2990298a81226139735662a /src/soc/amd/stoneyridge
parentb04148aa564c59f0107cc09a02117ddfc8b3aa31 (diff)
soc/amd/stoneyridge: add and use mca_is_valid_bank & mca_get_bank_name
This patch changes the way how the not implemented MCA bank 3 gets skipped. For the not implemented bank 3 the name gets set to NULL resulting in mca_is_valid_bank returning false causing the bank to get skipped. This is a preparation for commonizing the MCA(X) handing in the soc/amd sub-tree. Change-Id: I40d6a6752504d804c45b445fce7e763e80161211 Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/56277 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/soc/amd/stoneyridge')
-rw-r--r--src/soc/amd/stoneyridge/mca.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/soc/amd/stoneyridge/mca.c b/src/soc/amd/stoneyridge/mca.c
index 50e7fdd6f3..bdb06ccfa2 100644
--- a/src/soc/amd/stoneyridge/mca.c
+++ b/src/soc/amd/stoneyridge/mca.c
@@ -139,18 +139,33 @@ static const char *const mca_bank_name[] = {
[0] = "Load-store unit",
[1] = "Instruction fetch unit",
[2] = "Combined unit",
- [3] = "Reserved",
+ /* Bank 3 is reserved and not all corresponding MSRs are implemented in Family 15h.
+ Accessing non-existing MSRs causes a general protection fault. */
+ [3] = NULL,
[4] = "Northbridge",
[5] = "Execution unit",
[6] = "Floating point unit"
};
+static bool mca_is_valid_bank(unsigned int bank)
+{
+ return (bank < ARRAY_SIZE(mca_bank_name) && mca_bank_name[bank] != NULL);
+}
+
+static const char *mca_get_bank_name(unsigned int bank)
+{
+ if (mca_is_valid_bank(bank))
+ return mca_bank_name[bank];
+ else
+ return "";
+}
+
static void mca_print_error(unsigned int bank)
{
msr_t msr;
printk(BIOS_WARNING, "#MC Error: core %u, bank %u %s\n", initial_lapicid(), bank,
- mca_bank_name[bank]);
+ mca_get_bank_name(bank));
msr = rdmsr(IA32_MC_STATUS(bank));
printk(BIOS_WARNING, " MC%u_STATUS = %08x_%08x\n", bank, msr.hi, msr.lo);
@@ -173,7 +188,7 @@ static void mca_check_all_banks(void)
return;
for (unsigned int i = 0 ; i < num_banks ; i++) {
- if (i == 3) /* Reserved in Family 15h */
+ if (!mca_is_valid_bank(i))
continue;
mci.bank = i;