haswell: Clear correct number of MCA banks

The configure_mca() function was hard coding the number of
banks the cpu supported. Query this dynamically so that it
no longer clears only 7 banks.

Change-Id: I33fce8fadc0facd1016b3295faaf3ae90e490a71
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/2745
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Aaron Durbin 2013-01-12 01:07:28 -06:00 committed by Ronald G. Minnich
parent a416bfeced
commit 24614af9b8
1 changed files with 8 additions and 2 deletions

View File

@ -424,11 +424,17 @@ static void set_energy_perf_bias(u8 policy)
static void configure_mca(void) static void configure_mca(void)
{ {
msr_t msr; msr_t msr;
const unsigned int mcg_cap_msr = 0x179;
int i; int i;
int num_banks;
msr = rdmsr(mcg_cap_msr);
num_banks = msr.lo & 0xff;
msr.lo = msr.hi = 0; msr.lo = msr.hi = 0;
/* This should only be done on a cold boot */ /* TODO(adurbin): This should only be done on a cold boot. Also, some
for (i = 0; i < 7; i++) * of these banks are core vs package scope. For now every CPU clears
* every bank. */
for (i = 0; i < num_banks; i++)
wrmsr(IA32_MC0_STATUS + (i * 4), msr); wrmsr(IA32_MC0_STATUS + (i * 4), msr);
} }