diff options
author | jkim <jkim@FreeBSD.org> | 2008-10-22 00:01:53 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2008-10-22 00:01:53 +0000 |
commit | d0d7e3dcb3b0125c2346eaf5119af0811c1f8ff8 (patch) | |
tree | b30add38ed594f926fbd84ed2fb7f1f455d6c459 /sys/amd64 | |
parent | bd659883761ce8d4c859d2311add4ec776cb04fe (diff) | |
download | FreeBSD-src-d0d7e3dcb3b0125c2346eaf5119af0811c1f8ff8.zip FreeBSD-src-d0d7e3dcb3b0125c2346eaf5119af0811c1f8ff8.tar.gz |
Set kern.timecounter.invariant_tsc to 1 for AMD CPU family 10h and higher
even if BIOS does not advertise it.
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/identcpu.c | 4 | ||||
-rw-r--r-- | sys/amd64/include/specialreg.h | 17 |
2 files changed, 20 insertions, 1 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 |