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/amd64 | |
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/amd64')
-rw-r--r-- | sys/amd64/amd64/identcpu.c | 7 | ||||
-rw-r--r-- | sys/amd64/amd64/initcpu.c | 3 | ||||
-rw-r--r-- | sys/amd64/include/md_var.h | 3 |
3 files changed, 13 insertions, 0 deletions
diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c index e63affc..27ea9a6 100644 --- a/sys/amd64/amd64/identcpu.c +++ b/sys/amd64/amd64/identcpu.c @@ -532,6 +532,13 @@ identify_cpu(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; + } + if (cpu_high >= 7) { cpuid_count(7, 0, regs); cpu_stdext_feature = regs[1]; diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c index 4abed4c..f7574b1 100644 --- a/sys/amd64/amd64/initcpu.c +++ b/sys/amd64/amd64/initcpu.c @@ -75,6 +75,9 @@ u_int cpu_mxcsr_mask; /* Valid bits in mxcsr */ u_int cpu_clflush_line_size = 32; u_int cpu_stdext_feature; u_int cpu_max_ext_state_size; +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"); diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index 6ffcf63..34bfde4 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -58,6 +58,9 @@ extern u_int cpu_procinfo; extern u_int cpu_procinfo2; extern char cpu_vendor[]; extern u_int cpu_vendor_id; +extern u_int cpu_mon_mwait_flags; +extern u_int cpu_mon_min_size; +extern u_int cpu_mon_max_size; extern char ctx_switch_xsave[]; extern char kstack[]; extern char sigcode[]; |