cpu/amd: Correct number of MCA banks cleared

Use the value discovered in the MCG_CAP[Count] for the number of MCA
status registers to clear.  The generations should have the following
number of banks:
 * Family 10h: 6 banks
 * Family 12h: 6
 * Family 14h: 6
 * Family 15h: 7
 * Family 16h: 6

Change-Id: I0fc6d127a200b10fd484e051d84353cc61b27a41
Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-on: https://review.coreboot.org/27923
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Martin Roth <martinroth@google.com>
diff --git a/src/soc/amd/stoneyridge/cpu.c b/src/soc/amd/stoneyridge/cpu.c
index 6289174..7fff120 100644
--- a/src/soc/amd/stoneyridge/cpu.c
+++ b/src/soc/amd/stoneyridge/cpu.c
@@ -121,11 +121,14 @@
 
 	int i;
 	msr_t msr;
+	int num_banks;
 
 	/* zero the machine check error status registers */
+	msr = rdmsr(MCG_CAP);
+	num_banks = msr.lo & MCA_BANKS_MASK;
 	msr.lo = 0;
 	msr.hi = 0;
-	for (i = 0 ; i < 6 ; i++)
+	for (i = 0 ; i < num_banks ; i++)
 		wrmsr(MC0_STATUS + (i * 4), msr);
 
 	setup_lapic();