summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-01-19 10:52:55 +0000
committerkib <kib@FreeBSD.org>2015-01-19 10:52:55 +0000
commitda566e85be96a2ed618e86f2a0e67a61a8e61eef (patch)
tree5a348f34611f967445bc4597da347e2133eaf77b
parentb1054791ad23c8bd242677882470e45f3c2f9637 (diff)
downloadFreeBSD-src-da566e85be96a2ed618e86f2a0e67a61a8e61eef.zip
FreeBSD-src-da566e85be96a2ed618e86f2a0e67a61a8e61eef.tar.gz
MFC r277047:
For x86, read MAXPHYADDR into variable cpu_maxphyaddr.
-rw-r--r--sys/amd64/amd64/initcpu.c1
-rw-r--r--sys/amd64/include/md_var.h1
-rw-r--r--sys/i386/i386/initcpu.c1
-rw-r--r--sys/i386/include/md_var.h1
-rw-r--r--sys/x86/x86/identcpu.c3
5 files changed, 7 insertions, 0 deletions
diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c
index 34a362d..8551d27 100644
--- a/sys/amd64/amd64/initcpu.c
+++ b/sys/amd64/amd64/initcpu.c
@@ -78,6 +78,7 @@ 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 */
+u_int cpu_maxphyaddr; /* Max phys addr width in bits */
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 c7b89a6..a7bef6a 100644
--- a/sys/amd64/include/md_var.h
+++ b/sys/amd64/include/md_var.h
@@ -61,6 +61,7 @@ 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 u_int cpu_maxphyaddr;
extern char ctx_switch_xsave[];
extern char kstack[];
extern char sigcode[];
diff --git a/sys/i386/i386/initcpu.c b/sys/i386/i386/initcpu.c
index 62e2cf3..291f3fc 100644
--- a/sys/i386/i386/initcpu.c
+++ b/sys/i386/i386/initcpu.c
@@ -107,6 +107,7 @@ 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 */
u_int cyrix_did; /* Device ID of Cyrix CPU */
+u_int cpu_maxphyaddr; /* Max phys addr width in bits */
SYSCTL_UINT(_hw, OID_AUTO, via_feature_rng, CTLFLAG_RD,
&via_feature_rng, 0, "VIA RNG feature available in CPU");
diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h
index b124a3e..ec9d2ce 100644
--- a/sys/i386/include/md_var.h
+++ b/sys/i386/include/md_var.h
@@ -61,6 +61,7 @@ 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 u_int cpu_maxphyaddr;
extern u_int cyrix_did;
#if defined(I586_CPU) && !defined(NO_F00F_HACK)
extern int has_f00f_bug;
diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c
index 87a5664..8bdc14e 100644
--- a/sys/x86/x86/identcpu.c
+++ b/sys/x86/x86/identcpu.c
@@ -1289,7 +1289,10 @@ identify_cpu(void)
}
if (cpu_exthigh >= 0x80000008) {
do_cpuid(0x80000008, regs);
+ cpu_maxphyaddr = regs[0] & 0xff;
cpu_procinfo2 = regs[2];
+ } else {
+ cpu_maxphyaddr = (cpu_feature & CPUID_PAE) != 0 ? 36 : 32;
}
#ifdef __i386__
OpenPOWER on IntegriCloud