summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2009-12-03 16:10:21 +0000
committeravg <avg@FreeBSD.org>2009-12-03 16:10:21 +0000
commit6da88fd016a86602a1605b17d5d4c0dc2d2af76e (patch)
treeb42e3fd384e5f585ab018c4147e3f602e303e43a /sys/i386
parent3f6e5c4df53d4a7718a0f41931a9ff7fdc66e9ca (diff)
downloadFreeBSD-src-6da88fd016a86602a1605b17d5d4c0dc2d2af76e.zip
FreeBSD-src-6da88fd016a86602a1605b17d5d4c0dc2d2af76e.tar.gz
mca: small enhancements related to cpu quirks
- use utility macros for CPU family/model checking - limit Intel P6 quirk to pre-Nehalem models (taken from OpenSolaris) - add AMD GartTblWkEn quirk for families 0Fh and 10h; I haven't experienced any problems without the quirk but both Linux and OpenSolaris do this - slightly re-arrange quirk code to provide for the future generalization and separation of vendor-specific quirk functions Reviewed by: jhb MFC after: 1 week
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/mca.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/sys/i386/i386/mca.c b/sys/i386/i386/mca.c
index 8af2091..eaa78b8 100644
--- a/sys/i386/i386/mca.c
+++ b/sys/i386/i386/mca.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/taskqueue.h>
+#include <machine/cputypes.h>
#include <machine/mca.h>
#include <machine/md_var.h>
#include <machine/specialreg.h>
@@ -478,6 +479,8 @@ void
mca_init(void)
{
uint64_t mcg_cap;
+ uint64_t ctl;
+ int skip;
int i;
/* MCE is required. */
@@ -495,15 +498,26 @@ mca_init(void)
wrmsr(MSR_MCG_CTL, MCG_CTL_ENABLE);
for (i = 0; i < (mcg_cap & MCG_CAP_COUNT); i++) {
- /*
- * Enable logging of all errors. For P6
- * processors, MC0_CTL is always enabled.
- *
- * XXX: Better CPU test needed here?
- */
- if (!(i == 0 && (cpu_id & 0xf00) == 0x600))
- wrmsr(MSR_MC_CTL(i), 0xffffffffffffffffUL);
+ /* By default enable logging of all errors. */
+ ctl = 0xffffffffffffffffUL;
+ skip = 0;
+
+ if (cpu_vendor_id == CPU_VENDOR_INTEL) {
+ /*
+ * For P6 models before Nehalem MC0_CTL is
+ * always enabled and reserved.
+ */
+ if (i == 0 && CPUID_TO_FAMILY(cpu_id) == 0x6
+ && CPUID_TO_MODEL(cpu_id) < 0x1a)
+ skip = 1;
+ } else if (cpu_vendor_id == CPU_VENDOR_AMD) {
+ /* BKDG for Family 10h: unset GartTblWkEn. */
+ if (i == 4 && CPUID_TO_FAMILY(cpu_id) >= 0xf)
+ ctl &= ~(1UL << 10);
+ }
+ if (!skip)
+ wrmsr(MSR_MC_CTL(i), ctl);
/* Clear all errors. */
wrmsr(MSR_MC_STATUS(i), 0);
}
OpenPOWER on IntegriCloud