summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2009-05-04 18:05:27 +0000
committerjkim <jkim@FreeBSD.org>2009-05-04 18:05:27 +0000
commit3b0819d0afb64bc978363bcb108d66e47adb5af7 (patch)
treedfbbbc604e7bff5d5298c1ed21ea8133553ae877 /sys/amd64
parent5a4e3bbf097e207785aa8560452ceef9b4bea804 (diff)
downloadFreeBSD-src-3b0819d0afb64bc978363bcb108d66e47adb5af7.zip
FreeBSD-src-3b0819d0afb64bc978363bcb108d66e47adb5af7.tar.gz
Unlock the largest standard CPUID on Intel CPUs for both amd64 and i386 and
fix SMP topology detection. On i386, we extend it to cover Core, Core 2, and Core i7 processors, not just Pentium 4 family, and move it to better place. On amd64, all supported Intel CPUs should have this MSR.
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/identcpu.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c
index 4ac0e5f..46b7920 100644
--- a/sys/amd64/amd64/identcpu.c
+++ b/sys/amd64/amd64/identcpu.c
@@ -472,6 +472,22 @@ identify_cpu(void)
cpu_feature = regs[3];
cpu_feature2 = regs[2];
+ /*
+ * Clear "Limit CPUID Maxval" bit and get the largest standard CPUID
+ * function number again if it is set from BIOS. It is necessary
+ * for probing correct CPU topology later.
+ * XXX This is only done on the BSP package.
+ */
+ if (cpu_vendor_id == CPU_VENDOR_INTEL && cpu_high > 0 && cpu_high < 4) {
+ uint64_t msr;
+ msr = rdmsr(MSR_IA32_MISC_ENABLE);
+ if ((msr & 0x400000ULL) != 0) {
+ wrmsr(MSR_IA32_MISC_ENABLE, msr & ~0x400000ULL);
+ do_cpuid(0, regs);
+ cpu_high = regs[0];
+ }
+ }
+
if (cpu_vendor_id == CPU_VENDOR_INTEL ||
cpu_vendor_id == CPU_VENDOR_AMD ||
cpu_vendor_id == CPU_VENDOR_CENTAUR) {
OpenPOWER on IntegriCloud