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:
@@ -17,7 +17,7 @@ static void model_14_init(struct device *dev)
|
|||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
msr_t msr;
|
msr_t msr;
|
||||||
int num_banks;
|
unsigned int num_banks;
|
||||||
int msrno;
|
int msrno;
|
||||||
#if CONFIG(LOGICAL_CPUS)
|
#if CONFIG(LOGICAL_CPUS)
|
||||||
u32 siblings;
|
u32 siblings;
|
||||||
@@ -59,8 +59,7 @@ static void model_14_init(struct device *dev)
|
|||||||
x86_enable_cache();
|
x86_enable_cache();
|
||||||
|
|
||||||
/* zero the machine check error status registers */
|
/* zero the machine check error status registers */
|
||||||
msr = rdmsr(IA32_MCG_CAP);
|
num_banks = mca_get_bank_count();
|
||||||
num_banks = msr.lo & MCA_BANKS_MASK;
|
|
||||||
msr.lo = 0;
|
msr.lo = 0;
|
||||||
msr.hi = 0;
|
msr.hi = 0;
|
||||||
for (i = 0; i < num_banks; i++)
|
for (i = 0; i < num_banks; i++)
|
||||||
|
@@ -20,7 +20,7 @@ static void model_15_init(struct device *dev)
|
|||||||
|
|
||||||
u8 i;
|
u8 i;
|
||||||
msr_t msr;
|
msr_t msr;
|
||||||
int num_banks;
|
unsigned int num_banks;
|
||||||
int msrno;
|
int msrno;
|
||||||
unsigned int cpu_idx;
|
unsigned int cpu_idx;
|
||||||
#if CONFIG(LOGICAL_CPUS)
|
#if CONFIG(LOGICAL_CPUS)
|
||||||
@@ -58,8 +58,7 @@ static void model_15_init(struct device *dev)
|
|||||||
x86_enable_cache();
|
x86_enable_cache();
|
||||||
|
|
||||||
/* zero the machine check error status registers */
|
/* zero the machine check error status registers */
|
||||||
msr = rdmsr(IA32_MCG_CAP);
|
num_banks = mca_get_bank_count();
|
||||||
num_banks = msr.lo & MCA_BANKS_MASK;
|
|
||||||
msr.lo = 0;
|
msr.lo = 0;
|
||||||
msr.hi = 0;
|
msr.hi = 0;
|
||||||
for (i = 0; i < num_banks; i++)
|
for (i = 0; i < num_banks; i++)
|
||||||
|
@@ -19,7 +19,7 @@ static void model_16_init(struct device *dev)
|
|||||||
|
|
||||||
u8 i;
|
u8 i;
|
||||||
msr_t msr;
|
msr_t msr;
|
||||||
int num_banks;
|
unsigned int num_banks;
|
||||||
int msrno;
|
int msrno;
|
||||||
#if CONFIG(LOGICAL_CPUS)
|
#if CONFIG(LOGICAL_CPUS)
|
||||||
u32 siblings;
|
u32 siblings;
|
||||||
@@ -56,8 +56,7 @@ static void model_16_init(struct device *dev)
|
|||||||
x86_enable_cache();
|
x86_enable_cache();
|
||||||
|
|
||||||
/* zero the machine check error status registers */
|
/* zero the machine check error status registers */
|
||||||
msr = rdmsr(IA32_MCG_CAP);
|
num_banks = mca_get_bank_count();
|
||||||
num_banks = msr.lo & MCA_BANKS_MASK;
|
|
||||||
msr.lo = 0;
|
msr.lo = 0;
|
||||||
msr.hi = 0;
|
msr.hi = 0;
|
||||||
for (i = 0; i < num_banks; i++)
|
for (i = 0; i < num_banks; i++)
|
||||||
|
@@ -22,7 +22,7 @@ static void model_16_init(struct device *dev)
|
|||||||
|
|
||||||
u8 i;
|
u8 i;
|
||||||
msr_t msr;
|
msr_t msr;
|
||||||
int num_banks;
|
unsigned int num_banks;
|
||||||
u32 siblings;
|
u32 siblings;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -41,8 +41,7 @@ static void model_16_init(struct device *dev)
|
|||||||
x86_mtrr_check();
|
x86_mtrr_check();
|
||||||
|
|
||||||
/* zero the machine check error status registers */
|
/* zero the machine check error status registers */
|
||||||
msr = rdmsr(IA32_MCG_CAP);
|
num_banks = mca_get_bank_count();
|
||||||
num_banks = msr.lo & MCA_BANKS_MASK;
|
|
||||||
msr.lo = 0;
|
msr.lo = 0;
|
||||||
msr.hi = 0;
|
msr.hi = 0;
|
||||||
for (i = 0; i < num_banks; i++)
|
for (i = 0; i < num_banks; i++)
|
||||||
|
Reference in New Issue
Block a user