coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
mca_common.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <amdblocks/mca.h>
4 #include <cpu/x86/msr.h>
5 #include <console/console.h>
6 #include <types.h>
7 #include "mca_common_defs.h"
8 
9 static void mca_check_all_banks(void)
10 {
11  struct mca_bank_status mci;
12  const unsigned int num_banks = mca_get_bank_count();
13 
15  printk(BIOS_WARNING, "CPU has an unexpected number of MCA banks!\n");
16 
17  if (mca_skip_check())
18  return;
19 
20  for (unsigned int i = 0 ; i < num_banks ; i++) {
21  if (!mca_is_valid_bank(i))
22  continue;
23 
24  mci.bank = i;
25  /* The MCA status register can be used in both the MCA and MCAX case */
26  mci.sts = rdmsr(IA32_MC_STATUS(i));
27  if (mci.sts.hi || mci.sts.lo) {
28  mca_print_error(i);
29 
30  if (CONFIG(ACPI_BERT) && mca_valid(mci.sts))
32  }
33  }
34 }
35 
36 void check_mca(void)
37 {
39  /* mca_clear_status uses the MCA registers which can be used in both the MCA and MCAX
40  case */
42 }
bool mca_has_expected_bank_count(void)
Definition: mca.c:38
bool mca_is_valid_bank(unsigned int bank)
Definition: mca.c:43
bool mca_skip_check(void)
Definition: mca.c:11
void mca_print_error(unsigned int bank)
Definition: mca.c:16
#define printk(level,...)
Definition: stdlib.h:16
@ CONFIG
Definition: dsi_common.h:201
static unsigned int mca_get_bank_count(void)
Definition: msr.h:169
static __always_inline msr_t rdmsr(unsigned int index)
Definition: msr.h:146
#define IA32_MC_STATUS(bank)
Definition: msr.h:62
static int mca_valid(msr_t msr)
Definition: msr.h:187
static void mca_clear_status(void)
Definition: msr.h:176
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
Definition: loglevel.h:86
void build_bert_mca_error(struct mca_bank_status *mci)
Definition: mca_bert.c:51
static void mca_check_all_banks(void)
Definition: mca_common.c:9
void check_mca(void)
Definition: mca_common.c:36
msr_t sts
Definition: mca.h:11
unsigned int bank
Definition: mca.h:10
unsigned int hi
Definition: msr.h:112
unsigned int lo
Definition: msr.h:111