Attention is currently required from: Patrick Rudolph. Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/56244 )
Change subject: cpu/intel/*/*_init: use mca_get_bank_count() ......................................................................
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 --- M src/cpu/intel/haswell/haswell_init.c M src/cpu/intel/model_2065x/model_2065x_init.c M src/cpu/intel/model_206ax/model_206ax_init.c 3 files changed, 4 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/56244/1
diff --git a/src/cpu/intel/haswell/haswell_init.c b/src/cpu/intel/haswell/haswell_init.c index 2d8bd15..29c663e 100644 --- a/src/cpu/intel/haswell/haswell_init.c +++ b/src/cpu/intel/haswell/haswell_init.c @@ -520,10 +520,7 @@ { 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; diff --git a/src/cpu/intel/model_2065x/model_2065x_init.c b/src/cpu/intel/model_2065x/model_2065x_init.c index abf8f61..fe5ac56 100644 --- a/src/cpu/intel/model_2065x/model_2065x_init.c +++ b/src/cpu/intel/model_2065x/model_2065x_init.c @@ -77,10 +77,11 @@ { 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); }
diff --git a/src/cpu/intel/model_206ax/model_206ax_init.c b/src/cpu/intel/model_206ax/model_206ax_init.c index bfe1fa5..541cb3b 100644 --- a/src/cpu/intel/model_206ax/model_206ax_init.c +++ b/src/cpu/intel/model_206ax/model_206ax_init.c @@ -301,10 +301,7 @@ { 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 */