diff options
author | avg <avg@FreeBSD.org> | 2013-07-28 17:54:42 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2013-07-28 17:54:42 +0000 |
commit | 425573ccba3b555a3407c9958714a764b5e7b609 (patch) | |
tree | 4420aa26daa238558c6bb6511af95c82d7427921 /sys/i386/i386 | |
parent | 0b4cdd16b015a683fe1fd725702e6f20e9a87dda (diff) | |
download | FreeBSD-src-425573ccba3b555a3407c9958714a764b5e7b609.zip FreeBSD-src-425573ccba3b555a3407c9958714a764b5e7b609.tar.gz |
x86: detect mwait capabilities and extensions, when present
Reviewed by: kib (earlier amd64-only version)
MFC after: 2 weeks
Diffstat (limited to 'sys/i386/i386')
-rw-r--r-- | sys/i386/i386/identcpu.c | 7 | ||||
-rw-r--r-- | sys/i386/i386/initcpu.c | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c index b47972c..beec9b1 100644 --- a/sys/i386/i386/identcpu.c +++ b/sys/i386/i386/identcpu.c @@ -1121,6 +1121,13 @@ finishidentcpu(void) } } + if (cpu_high >= 5 && (cpu_feature2 & CPUID2_MON) != 0) { + do_cpuid(5, regs); + cpu_mon_mwait_flags = regs[2]; + cpu_mon_min_size = regs[0] & CPUID5_MON_MIN_SIZE; + cpu_mon_max_size = regs[1] & CPUID5_MON_MAX_SIZE; + } + /* Detect AMD features (PTE no-execute bit, 3dnow, 64 bit mode etc) */ if (cpu_vendor_id == CPU_VENDOR_INTEL || cpu_vendor_id == CPU_VENDOR_AMD) { diff --git a/sys/i386/i386/initcpu.c b/sys/i386/i386/initcpu.c index 97454bc..5f33897 100644 --- a/sys/i386/i386/initcpu.c +++ b/sys/i386/i386/initcpu.c @@ -97,6 +97,9 @@ u_int cpu_procinfo2 = 0; /* Multicore info */ char cpu_vendor[20] = ""; /* CPU Origin code */ u_int cpu_vendor_id = 0; /* CPU vendor ID */ u_int cpu_clflush_line_size = 32; +u_int cpu_mon_mwait_flags; /* MONITOR/MWAIT flags (CPUID.05H.ECX) */ +u_int cpu_mon_min_size; /* MONITOR minimum range size, bytes */ +u_int cpu_mon_max_size; /* MONITOR minimum range size, bytes */ SYSCTL_UINT(_hw, OID_AUTO, via_feature_rng, CTLFLAG_RD, &via_feature_rng, 0, "VIA RNG feature available in CPU"); |