cpu/amd/*/model_*_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. Change-Id: I70ad423aab484cf4ec8f51b43624cd434647aad4 Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/56184 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
This commit is contained in:
parent
3f1b70640a
commit
2828fee7e0
|
@ -17,7 +17,7 @@ static void model_14_init(struct device *dev)
|
|||
{
|
||||
u8 i;
|
||||
msr_t msr;
|
||||
int num_banks;
|
||||
unsigned int num_banks;
|
||||
int msrno;
|
||||
#if CONFIG(LOGICAL_CPUS)
|
||||
u32 siblings;
|
||||
|
@ -59,8 +59,7 @@ static void model_14_init(struct device *dev)
|
|||
x86_enable_cache();
|
||||
|
||||
/* zero the machine check error status registers */
|
||||
msr = rdmsr(IA32_MCG_CAP);
|
||||
num_banks = msr.lo & MCA_BANKS_MASK;
|
||||
num_banks = mca_get_bank_count();
|
||||
msr.lo = 0;
|
||||
msr.hi = 0;
|
||||
for (i = 0; i < num_banks; i++)
|
||||
|
|
|
@ -20,7 +20,7 @@ static void model_15_init(struct device *dev)
|
|||
|
||||
u8 i;
|
||||
msr_t msr;
|
||||
int num_banks;
|
||||
unsigned int num_banks;
|
||||
int msrno;
|
||||
unsigned int cpu_idx;
|
||||
#if CONFIG(LOGICAL_CPUS)
|
||||
|
@ -58,8 +58,7 @@ static void model_15_init(struct device *dev)
|
|||
x86_enable_cache();
|
||||
|
||||
/* zero the machine check error status registers */
|
||||
msr = rdmsr(IA32_MCG_CAP);
|
||||
num_banks = msr.lo & MCA_BANKS_MASK;
|
||||
num_banks = mca_get_bank_count();
|
||||
msr.lo = 0;
|
||||
msr.hi = 0;
|
||||
for (i = 0; i < num_banks; i++)
|
||||
|
|
|
@ -19,7 +19,7 @@ static void model_16_init(struct device *dev)
|
|||
|
||||
u8 i;
|
||||
msr_t msr;
|
||||
int num_banks;
|
||||
unsigned int num_banks;
|
||||
int msrno;
|
||||
#if CONFIG(LOGICAL_CPUS)
|
||||
u32 siblings;
|
||||
|
@ -56,8 +56,7 @@ static void model_16_init(struct device *dev)
|
|||
x86_enable_cache();
|
||||
|
||||
/* zero the machine check error status registers */
|
||||
msr = rdmsr(IA32_MCG_CAP);
|
||||
num_banks = msr.lo & MCA_BANKS_MASK;
|
||||
num_banks = mca_get_bank_count();
|
||||
msr.lo = 0;
|
||||
msr.hi = 0;
|
||||
for (i = 0; i < num_banks; i++)
|
||||
|
|
|
@ -22,7 +22,7 @@ static void model_16_init(struct device *dev)
|
|||
|
||||
u8 i;
|
||||
msr_t msr;
|
||||
int num_banks;
|
||||
unsigned int num_banks;
|
||||
u32 siblings;
|
||||
|
||||
/*
|
||||
|
@ -41,8 +41,7 @@ static void model_16_init(struct device *dev)
|
|||
x86_mtrr_check();
|
||||
|
||||
/* zero the machine check error status registers */
|
||||
msr = rdmsr(IA32_MCG_CAP);
|
||||
num_banks = msr.lo & MCA_BANKS_MASK;
|
||||
num_banks = mca_get_bank_count();
|
||||
msr.lo = 0;
|
||||
msr.hi = 0;
|
||||
for (i = 0; i < num_banks; i++)
|
||||
|
|
Loading…
Reference in New Issue