Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Apr 2003 02:44:55 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 28214 for review
Message-ID:  <200304051044.h35AitT4047764@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=28214

Change 28214 by peter@peter_overcee on 2003/04/05 02:44:16

	hack for x86-64

Affected files ...

.. //depot/projects/hammer/sys/x86_64/x86_64/tsc.c#2 edit

Differences ...

==== //depot/projects/hammer/sys/x86_64/x86_64/tsc.c#2 (text+ko) ====

@@ -41,7 +41,7 @@
 
 uint64_t	tsc_freq;
 int		tsc_is_broken;
-u_int		tsc_present;
+u_int		tsc_present = 1;
 
 static	unsigned tsc_get_timecount(struct timecounter *tc);
 
@@ -58,14 +58,6 @@
 {
 	u_int64_t tscval[2];
 
-	if (cpu_feature & CPUID_TSC)
-		tsc_present = 1;
-	else
-		tsc_present = 0;
-
-	if (!tsc_present) 
-		return;
-
 	if (bootverbose)
 	        printf("Calibrating TSC clock ... ");
 
@@ -75,35 +67,9 @@
 
 	tsc_freq = tscval[1] - tscval[0];
 	if (bootverbose)
-		printf("TSC clock: %ju Hz\n", (intmax_t)tsc_freq);
+		printf("TSC clock: %lu Hz\n", tsc_freq);
 
-#if defined(SMP) && !defined(SMP_TSC)
-	/*
-	 * We can not use the TSC in SMP mode, until we figure out a
-	 * cheap (impossible), reliable and precise (yeah right!)  way
-	 * to synchronize the TSCs of all the CPUs.
-	 * Modern SMP hardware has the ACPI timer and we use that.
-	 */
-	return;
-#endif
-
-	/*
-	 * We can not use the TSC if we support APM. Precise timekeeping
-	 * on an APM'ed machine is at best a fools pursuit, since 
-	 * any and all of the time spent in various SMM code can't 
-	 * be reliably accounted for.  Reading the RTC is your only
-	 * source of reliable time info.  The i8254 looses too of course
-	 * but we need to have some kind of time...
-	 * We don't know at this point whether APM is going to be used
-	 * or not, nor when it might be activated.  Play it safe.
-	 */
-	if (power_pm_get_type() == POWER_PM_TYPE_APM) {
-		if (bootverbose)
-			printf("TSC timecounter disabled: APM enabled.\n");
-		return;
-	}
-
-	if (tsc_present && tsc_freq != 0 && !tsc_is_broken) {
+	if (tsc_freq != 0 && !tsc_is_broken) {
 		tsc_timecounter.tc_frequency = tsc_freq;
 		tc_init(&tsc_timecounter);
 	}
@@ -128,7 +94,7 @@
 	return (error);
 }
 
-SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_QUAD | CTLFLAG_RW,
+SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_LONG | CTLFLAG_RW,
     0, sizeof(u_int), sysctl_machdep_tsc_freq, "IU", "");
 
 static unsigned



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304051044.h35AitT4047764>