summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-01-29 11:36:39 +0000
committerphk <phk@FreeBSD.org>2003-01-29 11:36:39 +0000
commit36fe9fb493ad9b28c42a7b1610c704856e07467c (patch)
treeb613402a73ac4da505804ca5121a5149306cffd3
parent13e0104093cd42571839d9306eaa407ea60dbe4e (diff)
downloadFreeBSD-src-36fe9fb493ad9b28c42a7b1610c704856e07467c.zip
FreeBSD-src-36fe9fb493ad9b28c42a7b1610c704856e07467c.tar.gz
Make tsc_freq a 64bit quantity.
Inspired by: http://www.theinquirer.net/?article=7481
-rw-r--r--sys/amd64/amd64/identcpu.c13
-rw-r--r--sys/amd64/amd64/tsc.c12
-rw-r--r--sys/amd64/include/clock.h2
-rw-r--r--sys/amd64/isa/clock.c12
-rw-r--r--sys/i386/i386/identcpu.c13
-rw-r--r--sys/i386/i386/tsc.c12
-rw-r--r--sys/i386/include/clock.h2
-rw-r--r--sys/i386/isa/clock.c12
-rw-r--r--sys/isa/atrtc.c12
9 files changed, 51 insertions, 39 deletions
diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c
index 2d48d8e..e979d25 100644
--- a/sys/amd64/amd64/identcpu.c
+++ b/sys/amd64/amd64/identcpu.c
@@ -44,6 +44,7 @@
#include "opt_cpu.h"
#include <sys/param.h>
+#include <sys/stdint.h>
#include <sys/bus.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@@ -566,17 +567,17 @@ printcpuinfo(void)
#endif
#if defined(I586_CPU)
case CPUCLASS_586:
- printf("%d.%02d-MHz ",
- (tsc_freq + 4999) / 1000000,
- ((tsc_freq + 4999) / 10000) % 100);
+ printf("%jd.%02d-MHz ",
+ (intmax_t)(tsc_freq + 4999) / 1000000,
+ (u_int)((tsc_freq + 4999) / 10000) % 100);
printf("586");
break;
#endif
#if defined(I686_CPU)
case CPUCLASS_686:
- printf("%d.%02d-MHz ",
- (tsc_freq + 4999) / 1000000,
- ((tsc_freq + 4999) / 10000) % 100);
+ printf("%jd.%02d-MHz ",
+ (intmax_t)(tsc_freq + 4999) / 1000000,
+ (u_int)((tsc_freq + 4999) / 10000) % 100);
printf("686");
break;
#endif
diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c
index 140f6bc..98ef6f78 100644
--- a/sys/amd64/amd64/tsc.c
+++ b/sys/amd64/amd64/tsc.c
@@ -53,6 +53,7 @@
#include "opt_mca.h"
#include <sys/param.h>
+#include <sys/stdint.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/lock.h>
@@ -135,7 +136,7 @@ int statclock_disable;
#endif
u_int timer_freq = TIMER_FREQ;
int timer0_max_count;
-u_int tsc_freq;
+uint64_t tsc_freq;
int tsc_is_broken;
u_int tsc_present;
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
@@ -663,7 +664,7 @@ calibrate_clocks(void)
if (bootverbose) {
if (tsc_present)
- printf("TSC clock: %u Hz, ", tsc_freq);
+ printf("TSC clock: %ju Hz, ", (intmax_t)tsc_freq);
printf("i8254 clock: %u Hz\n", tot_count);
}
return (tot_count);
@@ -803,7 +804,8 @@ startrtclock()
tsc_freq = rdtsc() - old_tsc;
#ifdef CLK_USE_TSC_CALIBRATION
if (bootverbose)
- printf("TSC clock: %u Hz (Method B)\n", tsc_freq);
+ printf("TSC clock: %ju Hz (Method B)\n",
+ (intmax_t)tsc_freq);
#endif
}
@@ -1204,7 +1206,7 @@ static int
sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS)
{
int error;
- u_int freq;
+ uint64_t freq;
if (tsc_timecounter.tc_frequency == 0)
return (EOPNOTSUPP);
@@ -1217,7 +1219,7 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS)
return (error);
}
-SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_INT | CTLFLAG_RW,
+SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_QUAD | CTLFLAG_RW,
0, sizeof(u_int), sysctl_machdep_tsc_freq, "IU", "");
static unsigned
diff --git a/sys/amd64/include/clock.h b/sys/amd64/include/clock.h
index 38179a6..f6ed717 100644
--- a/sys/amd64/include/clock.h
+++ b/sys/amd64/include/clock.h
@@ -19,7 +19,7 @@ extern int disable_rtc_set;
extern int statclock_disable;
extern u_int timer_freq;
extern int timer0_max_count;
-extern u_int tsc_freq;
+extern uint64_t tsc_freq;
extern int tsc_is_broken;
extern int wall_cmos_clock;
#ifdef APIC_IO
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c
index 140f6bc..98ef6f78 100644
--- a/sys/amd64/isa/clock.c
+++ b/sys/amd64/isa/clock.c
@@ -53,6 +53,7 @@
#include "opt_mca.h"
#include <sys/param.h>
+#include <sys/stdint.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/lock.h>
@@ -135,7 +136,7 @@ int statclock_disable;
#endif
u_int timer_freq = TIMER_FREQ;
int timer0_max_count;
-u_int tsc_freq;
+uint64_t tsc_freq;
int tsc_is_broken;
u_int tsc_present;
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
@@ -663,7 +664,7 @@ calibrate_clocks(void)
if (bootverbose) {
if (tsc_present)
- printf("TSC clock: %u Hz, ", tsc_freq);
+ printf("TSC clock: %ju Hz, ", (intmax_t)tsc_freq);
printf("i8254 clock: %u Hz\n", tot_count);
}
return (tot_count);
@@ -803,7 +804,8 @@ startrtclock()
tsc_freq = rdtsc() - old_tsc;
#ifdef CLK_USE_TSC_CALIBRATION
if (bootverbose)
- printf("TSC clock: %u Hz (Method B)\n", tsc_freq);
+ printf("TSC clock: %ju Hz (Method B)\n",
+ (intmax_t)tsc_freq);
#endif
}
@@ -1204,7 +1206,7 @@ static int
sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS)
{
int error;
- u_int freq;
+ uint64_t freq;
if (tsc_timecounter.tc_frequency == 0)
return (EOPNOTSUPP);
@@ -1217,7 +1219,7 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS)
return (error);
}
-SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_INT | CTLFLAG_RW,
+SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_QUAD | CTLFLAG_RW,
0, sizeof(u_int), sysctl_machdep_tsc_freq, "IU", "");
static unsigned
diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c
index 2d48d8e..e979d25 100644
--- a/sys/i386/i386/identcpu.c
+++ b/sys/i386/i386/identcpu.c
@@ -44,6 +44,7 @@
#include "opt_cpu.h"
#include <sys/param.h>
+#include <sys/stdint.h>
#include <sys/bus.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@@ -566,17 +567,17 @@ printcpuinfo(void)
#endif
#if defined(I586_CPU)
case CPUCLASS_586:
- printf("%d.%02d-MHz ",
- (tsc_freq + 4999) / 1000000,
- ((tsc_freq + 4999) / 10000) % 100);
+ printf("%jd.%02d-MHz ",
+ (intmax_t)(tsc_freq + 4999) / 1000000,
+ (u_int)((tsc_freq + 4999) / 10000) % 100);
printf("586");
break;
#endif
#if defined(I686_CPU)
case CPUCLASS_686:
- printf("%d.%02d-MHz ",
- (tsc_freq + 4999) / 1000000,
- ((tsc_freq + 4999) / 10000) % 100);
+ printf("%jd.%02d-MHz ",
+ (intmax_t)(tsc_freq + 4999) / 1000000,
+ (u_int)((tsc_freq + 4999) / 10000) % 100);
printf("686");
break;
#endif
diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c
index 140f6bc..98ef6f78 100644
--- a/sys/i386/i386/tsc.c
+++ b/sys/i386/i386/tsc.c
@@ -53,6 +53,7 @@
#include "opt_mca.h"
#include <sys/param.h>
+#include <sys/stdint.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/lock.h>
@@ -135,7 +136,7 @@ int statclock_disable;
#endif
u_int timer_freq = TIMER_FREQ;
int timer0_max_count;
-u_int tsc_freq;
+uint64_t tsc_freq;
int tsc_is_broken;
u_int tsc_present;
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
@@ -663,7 +664,7 @@ calibrate_clocks(void)
if (bootverbose) {
if (tsc_present)
- printf("TSC clock: %u Hz, ", tsc_freq);
+ printf("TSC clock: %ju Hz, ", (intmax_t)tsc_freq);
printf("i8254 clock: %u Hz\n", tot_count);
}
return (tot_count);
@@ -803,7 +804,8 @@ startrtclock()
tsc_freq = rdtsc() - old_tsc;
#ifdef CLK_USE_TSC_CALIBRATION
if (bootverbose)
- printf("TSC clock: %u Hz (Method B)\n", tsc_freq);
+ printf("TSC clock: %ju Hz (Method B)\n",
+ (intmax_t)tsc_freq);
#endif
}
@@ -1204,7 +1206,7 @@ static int
sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS)
{
int error;
- u_int freq;
+ uint64_t freq;
if (tsc_timecounter.tc_frequency == 0)
return (EOPNOTSUPP);
@@ -1217,7 +1219,7 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS)
return (error);
}
-SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_INT | CTLFLAG_RW,
+SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_QUAD | CTLFLAG_RW,
0, sizeof(u_int), sysctl_machdep_tsc_freq, "IU", "");
static unsigned
diff --git a/sys/i386/include/clock.h b/sys/i386/include/clock.h
index 38179a6..f6ed717 100644
--- a/sys/i386/include/clock.h
+++ b/sys/i386/include/clock.h
@@ -19,7 +19,7 @@ extern int disable_rtc_set;
extern int statclock_disable;
extern u_int timer_freq;
extern int timer0_max_count;
-extern u_int tsc_freq;
+extern uint64_t tsc_freq;
extern int tsc_is_broken;
extern int wall_cmos_clock;
#ifdef APIC_IO
diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c
index 140f6bc..98ef6f78 100644
--- a/sys/i386/isa/clock.c
+++ b/sys/i386/isa/clock.c
@@ -53,6 +53,7 @@
#include "opt_mca.h"
#include <sys/param.h>
+#include <sys/stdint.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/lock.h>
@@ -135,7 +136,7 @@ int statclock_disable;
#endif
u_int timer_freq = TIMER_FREQ;
int timer0_max_count;
-u_int tsc_freq;
+uint64_t tsc_freq;
int tsc_is_broken;
u_int tsc_present;
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
@@ -663,7 +664,7 @@ calibrate_clocks(void)
if (bootverbose) {
if (tsc_present)
- printf("TSC clock: %u Hz, ", tsc_freq);
+ printf("TSC clock: %ju Hz, ", (intmax_t)tsc_freq);
printf("i8254 clock: %u Hz\n", tot_count);
}
return (tot_count);
@@ -803,7 +804,8 @@ startrtclock()
tsc_freq = rdtsc() - old_tsc;
#ifdef CLK_USE_TSC_CALIBRATION
if (bootverbose)
- printf("TSC clock: %u Hz (Method B)\n", tsc_freq);
+ printf("TSC clock: %ju Hz (Method B)\n",
+ (intmax_t)tsc_freq);
#endif
}
@@ -1204,7 +1206,7 @@ static int
sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS)
{
int error;
- u_int freq;
+ uint64_t freq;
if (tsc_timecounter.tc_frequency == 0)
return (EOPNOTSUPP);
@@ -1217,7 +1219,7 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS)
return (error);
}
-SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_INT | CTLFLAG_RW,
+SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_QUAD | CTLFLAG_RW,
0, sizeof(u_int), sysctl_machdep_tsc_freq, "IU", "");
static unsigned
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c
index 140f6bc..98ef6f78 100644
--- a/sys/isa/atrtc.c
+++ b/sys/isa/atrtc.c
@@ -53,6 +53,7 @@
#include "opt_mca.h"
#include <sys/param.h>
+#include <sys/stdint.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/lock.h>
@@ -135,7 +136,7 @@ int statclock_disable;
#endif
u_int timer_freq = TIMER_FREQ;
int timer0_max_count;
-u_int tsc_freq;
+uint64_t tsc_freq;
int tsc_is_broken;
u_int tsc_present;
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
@@ -663,7 +664,7 @@ calibrate_clocks(void)
if (bootverbose) {
if (tsc_present)
- printf("TSC clock: %u Hz, ", tsc_freq);
+ printf("TSC clock: %ju Hz, ", (intmax_t)tsc_freq);
printf("i8254 clock: %u Hz\n", tot_count);
}
return (tot_count);
@@ -803,7 +804,8 @@ startrtclock()
tsc_freq = rdtsc() - old_tsc;
#ifdef CLK_USE_TSC_CALIBRATION
if (bootverbose)
- printf("TSC clock: %u Hz (Method B)\n", tsc_freq);
+ printf("TSC clock: %ju Hz (Method B)\n",
+ (intmax_t)tsc_freq);
#endif
}
@@ -1204,7 +1206,7 @@ static int
sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS)
{
int error;
- u_int freq;
+ uint64_t freq;
if (tsc_timecounter.tc_frequency == 0)
return (EOPNOTSUPP);
@@ -1217,7 +1219,7 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS)
return (error);
}
-SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_INT | CTLFLAG_RW,
+SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_QUAD | CTLFLAG_RW,
0, sizeof(u_int), sysctl_machdep_tsc_freq, "IU", "");
static unsigned
OpenPOWER on IntegriCloud