cpu/intel/*/*_init: use mca_get_bank_count()

Use the common mca_get_bank_count function instead of open-coding the
functionality to get the MCA bank number. Also re-type the num_banks
variable from signed in to unsigned int, since the number of MCA bank is
always positive, and make it constant.

In the case of Intel model 2065x the mca_get_bank_count() call replaces
a magic number.

Change-Id: I245b15f57e77edca179e9e28965383a227617174
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56244
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Felix Held 2021-07-13 01:55:52 +02:00
parent 1b46e76df9
commit bad21a4bd2
3 changed files with 4 additions and 9 deletions

View File

@ -520,10 +520,7 @@ static void configure_mca(void)
{
msr_t msr;
int i;
int num_banks;
msr = rdmsr(IA32_MCG_CAP);
num_banks = msr.lo & 0xff;
const unsigned int num_banks = mca_get_bank_count();
/* Enable all error reporting */
msr.lo = msr.hi = ~0;

View File

@ -77,10 +77,11 @@ static void configure_mca(void)
{
msr_t msr;
int i;
const unsigned int num_banks = mca_get_bank_count();
msr.lo = msr.hi = 0;
/* This should only be done on a cold boot */
for (i = 0; i < 7; i++)
for (i = 0; i < num_banks; i++)
wrmsr(IA32_MC_STATUS(i), msr);
}

View File

@ -301,10 +301,7 @@ static void configure_mca(void)
{
msr_t msr;
int i;
int num_banks;
msr = rdmsr(IA32_MCG_CAP);
num_banks = msr.lo & 0xff;
const unsigned int num_banks = mca_get_bank_count();
msr.lo = msr.hi = 0;
/* This should only be done on a cold boot */