summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/amd64/amd64/identcpu.c4
-rw-r--r--sys/amd64/include/specialreg.h17
-rw-r--r--sys/i386/i386/identcpu.c4
-rw-r--r--sys/i386/include/specialreg.h17
4 files changed, 40 insertions, 2 deletions
diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c
index 5d5f401..5cdb91f 100644
--- a/sys/amd64/amd64/identcpu.c
+++ b/sys/amd64/amd64/identcpu.c
@@ -348,7 +348,9 @@ printcpuinfo(void)
cpu_feature &= ~CPUID_HTT;
if (!tsc_is_invariant &&
- (amd_pminfo & AMDPM_TSC_INVARIANT)) {
+ (strcmp(cpu_vendor, "AuthenticAMD") == 0 &&
+ ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 ||
+ AMD64_CPU_FAMILY(cpu_id) >= 0x10))) {
tsc_is_invariant = 1;
printf("\n P-state invariant TSC");
}
diff --git a/sys/amd64/include/specialreg.h b/sys/amd64/include/specialreg.h
index d5b7c55..46058d8 100644
--- a/sys/amd64/include/specialreg.h
+++ b/sys/amd64/include/specialreg.h
@@ -153,6 +153,23 @@
#define AMDID2_PREFETCH 0x00000100
/*
+ * CPUID instruction 1 eax info
+ */
+#define CPUID_STEPPING 0x0000000f
+#define CPUID_MODEL 0x000000f0
+#define CPUID_FAMILY 0x00000f00
+#define CPUID_EXT_MODEL 0x000f0000
+#define CPUID_EXT_FAMILY 0x0ff00000
+#define AMD64_CPU_MODEL(id) \
+ ((((id) & CPUID_MODEL) >> 4) | \
+ ((((id) & CPUID_FAMILY) >= 0x600) ? \
+ (((id) & CPUID_EXT_MODEL) >> 12) : 0))
+#define AMD64_CPU_FAMILY(id) \
+ ((((id) & CPUID_FAMILY) >> 8) + \
+ ((((id) & CPUID_FAMILY) == 0xf00) ? \
+ (((id) & CPUID_EXT_FAMILY) >> 20) : 0))
+
+/*
* CPUID instruction 1 ebx info
*/
#define CPUID_BRAND_INDEX 0x000000ff
diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c
index 8ed6b5f..5fe1950 100644
--- a/sys/i386/i386/identcpu.c
+++ b/sys/i386/i386/identcpu.c
@@ -842,7 +842,9 @@ printcpuinfo(void)
cpu_feature &= ~CPUID_HTT;
if (!tsc_is_invariant &&
- (amd_pminfo & AMDPM_TSC_INVARIANT)) {
+ (strcmp(cpu_vendor, "AuthenticAMD") == 0 &&
+ (amd_pminfo & AMDPM_TSC_INVARIANT) != 0 ||
+ I386_CPU_FAMILY(cpu_id) >= 0x10))) {
tsc_is_invariant = 1;
printf("\n P-state invariant TSC");
}
diff --git a/sys/i386/include/specialreg.h b/sys/i386/include/specialreg.h
index ec9de9f..3c9ca92 100644
--- a/sys/i386/include/specialreg.h
+++ b/sys/i386/include/specialreg.h
@@ -150,6 +150,23 @@
#define AMDID2_PREFETCH 0x00000100
/*
+ * CPUID instruction 1 eax info
+ */
+#define CPUID_STEPPING 0x0000000f
+#define CPUID_MODEL 0x000000f0
+#define CPUID_FAMILY 0x00000f00
+#define CPUID_EXT_MODEL 0x000f0000
+#define CPUID_EXT_FAMILY 0x0ff00000
+#define I386_CPU_MODEL(id) \
+ ((((id) & CPUID_MODEL) >> 4) | \
+ ((((id) & CPUID_FAMILY) >= 0x600) ? \
+ (((id) & CPUID_EXT_MODEL) >> 12) : 0))
+#define I386_CPU_FAMILY(id) \
+ ((((id) & CPUID_FAMILY) >> 8) + \
+ ((((id) & CPUID_FAMILY) == 0xf00) ? \
+ (((id) & CPUID_EXT_FAMILY) >> 20) : 0))
+
+/*
* CPUID instruction 1 ebx info
*/
#define CPUID_BRAND_INDEX 0x000000ff
OpenPOWER on IntegriCloud