Probe P-state invariant TSC from rightful place.

This commit is contained in:
Jung-uk Kim 2010-12-07 22:12:02 +00:00
parent fa5f3816c4
commit 78a661bbaa
4 changed files with 46 additions and 44 deletions

View File

@ -392,28 +392,6 @@ printcpuinfo(void)
* If this CPU supports P-state invariant TSC then
* mention the capability.
*/
switch (cpu_vendor_id) {
case CPU_VENDOR_AMD:
if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
CPUID_TO_FAMILY(cpu_id) >= 0x10 ||
cpu_id == 0x60fb2)
tsc_is_invariant = 1;
break;
case CPU_VENDOR_INTEL:
if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
(CPUID_TO_FAMILY(cpu_id) == 0x6 &&
CPUID_TO_MODEL(cpu_id) >= 0xe) ||
(CPUID_TO_FAMILY(cpu_id) == 0xf &&
CPUID_TO_MODEL(cpu_id) >= 0x3))
tsc_is_invariant = 1;
break;
case CPU_VENDOR_CENTAUR:
if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
CPUID_TO_MODEL(cpu_id) >= 0xf &&
(rdmsr(0x1203) & 0x100000000ULL) == 0)
tsc_is_invariant = 1;
break;
}
if (tsc_is_invariant)
printf("\n TSC: P-state invariant");

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/power.h>
#include <sys/smp.h>
#include <machine/clock.h>
#include <machine/cputypes.h>
#include <machine/md_var.h>
#include <machine/specialreg.h>
@ -94,6 +95,28 @@ init_TSC(void)
if (bootverbose)
printf("TSC clock: %lu Hz\n", tsc_freq);
switch (cpu_vendor_id) {
case CPU_VENDOR_AMD:
if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
CPUID_TO_FAMILY(cpu_id) >= 0x10 || cpu_id == 0x60fb2)
tsc_is_invariant = 1;
break;
case CPU_VENDOR_INTEL:
if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
(CPUID_TO_FAMILY(cpu_id) == 0x6 &&
CPUID_TO_MODEL(cpu_id) >= 0xe) ||
(CPUID_TO_FAMILY(cpu_id) == 0xf &&
CPUID_TO_MODEL(cpu_id) >= 0x3))
tsc_is_invariant = 1;
break;
case CPU_VENDOR_CENTAUR:
if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
CPUID_TO_MODEL(cpu_id) >= 0xf &&
(rdmsr(0x1203) & 0x100000000ULL) == 0)
tsc_is_invariant = 1;
break;
}
/*
* Inform CPU accounting about our boot-time clock rate. Once the
* system is finished booting, we will get the real max clock rate

View File

@ -856,28 +856,6 @@ printcpuinfo(void)
* If this CPU supports P-state invariant TSC then
* mention the capability.
*/
switch (cpu_vendor_id) {
case CPU_VENDOR_AMD:
if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
CPUID_TO_FAMILY(cpu_id) >= 0x10 ||
cpu_id == 0x60fb2)
tsc_is_invariant = 1;
break;
case CPU_VENDOR_INTEL:
if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
(CPUID_TO_FAMILY(cpu_id) == 0x6 &&
CPUID_TO_MODEL(cpu_id) >= 0xe) ||
(CPUID_TO_FAMILY(cpu_id) == 0xf &&
CPUID_TO_MODEL(cpu_id) >= 0x3))
tsc_is_invariant = 1;
break;
case CPU_VENDOR_CENTAUR:
if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
CPUID_TO_MODEL(cpu_id) >= 0xf &&
(rdmsr(0x1203) & 0x100000000ULL) == 0)
tsc_is_invariant = 1;
break;
}
if (tsc_is_invariant)
printf("\n TSC: P-state invariant");

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/power.h>
#include <sys/smp.h>
#include <machine/clock.h>
#include <machine/cputypes.h>
#include <machine/md_var.h>
#include <machine/specialreg.h>
@ -103,6 +104,28 @@ init_TSC(void)
if (bootverbose)
printf("TSC clock: %ju Hz\n", (intmax_t)tsc_freq);
switch (cpu_vendor_id) {
case CPU_VENDOR_AMD:
if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
CPUID_TO_FAMILY(cpu_id) >= 0x10 || cpu_id == 0x60fb2)
tsc_is_invariant = 1;
break;
case CPU_VENDOR_INTEL:
if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
(CPUID_TO_FAMILY(cpu_id) == 0x6 &&
CPUID_TO_MODEL(cpu_id) >= 0xe) ||
(CPUID_TO_FAMILY(cpu_id) == 0xf &&
CPUID_TO_MODEL(cpu_id) >= 0x3))
tsc_is_invariant = 1;
break;
case CPU_VENDOR_CENTAUR:
if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
CPUID_TO_MODEL(cpu_id) >= 0xf &&
(rdmsr(0x1203) & 0x100000000ULL) == 0)
tsc_is_invariant = 1;
break;
}
/*
* Inform CPU accounting about our boot-time clock rate. Once the
* system is finished booting, we will get the real max clock rate