mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-23 10:14:55 +00:00
Rename "i586_ctr" to "tsc" (both upper and lower case instances).
Fix a couple of printfs too. Warning: This changes the names of a couple of kernel options!
This commit is contained in:
parent
cb0a3a9533
commit
71f461f86a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=32005
|
@ -36,7 +36,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp
|
||||
* $Id: identcpu.c,v 1.34 1997/12/03 02:45:42 sef Exp $
|
||||
* $Id: identcpu.c,v 1.35 1997/12/04 14:35:38 jkh Exp $
|
||||
*/
|
||||
|
||||
#include "opt_cpu.h"
|
||||
|
@ -394,8 +394,8 @@ printcpuinfo(void)
|
|||
case CPUCLASS_586:
|
||||
#ifndef SMP
|
||||
printf("%d.%02d-MHz ",
|
||||
(i586_ctr_freq + 4999) / 1000000,
|
||||
((i586_ctr_freq + 4999) / 10000) % 100);
|
||||
(tsc_freq + 4999) / 1000000,
|
||||
((tsc_freq + 4999) / 10000) % 100);
|
||||
#endif
|
||||
printf("586");
|
||||
break;
|
||||
|
@ -404,8 +404,8 @@ printcpuinfo(void)
|
|||
case CPUCLASS_686:
|
||||
#ifndef SMP
|
||||
printf("%d.%02d-MHz ",
|
||||
(i586_ctr_freq + 4999) / 1000000,
|
||||
((i586_ctr_freq + 4999) / 10000) % 100);
|
||||
(tsc_freq + 4999) / 1000000,
|
||||
((tsc_freq + 4999) / 10000) % 100);
|
||||
#endif
|
||||
printf("686");
|
||||
break;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: prof_machdep.c,v 1.6 1997/02/22 09:36:59 peter Exp $
|
||||
* $Id: prof_machdep.c,v 1.7 1997/11/24 18:16:23 bde Exp $
|
||||
*/
|
||||
|
||||
#ifdef GUPROF
|
||||
|
@ -51,7 +51,7 @@
|
|||
#ifdef GUPROF
|
||||
#define CPUTIME_CLOCK_UNINITIALIZED 0
|
||||
#define CPUTIME_CLOCK_I8254 1
|
||||
#define CPUTIME_CLOCK_I586_CTR 2
|
||||
#define CPUTIME_CLOCK_TSC 2
|
||||
#define CPUTIME_CLOCK_I586_PMC 3
|
||||
#define CPUTIME_CLOCK_I8254_SHIFT 7
|
||||
|
||||
|
@ -177,7 +177,7 @@ cputime()
|
|||
static u_int prev_count;
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
if (cputime_clock == CPUTIME_CLOCK_I586_CTR) {
|
||||
if (cputime_clock == CPUTIME_CLOCK_TSC) {
|
||||
count = (u_int)rdtsc();
|
||||
delta = (int)(count - prev_count);
|
||||
prev_count = count;
|
||||
|
@ -279,14 +279,14 @@ startguprof(gp)
|
|||
if (cputime_clock == CPUTIME_CLOCK_UNINITIALIZED) {
|
||||
cputime_clock = CPUTIME_CLOCK_I8254;
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
if (i586_ctr_freq != 0)
|
||||
cputime_clock = CPUTIME_CLOCK_I586_CTR;
|
||||
if (tsc_freq != 0)
|
||||
cputime_clock = CPUTIME_CLOCK_TSC;
|
||||
#endif
|
||||
}
|
||||
gp->profrate = timer_freq << CPUTIME_CLOCK_I8254_SHIFT;
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
if (cputime_clock == CPUTIME_CLOCK_I586_CTR)
|
||||
gp->profrate = i586_ctr_freq;
|
||||
if (cputime_clock == CPUTIME_CLOCK_TSC)
|
||||
gp->profrate = tsc_freq;
|
||||
#if defined(PERFMON) && defined(I586_PMC_GUPROF)
|
||||
else if (cputime_clock == CPUTIME_CLOCK_I586_PMC) {
|
||||
if (perfmon_avail() &&
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.103 1997/10/28 11:43:57 bde Exp $
|
||||
* $Id: clock.c,v 1.104 1997/11/18 11:16:56 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -118,12 +118,12 @@ int disable_rtc_set; /* disable resettodr() if != 0 */
|
|||
u_int idelayed;
|
||||
#if defined(I586_CPU) || defined(I686_CPU)
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_bias;
|
||||
u_int i586_ctr_comultiplier;
|
||||
u_int tsc_bias;
|
||||
u_int tsc_comultiplier;
|
||||
#endif
|
||||
u_int i586_ctr_freq;
|
||||
u_int tsc_freq;
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_multiplier;
|
||||
u_int tsc_multiplier;
|
||||
#endif
|
||||
#endif
|
||||
int statclock_disable;
|
||||
|
@ -164,7 +164,7 @@ static u_char timer2_state;
|
|||
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq);
|
||||
static void set_tsc_freq(u_int i586_freq, u_int i8254_freq);
|
||||
#endif
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
|
||||
|
@ -613,9 +613,9 @@ calibrate_clocks(void)
|
|||
* similar to those for the i8254 clock.
|
||||
*/
|
||||
if (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686) {
|
||||
set_i586_ctr_freq((u_int)rdtsc(), tot_count);
|
||||
set_tsc_freq((u_int)rdtsc(), tot_count);
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz, ", i586_ctr_freq);
|
||||
printf("TSC clock: %u Hz, ", tsc_freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -690,22 +690,22 @@ startrtclock()
|
|||
"%d Hz differs from default of %d Hz by more than 1%%\n",
|
||||
freq, timer_freq);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
i586_ctr_freq = 0;
|
||||
tsc_freq = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
set_timer_freq(timer_freq, hz);
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
#ifndef CLK_USE_I586_CALIBRATION
|
||||
if (i586_ctr_freq != 0) {
|
||||
#ifndef CLK_USE_TSC_CALIBRATION
|
||||
if (tsc_freq != 0) {
|
||||
if (bootverbose)
|
||||
printf(
|
||||
"CLK_USE_I586_CALIBRATION not specified - using old calibration method\n");
|
||||
i586_ctr_freq = 0;
|
||||
"CLK_USE_TSC_CALIBRATION not specified - using old calibration method\n");
|
||||
tsc_freq = 0;
|
||||
}
|
||||
#endif
|
||||
if (i586_ctr_freq == 0 &&
|
||||
if (tsc_freq == 0 &&
|
||||
(cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) {
|
||||
/*
|
||||
* Calibration of the i586 clock relative to the mc146818A
|
||||
|
@ -714,10 +714,10 @@ startrtclock()
|
|||
*/
|
||||
wrmsr(0x10, 0LL); /* XXX */
|
||||
DELAY(1000000);
|
||||
set_i586_ctr_freq((u_int)rdtsc(), timer_freq);
|
||||
set_tsc_freq((u_int)rdtsc(), timer_freq);
|
||||
#ifdef CLK_USE_I586_CALIBRATION
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz\n", i586_ctr_freq);
|
||||
printf("TSC clock: %u Hz\n", tsc_freq);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -929,8 +929,8 @@ cpu_initclocks()
|
|||
/*
|
||||
* Finish setting up anti-jitter measures.
|
||||
*/
|
||||
if (i586_ctr_freq != 0)
|
||||
i586_ctr_bias = rdtsc();
|
||||
if (tsc_freq != 0)
|
||||
tsc_bias = rdtsc();
|
||||
#endif
|
||||
|
||||
/* Initialize RTC. */
|
||||
|
@ -989,7 +989,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
|||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
set_i586_ctr_freq(i586_ctr_freq, timer_freq);
|
||||
set_tsc_freq(tsc_freq, timer_freq);
|
||||
#endif
|
||||
}
|
||||
return (error);
|
||||
|
@ -1000,23 +1000,23 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW,
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void
|
||||
set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq)
|
||||
set_tsc_freq(u_int i586_freq, u_int i8254_freq)
|
||||
{
|
||||
u_int comultiplier, multiplier;
|
||||
u_long ef;
|
||||
|
||||
if (i586_freq == 0) {
|
||||
i586_ctr_freq = i586_freq;
|
||||
tsc_freq = i586_freq;
|
||||
return;
|
||||
}
|
||||
comultiplier = ((unsigned long long)i586_freq
|
||||
<< I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq;
|
||||
<< TSC_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << TSC_MULTIPLIER_SHIFT) / i586_freq;
|
||||
ef = read_eflags();
|
||||
disable_intr();
|
||||
i586_ctr_freq = i586_freq;
|
||||
i586_ctr_comultiplier = comultiplier;
|
||||
i586_ctr_multiplier = multiplier;
|
||||
tsc_freq = i586_freq;
|
||||
tsc_comultiplier = comultiplier;
|
||||
tsc_multiplier = multiplier;
|
||||
CLOCK_UNLOCK();
|
||||
write_eflags(ef);
|
||||
}
|
||||
|
@ -1029,10 +1029,10 @@ sysctl_machdep_i586_freq SYSCTL_HANDLER_ARGS
|
|||
|
||||
if (cpu_class != CPUCLASS_586 && cpu_class != CPUCLASS_686)
|
||||
return (EOPNOTSUPP);
|
||||
freq = i586_ctr_freq;
|
||||
freq = tsc_freq;
|
||||
error = sysctl_handle_opaque(oidp, &freq, sizeof freq, req);
|
||||
if (error == 0 && req->newptr != NULL)
|
||||
set_i586_ctr_freq(freq, timer_freq);
|
||||
set_tsc_freq(freq, timer_freq);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Garrett Wollman, September 1994.
|
||||
* This file is in the public domain.
|
||||
*
|
||||
* $Id: clock.h,v 1.26 1997/05/04 14:25:00 peter Exp $
|
||||
* $Id: clock.h,v 1.27 1997/05/05 09:34:33 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CLOCK_H_
|
||||
|
@ -17,8 +17,8 @@
|
|||
|
||||
#define CPU_THISTICKLEN(dflt) dflt
|
||||
|
||||
#define I586_CTR_COMULTIPLIER_SHIFT 20
|
||||
#define I586_CTR_MULTIPLIER_SHIFT 32
|
||||
#define TSC_COMULTIPLIER_SHIFT 20
|
||||
#define TSC_MULTIPLIER_SHIFT 32
|
||||
|
||||
#ifdef KERNEL
|
||||
/*
|
||||
|
@ -30,12 +30,12 @@ extern int adjkerntz;
|
|||
extern int disable_rtc_set;
|
||||
#if defined(I586_CPU) || defined(I686_CPU)
|
||||
#ifndef SMP
|
||||
extern u_int i586_ctr_bias;
|
||||
extern u_int i586_ctr_comultiplier;
|
||||
extern u_int tsc_bias;
|
||||
extern u_int tsc_comultiplier;
|
||||
#endif
|
||||
extern u_int i586_ctr_freq;
|
||||
extern u_int tsc_freq;
|
||||
#ifndef SMP
|
||||
extern u_int i586_ctr_multiplier;
|
||||
extern u_int tsc_multiplier;
|
||||
#endif
|
||||
#endif
|
||||
extern int statclock_disable;
|
||||
|
@ -87,8 +87,8 @@ clock_latency(void)
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
/*
|
||||
* When we update `time', on i586's we also update `i586_ctr_bias'
|
||||
* atomically. `i586_ctr_bias' is the best available approximation to
|
||||
* When we update `time', on i586's we also update `tsc_bias'
|
||||
* atomically. `tsc_bias' is the best available approximation to
|
||||
* the value of the i586 counter (mod 2^32) at the time of the i8254
|
||||
* counter transition that caused the clock interrupt that caused the
|
||||
* update. clock_latency() gives the time between the transition and
|
||||
|
@ -100,18 +100,18 @@ clock_latency(void)
|
|||
static __inline void
|
||||
cpu_clockupdate(volatile struct timeval *otime, struct timeval *ntime)
|
||||
{
|
||||
if (i586_ctr_freq != 0) {
|
||||
if (tsc_freq != 0) {
|
||||
u_int i586_count; /* truncated */
|
||||
u_int i8254_count;
|
||||
|
||||
disable_intr();
|
||||
i8254_count = clock_latency();
|
||||
i586_count = rdtsc();
|
||||
i586_ctr_bias = i586_count
|
||||
tsc_bias = i586_count
|
||||
- (u_int)
|
||||
(((unsigned long long)i586_ctr_comultiplier
|
||||
(((unsigned long long)tsc_comultiplier
|
||||
* i8254_count)
|
||||
>> I586_CTR_COMULTIPLIER_SHIFT);
|
||||
>> TSC_COMULTIPLIER_SHIFT);
|
||||
*otime = *ntime;
|
||||
enable_intr();
|
||||
} else
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.103 1997/10/28 11:43:57 bde Exp $
|
||||
* $Id: clock.c,v 1.104 1997/11/18 11:16:56 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -118,12 +118,12 @@ int disable_rtc_set; /* disable resettodr() if != 0 */
|
|||
u_int idelayed;
|
||||
#if defined(I586_CPU) || defined(I686_CPU)
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_bias;
|
||||
u_int i586_ctr_comultiplier;
|
||||
u_int tsc_bias;
|
||||
u_int tsc_comultiplier;
|
||||
#endif
|
||||
u_int i586_ctr_freq;
|
||||
u_int tsc_freq;
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_multiplier;
|
||||
u_int tsc_multiplier;
|
||||
#endif
|
||||
#endif
|
||||
int statclock_disable;
|
||||
|
@ -164,7 +164,7 @@ static u_char timer2_state;
|
|||
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq);
|
||||
static void set_tsc_freq(u_int i586_freq, u_int i8254_freq);
|
||||
#endif
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
|
||||
|
@ -613,9 +613,9 @@ calibrate_clocks(void)
|
|||
* similar to those for the i8254 clock.
|
||||
*/
|
||||
if (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686) {
|
||||
set_i586_ctr_freq((u_int)rdtsc(), tot_count);
|
||||
set_tsc_freq((u_int)rdtsc(), tot_count);
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz, ", i586_ctr_freq);
|
||||
printf("TSC clock: %u Hz, ", tsc_freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -690,22 +690,22 @@ startrtclock()
|
|||
"%d Hz differs from default of %d Hz by more than 1%%\n",
|
||||
freq, timer_freq);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
i586_ctr_freq = 0;
|
||||
tsc_freq = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
set_timer_freq(timer_freq, hz);
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
#ifndef CLK_USE_I586_CALIBRATION
|
||||
if (i586_ctr_freq != 0) {
|
||||
#ifndef CLK_USE_TSC_CALIBRATION
|
||||
if (tsc_freq != 0) {
|
||||
if (bootverbose)
|
||||
printf(
|
||||
"CLK_USE_I586_CALIBRATION not specified - using old calibration method\n");
|
||||
i586_ctr_freq = 0;
|
||||
"CLK_USE_TSC_CALIBRATION not specified - using old calibration method\n");
|
||||
tsc_freq = 0;
|
||||
}
|
||||
#endif
|
||||
if (i586_ctr_freq == 0 &&
|
||||
if (tsc_freq == 0 &&
|
||||
(cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) {
|
||||
/*
|
||||
* Calibration of the i586 clock relative to the mc146818A
|
||||
|
@ -714,10 +714,10 @@ startrtclock()
|
|||
*/
|
||||
wrmsr(0x10, 0LL); /* XXX */
|
||||
DELAY(1000000);
|
||||
set_i586_ctr_freq((u_int)rdtsc(), timer_freq);
|
||||
set_tsc_freq((u_int)rdtsc(), timer_freq);
|
||||
#ifdef CLK_USE_I586_CALIBRATION
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz\n", i586_ctr_freq);
|
||||
printf("TSC clock: %u Hz\n", tsc_freq);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -929,8 +929,8 @@ cpu_initclocks()
|
|||
/*
|
||||
* Finish setting up anti-jitter measures.
|
||||
*/
|
||||
if (i586_ctr_freq != 0)
|
||||
i586_ctr_bias = rdtsc();
|
||||
if (tsc_freq != 0)
|
||||
tsc_bias = rdtsc();
|
||||
#endif
|
||||
|
||||
/* Initialize RTC. */
|
||||
|
@ -989,7 +989,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
|||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
set_i586_ctr_freq(i586_ctr_freq, timer_freq);
|
||||
set_tsc_freq(tsc_freq, timer_freq);
|
||||
#endif
|
||||
}
|
||||
return (error);
|
||||
|
@ -1000,23 +1000,23 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW,
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void
|
||||
set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq)
|
||||
set_tsc_freq(u_int i586_freq, u_int i8254_freq)
|
||||
{
|
||||
u_int comultiplier, multiplier;
|
||||
u_long ef;
|
||||
|
||||
if (i586_freq == 0) {
|
||||
i586_ctr_freq = i586_freq;
|
||||
tsc_freq = i586_freq;
|
||||
return;
|
||||
}
|
||||
comultiplier = ((unsigned long long)i586_freq
|
||||
<< I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq;
|
||||
<< TSC_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << TSC_MULTIPLIER_SHIFT) / i586_freq;
|
||||
ef = read_eflags();
|
||||
disable_intr();
|
||||
i586_ctr_freq = i586_freq;
|
||||
i586_ctr_comultiplier = comultiplier;
|
||||
i586_ctr_multiplier = multiplier;
|
||||
tsc_freq = i586_freq;
|
||||
tsc_comultiplier = comultiplier;
|
||||
tsc_multiplier = multiplier;
|
||||
CLOCK_UNLOCK();
|
||||
write_eflags(ef);
|
||||
}
|
||||
|
@ -1029,10 +1029,10 @@ sysctl_machdep_i586_freq SYSCTL_HANDLER_ARGS
|
|||
|
||||
if (cpu_class != CPUCLASS_586 && cpu_class != CPUCLASS_686)
|
||||
return (EOPNOTSUPP);
|
||||
freq = i586_ctr_freq;
|
||||
freq = tsc_freq;
|
||||
error = sysctl_handle_opaque(oidp, &freq, sizeof freq, req);
|
||||
if (error == 0 && req->newptr != NULL)
|
||||
set_i586_ctr_freq(freq, timer_freq);
|
||||
set_tsc_freq(freq, timer_freq);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: options.pc98,v 1.43 1997/12/05 11:51:29 kato Exp $
|
||||
# $Id: options.pc98,v 1.44 1997/12/10 09:28:59 kato Exp $
|
||||
BOUNCEPAGES opt_bounce.h
|
||||
USER_LDT
|
||||
MATH_EMULATE opt_math_emulate.h
|
||||
|
@ -23,7 +23,7 @@ COM_ESP opt_sio.h
|
|||
COM_MULTIPORT opt_sio.h
|
||||
DSI_SOFT_MODEM opt_sio.h
|
||||
EXTRA_SIO opt_sio.h
|
||||
I586_CTR_GUPROF opt_i586_guprof.h
|
||||
TSC_GUPROF opt_i586_guprof.h
|
||||
I586_PMC_GUPROF opt_i586_guprof.h
|
||||
WLCACHE opt_wavelan.h
|
||||
WLDEBUG opt_wavelan.h
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp
|
||||
* $Id: identcpu.c,v 1.34 1997/12/03 02:45:42 sef Exp $
|
||||
* $Id: identcpu.c,v 1.35 1997/12/04 14:35:38 jkh Exp $
|
||||
*/
|
||||
|
||||
#include "opt_cpu.h"
|
||||
|
@ -394,8 +394,8 @@ printcpuinfo(void)
|
|||
case CPUCLASS_586:
|
||||
#ifndef SMP
|
||||
printf("%d.%02d-MHz ",
|
||||
(i586_ctr_freq + 4999) / 1000000,
|
||||
((i586_ctr_freq + 4999) / 10000) % 100);
|
||||
(tsc_freq + 4999) / 1000000,
|
||||
((tsc_freq + 4999) / 10000) % 100);
|
||||
#endif
|
||||
printf("586");
|
||||
break;
|
||||
|
@ -404,8 +404,8 @@ printcpuinfo(void)
|
|||
case CPUCLASS_686:
|
||||
#ifndef SMP
|
||||
printf("%d.%02d-MHz ",
|
||||
(i586_ctr_freq + 4999) / 1000000,
|
||||
((i586_ctr_freq + 4999) / 10000) % 100);
|
||||
(tsc_freq + 4999) / 1000000,
|
||||
((tsc_freq + 4999) / 10000) % 100);
|
||||
#endif
|
||||
printf("686");
|
||||
break;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Steve McCanne's microtime code
|
||||
* $Id: microtime.s,v 1.35 1997/12/15 02:18:19 tegge Exp $
|
||||
* $Id: microtime.s,v 1.36 1997/12/26 20:15:03 phk Exp $
|
||||
*/
|
||||
|
||||
#include <machine/asmacros.h>
|
||||
|
@ -48,14 +48,14 @@
|
|||
ENTRY(microtime)
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
movl _i586_ctr_freq, %ecx
|
||||
movl _tsc_freq, %ecx
|
||||
testl %ecx, %ecx
|
||||
je i8254_microtime
|
||||
pushfl
|
||||
cli
|
||||
.byte 0x0f, 0x31 /* RDTSC */
|
||||
subl _i586_ctr_bias, %eax
|
||||
mull _i586_ctr_multiplier
|
||||
subl _tsc_bias, %eax
|
||||
mull _tsc_multiplier
|
||||
movl %edx, %eax
|
||||
jmp common_microtime
|
||||
#else
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: perfmon.c,v 1.11 1997/07/01 01:18:38 bde Exp $
|
||||
* $Id: perfmon.c,v 1.12 1997/10/28 15:58:10 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -343,7 +343,7 @@ perfmon_ioctl(dev_t dev, int cmd, caddr_t param, int flags, struct proc *p)
|
|||
case PMIOTSTAMP:
|
||||
pmct = (struct pmc_tstamp *)param;
|
||||
/* XXX interface loses precision. */
|
||||
pmct->pmct_rate = i586_ctr_freq / 1000000;
|
||||
pmct->pmct_rate = tsc_freq / 1000000;
|
||||
pmct->pmct_value = rdtsc();
|
||||
rv = 0;
|
||||
break;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.103 1997/10/28 11:43:57 bde Exp $
|
||||
* $Id: clock.c,v 1.104 1997/11/18 11:16:56 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -118,12 +118,12 @@ int disable_rtc_set; /* disable resettodr() if != 0 */
|
|||
u_int idelayed;
|
||||
#if defined(I586_CPU) || defined(I686_CPU)
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_bias;
|
||||
u_int i586_ctr_comultiplier;
|
||||
u_int tsc_bias;
|
||||
u_int tsc_comultiplier;
|
||||
#endif
|
||||
u_int i586_ctr_freq;
|
||||
u_int tsc_freq;
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_multiplier;
|
||||
u_int tsc_multiplier;
|
||||
#endif
|
||||
#endif
|
||||
int statclock_disable;
|
||||
|
@ -164,7 +164,7 @@ static u_char timer2_state;
|
|||
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq);
|
||||
static void set_tsc_freq(u_int i586_freq, u_int i8254_freq);
|
||||
#endif
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
|
||||
|
@ -613,9 +613,9 @@ calibrate_clocks(void)
|
|||
* similar to those for the i8254 clock.
|
||||
*/
|
||||
if (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686) {
|
||||
set_i586_ctr_freq((u_int)rdtsc(), tot_count);
|
||||
set_tsc_freq((u_int)rdtsc(), tot_count);
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz, ", i586_ctr_freq);
|
||||
printf("TSC clock: %u Hz, ", tsc_freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -690,22 +690,22 @@ startrtclock()
|
|||
"%d Hz differs from default of %d Hz by more than 1%%\n",
|
||||
freq, timer_freq);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
i586_ctr_freq = 0;
|
||||
tsc_freq = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
set_timer_freq(timer_freq, hz);
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
#ifndef CLK_USE_I586_CALIBRATION
|
||||
if (i586_ctr_freq != 0) {
|
||||
#ifndef CLK_USE_TSC_CALIBRATION
|
||||
if (tsc_freq != 0) {
|
||||
if (bootverbose)
|
||||
printf(
|
||||
"CLK_USE_I586_CALIBRATION not specified - using old calibration method\n");
|
||||
i586_ctr_freq = 0;
|
||||
"CLK_USE_TSC_CALIBRATION not specified - using old calibration method\n");
|
||||
tsc_freq = 0;
|
||||
}
|
||||
#endif
|
||||
if (i586_ctr_freq == 0 &&
|
||||
if (tsc_freq == 0 &&
|
||||
(cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) {
|
||||
/*
|
||||
* Calibration of the i586 clock relative to the mc146818A
|
||||
|
@ -714,10 +714,10 @@ startrtclock()
|
|||
*/
|
||||
wrmsr(0x10, 0LL); /* XXX */
|
||||
DELAY(1000000);
|
||||
set_i586_ctr_freq((u_int)rdtsc(), timer_freq);
|
||||
set_tsc_freq((u_int)rdtsc(), timer_freq);
|
||||
#ifdef CLK_USE_I586_CALIBRATION
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz\n", i586_ctr_freq);
|
||||
printf("TSC clock: %u Hz\n", tsc_freq);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -929,8 +929,8 @@ cpu_initclocks()
|
|||
/*
|
||||
* Finish setting up anti-jitter measures.
|
||||
*/
|
||||
if (i586_ctr_freq != 0)
|
||||
i586_ctr_bias = rdtsc();
|
||||
if (tsc_freq != 0)
|
||||
tsc_bias = rdtsc();
|
||||
#endif
|
||||
|
||||
/* Initialize RTC. */
|
||||
|
@ -989,7 +989,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
|||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
set_i586_ctr_freq(i586_ctr_freq, timer_freq);
|
||||
set_tsc_freq(tsc_freq, timer_freq);
|
||||
#endif
|
||||
}
|
||||
return (error);
|
||||
|
@ -1000,23 +1000,23 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW,
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void
|
||||
set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq)
|
||||
set_tsc_freq(u_int i586_freq, u_int i8254_freq)
|
||||
{
|
||||
u_int comultiplier, multiplier;
|
||||
u_long ef;
|
||||
|
||||
if (i586_freq == 0) {
|
||||
i586_ctr_freq = i586_freq;
|
||||
tsc_freq = i586_freq;
|
||||
return;
|
||||
}
|
||||
comultiplier = ((unsigned long long)i586_freq
|
||||
<< I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq;
|
||||
<< TSC_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << TSC_MULTIPLIER_SHIFT) / i586_freq;
|
||||
ef = read_eflags();
|
||||
disable_intr();
|
||||
i586_ctr_freq = i586_freq;
|
||||
i586_ctr_comultiplier = comultiplier;
|
||||
i586_ctr_multiplier = multiplier;
|
||||
tsc_freq = i586_freq;
|
||||
tsc_comultiplier = comultiplier;
|
||||
tsc_multiplier = multiplier;
|
||||
CLOCK_UNLOCK();
|
||||
write_eflags(ef);
|
||||
}
|
||||
|
@ -1029,10 +1029,10 @@ sysctl_machdep_i586_freq SYSCTL_HANDLER_ARGS
|
|||
|
||||
if (cpu_class != CPUCLASS_586 && cpu_class != CPUCLASS_686)
|
||||
return (EOPNOTSUPP);
|
||||
freq = i586_ctr_freq;
|
||||
freq = tsc_freq;
|
||||
error = sysctl_handle_opaque(oidp, &freq, sizeof freq, req);
|
||||
if (error == 0 && req->newptr != NULL)
|
||||
set_i586_ctr_freq(freq, timer_freq);
|
||||
set_tsc_freq(freq, timer_freq);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: asnames.h,v 1.11 1997/12/08 22:56:39 fsmp Exp $
|
||||
* $Id: asnames.h,v 1.12 1997/12/18 02:09:29 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_ASNAMES_H_
|
||||
|
@ -234,9 +234,9 @@
|
|||
#define _get_isrlock get_isrlock
|
||||
#define _get_mplock get_mplock
|
||||
#define _get_syscall_lock get_syscall_lock
|
||||
#define _i586_ctr_bias i586_ctr_bias
|
||||
#define _i586_ctr_freq i586_ctr_freq
|
||||
#define _i586_ctr_multiplier i586_ctr_multiplier
|
||||
#define _tsc_bias tsc_bias
|
||||
#define _tsc_freq tsc_freq
|
||||
#define _tsc_multiplier tsc_multiplier
|
||||
#define _idqs idqs
|
||||
#define _imen imen
|
||||
#define _imen_lock imen_lock
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Garrett Wollman, September 1994.
|
||||
* This file is in the public domain.
|
||||
*
|
||||
* $Id: clock.h,v 1.26 1997/05/04 14:25:00 peter Exp $
|
||||
* $Id: clock.h,v 1.27 1997/05/05 09:34:33 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CLOCK_H_
|
||||
|
@ -17,8 +17,8 @@
|
|||
|
||||
#define CPU_THISTICKLEN(dflt) dflt
|
||||
|
||||
#define I586_CTR_COMULTIPLIER_SHIFT 20
|
||||
#define I586_CTR_MULTIPLIER_SHIFT 32
|
||||
#define TSC_COMULTIPLIER_SHIFT 20
|
||||
#define TSC_MULTIPLIER_SHIFT 32
|
||||
|
||||
#ifdef KERNEL
|
||||
/*
|
||||
|
@ -30,12 +30,12 @@ extern int adjkerntz;
|
|||
extern int disable_rtc_set;
|
||||
#if defined(I586_CPU) || defined(I686_CPU)
|
||||
#ifndef SMP
|
||||
extern u_int i586_ctr_bias;
|
||||
extern u_int i586_ctr_comultiplier;
|
||||
extern u_int tsc_bias;
|
||||
extern u_int tsc_comultiplier;
|
||||
#endif
|
||||
extern u_int i586_ctr_freq;
|
||||
extern u_int tsc_freq;
|
||||
#ifndef SMP
|
||||
extern u_int i586_ctr_multiplier;
|
||||
extern u_int tsc_multiplier;
|
||||
#endif
|
||||
#endif
|
||||
extern int statclock_disable;
|
||||
|
@ -87,8 +87,8 @@ clock_latency(void)
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
/*
|
||||
* When we update `time', on i586's we also update `i586_ctr_bias'
|
||||
* atomically. `i586_ctr_bias' is the best available approximation to
|
||||
* When we update `time', on i586's we also update `tsc_bias'
|
||||
* atomically. `tsc_bias' is the best available approximation to
|
||||
* the value of the i586 counter (mod 2^32) at the time of the i8254
|
||||
* counter transition that caused the clock interrupt that caused the
|
||||
* update. clock_latency() gives the time between the transition and
|
||||
|
@ -100,18 +100,18 @@ clock_latency(void)
|
|||
static __inline void
|
||||
cpu_clockupdate(volatile struct timeval *otime, struct timeval *ntime)
|
||||
{
|
||||
if (i586_ctr_freq != 0) {
|
||||
if (tsc_freq != 0) {
|
||||
u_int i586_count; /* truncated */
|
||||
u_int i8254_count;
|
||||
|
||||
disable_intr();
|
||||
i8254_count = clock_latency();
|
||||
i586_count = rdtsc();
|
||||
i586_ctr_bias = i586_count
|
||||
tsc_bias = i586_count
|
||||
- (u_int)
|
||||
(((unsigned long long)i586_ctr_comultiplier
|
||||
(((unsigned long long)tsc_comultiplier
|
||||
* i8254_count)
|
||||
>> I586_CTR_COMULTIPLIER_SHIFT);
|
||||
>> TSC_COMULTIPLIER_SHIFT);
|
||||
*otime = *ntime;
|
||||
enable_intr();
|
||||
} else
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.103 1997/10/28 11:43:57 bde Exp $
|
||||
* $Id: clock.c,v 1.104 1997/11/18 11:16:56 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -118,12 +118,12 @@ int disable_rtc_set; /* disable resettodr() if != 0 */
|
|||
u_int idelayed;
|
||||
#if defined(I586_CPU) || defined(I686_CPU)
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_bias;
|
||||
u_int i586_ctr_comultiplier;
|
||||
u_int tsc_bias;
|
||||
u_int tsc_comultiplier;
|
||||
#endif
|
||||
u_int i586_ctr_freq;
|
||||
u_int tsc_freq;
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_multiplier;
|
||||
u_int tsc_multiplier;
|
||||
#endif
|
||||
#endif
|
||||
int statclock_disable;
|
||||
|
@ -164,7 +164,7 @@ static u_char timer2_state;
|
|||
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq);
|
||||
static void set_tsc_freq(u_int i586_freq, u_int i8254_freq);
|
||||
#endif
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
|
||||
|
@ -613,9 +613,9 @@ calibrate_clocks(void)
|
|||
* similar to those for the i8254 clock.
|
||||
*/
|
||||
if (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686) {
|
||||
set_i586_ctr_freq((u_int)rdtsc(), tot_count);
|
||||
set_tsc_freq((u_int)rdtsc(), tot_count);
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz, ", i586_ctr_freq);
|
||||
printf("TSC clock: %u Hz, ", tsc_freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -690,22 +690,22 @@ startrtclock()
|
|||
"%d Hz differs from default of %d Hz by more than 1%%\n",
|
||||
freq, timer_freq);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
i586_ctr_freq = 0;
|
||||
tsc_freq = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
set_timer_freq(timer_freq, hz);
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
#ifndef CLK_USE_I586_CALIBRATION
|
||||
if (i586_ctr_freq != 0) {
|
||||
#ifndef CLK_USE_TSC_CALIBRATION
|
||||
if (tsc_freq != 0) {
|
||||
if (bootverbose)
|
||||
printf(
|
||||
"CLK_USE_I586_CALIBRATION not specified - using old calibration method\n");
|
||||
i586_ctr_freq = 0;
|
||||
"CLK_USE_TSC_CALIBRATION not specified - using old calibration method\n");
|
||||
tsc_freq = 0;
|
||||
}
|
||||
#endif
|
||||
if (i586_ctr_freq == 0 &&
|
||||
if (tsc_freq == 0 &&
|
||||
(cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) {
|
||||
/*
|
||||
* Calibration of the i586 clock relative to the mc146818A
|
||||
|
@ -714,10 +714,10 @@ startrtclock()
|
|||
*/
|
||||
wrmsr(0x10, 0LL); /* XXX */
|
||||
DELAY(1000000);
|
||||
set_i586_ctr_freq((u_int)rdtsc(), timer_freq);
|
||||
set_tsc_freq((u_int)rdtsc(), timer_freq);
|
||||
#ifdef CLK_USE_I586_CALIBRATION
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz\n", i586_ctr_freq);
|
||||
printf("TSC clock: %u Hz\n", tsc_freq);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -929,8 +929,8 @@ cpu_initclocks()
|
|||
/*
|
||||
* Finish setting up anti-jitter measures.
|
||||
*/
|
||||
if (i586_ctr_freq != 0)
|
||||
i586_ctr_bias = rdtsc();
|
||||
if (tsc_freq != 0)
|
||||
tsc_bias = rdtsc();
|
||||
#endif
|
||||
|
||||
/* Initialize RTC. */
|
||||
|
@ -989,7 +989,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
|||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
set_i586_ctr_freq(i586_ctr_freq, timer_freq);
|
||||
set_tsc_freq(tsc_freq, timer_freq);
|
||||
#endif
|
||||
}
|
||||
return (error);
|
||||
|
@ -1000,23 +1000,23 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW,
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void
|
||||
set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq)
|
||||
set_tsc_freq(u_int i586_freq, u_int i8254_freq)
|
||||
{
|
||||
u_int comultiplier, multiplier;
|
||||
u_long ef;
|
||||
|
||||
if (i586_freq == 0) {
|
||||
i586_ctr_freq = i586_freq;
|
||||
tsc_freq = i586_freq;
|
||||
return;
|
||||
}
|
||||
comultiplier = ((unsigned long long)i586_freq
|
||||
<< I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq;
|
||||
<< TSC_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << TSC_MULTIPLIER_SHIFT) / i586_freq;
|
||||
ef = read_eflags();
|
||||
disable_intr();
|
||||
i586_ctr_freq = i586_freq;
|
||||
i586_ctr_comultiplier = comultiplier;
|
||||
i586_ctr_multiplier = multiplier;
|
||||
tsc_freq = i586_freq;
|
||||
tsc_comultiplier = comultiplier;
|
||||
tsc_multiplier = multiplier;
|
||||
CLOCK_UNLOCK();
|
||||
write_eflags(ef);
|
||||
}
|
||||
|
@ -1029,10 +1029,10 @@ sysctl_machdep_i586_freq SYSCTL_HANDLER_ARGS
|
|||
|
||||
if (cpu_class != CPUCLASS_586 && cpu_class != CPUCLASS_686)
|
||||
return (EOPNOTSUPP);
|
||||
freq = i586_ctr_freq;
|
||||
freq = tsc_freq;
|
||||
error = sysctl_handle_opaque(oidp, &freq, sizeof freq, req);
|
||||
if (error == 0 && req->newptr != NULL)
|
||||
set_i586_ctr_freq(freq, timer_freq);
|
||||
set_tsc_freq(freq, timer_freq);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: prof_machdep.c,v 1.6 1997/02/22 09:36:59 peter Exp $
|
||||
* $Id: prof_machdep.c,v 1.7 1997/11/24 18:16:23 bde Exp $
|
||||
*/
|
||||
|
||||
#ifdef GUPROF
|
||||
|
@ -51,7 +51,7 @@
|
|||
#ifdef GUPROF
|
||||
#define CPUTIME_CLOCK_UNINITIALIZED 0
|
||||
#define CPUTIME_CLOCK_I8254 1
|
||||
#define CPUTIME_CLOCK_I586_CTR 2
|
||||
#define CPUTIME_CLOCK_TSC 2
|
||||
#define CPUTIME_CLOCK_I586_PMC 3
|
||||
#define CPUTIME_CLOCK_I8254_SHIFT 7
|
||||
|
||||
|
@ -177,7 +177,7 @@ cputime()
|
|||
static u_int prev_count;
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
if (cputime_clock == CPUTIME_CLOCK_I586_CTR) {
|
||||
if (cputime_clock == CPUTIME_CLOCK_TSC) {
|
||||
count = (u_int)rdtsc();
|
||||
delta = (int)(count - prev_count);
|
||||
prev_count = count;
|
||||
|
@ -279,14 +279,14 @@ startguprof(gp)
|
|||
if (cputime_clock == CPUTIME_CLOCK_UNINITIALIZED) {
|
||||
cputime_clock = CPUTIME_CLOCK_I8254;
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
if (i586_ctr_freq != 0)
|
||||
cputime_clock = CPUTIME_CLOCK_I586_CTR;
|
||||
if (tsc_freq != 0)
|
||||
cputime_clock = CPUTIME_CLOCK_TSC;
|
||||
#endif
|
||||
}
|
||||
gp->profrate = timer_freq << CPUTIME_CLOCK_I8254_SHIFT;
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
if (cputime_clock == CPUTIME_CLOCK_I586_CTR)
|
||||
gp->profrate = i586_ctr_freq;
|
||||
if (cputime_clock == CPUTIME_CLOCK_TSC)
|
||||
gp->profrate = tsc_freq;
|
||||
#if defined(PERFMON) && defined(I586_PMC_GUPROF)
|
||||
else if (cputime_clock == CPUTIME_CLOCK_I586_PMC) {
|
||||
if (perfmon_avail() &&
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* random_machdep.c -- A strong random number generator
|
||||
*
|
||||
* $Id: random_machdep.c,v 1.18 1997/09/14 03:19:15 peter Exp $
|
||||
* $Id: random_machdep.c,v 1.19 1997/10/28 15:58:13 bde Exp $
|
||||
*
|
||||
* Version 0.95, last modified 18-Oct-95
|
||||
*
|
||||
|
@ -191,7 +191,7 @@ add_timer_randomness(struct random_bucket *r, struct timer_rand_state *state,
|
|||
u_int32_t time;
|
||||
|
||||
#if defined(I586_CPU) || defined(I686_CPU)
|
||||
if (i586_ctr_freq != 0) {
|
||||
if (tsc_freq != 0) {
|
||||
num ^= (u_int32_t) rdtsc() << 16;
|
||||
r->entropy_count += 2;
|
||||
} else {
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.103 1997/10/28 11:43:57 bde Exp $
|
||||
* $Id: clock.c,v 1.104 1997/11/18 11:16:56 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -118,12 +118,12 @@ int disable_rtc_set; /* disable resettodr() if != 0 */
|
|||
u_int idelayed;
|
||||
#if defined(I586_CPU) || defined(I686_CPU)
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_bias;
|
||||
u_int i586_ctr_comultiplier;
|
||||
u_int tsc_bias;
|
||||
u_int tsc_comultiplier;
|
||||
#endif
|
||||
u_int i586_ctr_freq;
|
||||
u_int tsc_freq;
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_multiplier;
|
||||
u_int tsc_multiplier;
|
||||
#endif
|
||||
#endif
|
||||
int statclock_disable;
|
||||
|
@ -164,7 +164,7 @@ static u_char timer2_state;
|
|||
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq);
|
||||
static void set_tsc_freq(u_int i586_freq, u_int i8254_freq);
|
||||
#endif
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
|
||||
|
@ -613,9 +613,9 @@ calibrate_clocks(void)
|
|||
* similar to those for the i8254 clock.
|
||||
*/
|
||||
if (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686) {
|
||||
set_i586_ctr_freq((u_int)rdtsc(), tot_count);
|
||||
set_tsc_freq((u_int)rdtsc(), tot_count);
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz, ", i586_ctr_freq);
|
||||
printf("TSC clock: %u Hz, ", tsc_freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -690,22 +690,22 @@ startrtclock()
|
|||
"%d Hz differs from default of %d Hz by more than 1%%\n",
|
||||
freq, timer_freq);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
i586_ctr_freq = 0;
|
||||
tsc_freq = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
set_timer_freq(timer_freq, hz);
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
#ifndef CLK_USE_I586_CALIBRATION
|
||||
if (i586_ctr_freq != 0) {
|
||||
#ifndef CLK_USE_TSC_CALIBRATION
|
||||
if (tsc_freq != 0) {
|
||||
if (bootverbose)
|
||||
printf(
|
||||
"CLK_USE_I586_CALIBRATION not specified - using old calibration method\n");
|
||||
i586_ctr_freq = 0;
|
||||
"CLK_USE_TSC_CALIBRATION not specified - using old calibration method\n");
|
||||
tsc_freq = 0;
|
||||
}
|
||||
#endif
|
||||
if (i586_ctr_freq == 0 &&
|
||||
if (tsc_freq == 0 &&
|
||||
(cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) {
|
||||
/*
|
||||
* Calibration of the i586 clock relative to the mc146818A
|
||||
|
@ -714,10 +714,10 @@ startrtclock()
|
|||
*/
|
||||
wrmsr(0x10, 0LL); /* XXX */
|
||||
DELAY(1000000);
|
||||
set_i586_ctr_freq((u_int)rdtsc(), timer_freq);
|
||||
set_tsc_freq((u_int)rdtsc(), timer_freq);
|
||||
#ifdef CLK_USE_I586_CALIBRATION
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz\n", i586_ctr_freq);
|
||||
printf("TSC clock: %u Hz\n", tsc_freq);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -929,8 +929,8 @@ cpu_initclocks()
|
|||
/*
|
||||
* Finish setting up anti-jitter measures.
|
||||
*/
|
||||
if (i586_ctr_freq != 0)
|
||||
i586_ctr_bias = rdtsc();
|
||||
if (tsc_freq != 0)
|
||||
tsc_bias = rdtsc();
|
||||
#endif
|
||||
|
||||
/* Initialize RTC. */
|
||||
|
@ -989,7 +989,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
|||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
set_i586_ctr_freq(i586_ctr_freq, timer_freq);
|
||||
set_tsc_freq(tsc_freq, timer_freq);
|
||||
#endif
|
||||
}
|
||||
return (error);
|
||||
|
@ -1000,23 +1000,23 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW,
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void
|
||||
set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq)
|
||||
set_tsc_freq(u_int i586_freq, u_int i8254_freq)
|
||||
{
|
||||
u_int comultiplier, multiplier;
|
||||
u_long ef;
|
||||
|
||||
if (i586_freq == 0) {
|
||||
i586_ctr_freq = i586_freq;
|
||||
tsc_freq = i586_freq;
|
||||
return;
|
||||
}
|
||||
comultiplier = ((unsigned long long)i586_freq
|
||||
<< I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq;
|
||||
<< TSC_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << TSC_MULTIPLIER_SHIFT) / i586_freq;
|
||||
ef = read_eflags();
|
||||
disable_intr();
|
||||
i586_ctr_freq = i586_freq;
|
||||
i586_ctr_comultiplier = comultiplier;
|
||||
i586_ctr_multiplier = multiplier;
|
||||
tsc_freq = i586_freq;
|
||||
tsc_comultiplier = comultiplier;
|
||||
tsc_multiplier = multiplier;
|
||||
CLOCK_UNLOCK();
|
||||
write_eflags(ef);
|
||||
}
|
||||
|
@ -1029,10 +1029,10 @@ sysctl_machdep_i586_freq SYSCTL_HANDLER_ARGS
|
|||
|
||||
if (cpu_class != CPUCLASS_586 && cpu_class != CPUCLASS_686)
|
||||
return (EOPNOTSUPP);
|
||||
freq = i586_ctr_freq;
|
||||
freq = tsc_freq;
|
||||
error = sysctl_handle_opaque(oidp, &freq, sizeof freq, req);
|
||||
if (error == 0 && req->newptr != NULL)
|
||||
set_i586_ctr_freq(freq, timer_freq);
|
||||
set_tsc_freq(freq, timer_freq);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* random_machdep.c -- A strong random number generator
|
||||
*
|
||||
* $Id: random_machdep.c,v 1.18 1997/09/14 03:19:15 peter Exp $
|
||||
* $Id: random_machdep.c,v 1.19 1997/10/28 15:58:13 bde Exp $
|
||||
*
|
||||
* Version 0.95, last modified 18-Oct-95
|
||||
*
|
||||
|
@ -191,7 +191,7 @@ add_timer_randomness(struct random_bucket *r, struct timer_rand_state *state,
|
|||
u_int32_t time;
|
||||
|
||||
#if defined(I586_CPU) || defined(I686_CPU)
|
||||
if (i586_ctr_freq != 0) {
|
||||
if (tsc_freq != 0) {
|
||||
num ^= (u_int32_t) rdtsc() << 16;
|
||||
r->entropy_count += 2;
|
||||
} else {
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.36 1997/10/28 14:30:46 kato Exp $
|
||||
* $Id: clock.c,v 1.37 1997/11/19 11:35:22 kato Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -128,12 +128,12 @@ int disable_rtc_set; /* disable resettodr() if != 0 */
|
|||
u_int idelayed;
|
||||
#if defined(I586_CPU) || defined(I686_CPU)
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_bias;
|
||||
u_int i586_ctr_comultiplier;
|
||||
u_int tsc_bias;
|
||||
u_int tsc_comultiplier;
|
||||
#endif
|
||||
u_int i586_ctr_freq;
|
||||
u_int tsc_freq;
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_multiplier;
|
||||
u_int tsc_multiplier;
|
||||
#endif
|
||||
#endif
|
||||
int statclock_disable;
|
||||
|
@ -197,7 +197,7 @@ static void rtc_outb __P((int));
|
|||
#endif
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq);
|
||||
static void set_tsc_freq(u_int i586_freq, u_int i8254_freq);
|
||||
#endif
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
|
||||
|
@ -754,9 +754,9 @@ calibrate_clocks(void)
|
|||
* similar to those for the i8254 clock.
|
||||
*/
|
||||
if (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686) {
|
||||
set_i586_ctr_freq((u_int)rdtsc(), tot_count);
|
||||
set_tsc_freq((u_int)rdtsc(), tot_count);
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz, ", i586_ctr_freq);
|
||||
printf("i586 clock: %u Hz, ", tsc_freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -855,7 +855,7 @@ startrtclock()
|
|||
"%d Hz differs from default of %d Hz by more than 1%%\n",
|
||||
freq, timer_freq);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
i586_ctr_freq = 0;
|
||||
tsc_freq = 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -864,14 +864,14 @@ startrtclock()
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
#ifndef CLK_USE_I586_CALIBRATION
|
||||
if (i586_ctr_freq != 0) {
|
||||
if (tsc_freq != 0) {
|
||||
if (bootverbose)
|
||||
printf(
|
||||
"CLK_USE_I586_CALIBRATION not specified - using old calibration method\n");
|
||||
i586_ctr_freq = 0;
|
||||
tsc_freq = 0;
|
||||
}
|
||||
#endif
|
||||
if (i586_ctr_freq == 0 &&
|
||||
if (tsc_freq == 0 &&
|
||||
(cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) {
|
||||
/*
|
||||
* Calibration of the i586 clock relative to the mc146818A
|
||||
|
@ -880,10 +880,10 @@ startrtclock()
|
|||
*/
|
||||
wrmsr(0x10, 0LL); /* XXX */
|
||||
DELAY(1000000);
|
||||
set_i586_ctr_freq((u_int)rdtsc(), timer_freq);
|
||||
set_tsc_freq((u_int)rdtsc(), timer_freq);
|
||||
#ifdef CLK_USE_I586_CALIBRATION
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz\n", i586_ctr_freq);
|
||||
printf("i586 clock: %u Hz\n", tsc_freq);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -1233,8 +1233,8 @@ cpu_initclocks()
|
|||
/*
|
||||
* Finish setting up anti-jitter measures.
|
||||
*/
|
||||
if (i586_ctr_freq != 0)
|
||||
i586_ctr_bias = rdtsc();
|
||||
if (tsc_freq != 0)
|
||||
tsc_bias = rdtsc();
|
||||
#endif
|
||||
|
||||
#ifndef PC98
|
||||
|
@ -1297,7 +1297,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
|||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
set_i586_ctr_freq(i586_ctr_freq, timer_freq);
|
||||
set_tsc_freq(tsc_freq, timer_freq);
|
||||
#endif
|
||||
}
|
||||
return (error);
|
||||
|
@ -1308,23 +1308,23 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW,
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void
|
||||
set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq)
|
||||
set_tsc_freq(u_int i586_freq, u_int i8254_freq)
|
||||
{
|
||||
u_int comultiplier, multiplier;
|
||||
u_long ef;
|
||||
|
||||
if (i586_freq == 0) {
|
||||
i586_ctr_freq = i586_freq;
|
||||
tsc_freq = i586_freq;
|
||||
return;
|
||||
}
|
||||
comultiplier = ((unsigned long long)i586_freq
|
||||
<< I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq;
|
||||
<< TSC_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << TSC_MULTIPLIER_SHIFT) / i586_freq;
|
||||
ef = read_eflags();
|
||||
disable_intr();
|
||||
i586_ctr_freq = i586_freq;
|
||||
i586_ctr_comultiplier = comultiplier;
|
||||
i586_ctr_multiplier = multiplier;
|
||||
tsc_freq = i586_freq;
|
||||
tsc_comultiplier = comultiplier;
|
||||
tsc_multiplier = multiplier;
|
||||
CLOCK_UNLOCK();
|
||||
write_eflags(ef);
|
||||
}
|
||||
|
@ -1337,10 +1337,10 @@ sysctl_machdep_i586_freq SYSCTL_HANDLER_ARGS
|
|||
|
||||
if (cpu_class != CPUCLASS_586 && cpu_class != CPUCLASS_686)
|
||||
return (EOPNOTSUPP);
|
||||
freq = i586_ctr_freq;
|
||||
freq = tsc_freq;
|
||||
error = sysctl_handle_opaque(oidp, &freq, sizeof freq, req);
|
||||
if (error == 0 && req->newptr != NULL)
|
||||
set_i586_ctr_freq(freq, timer_freq);
|
||||
set_tsc_freq(freq, timer_freq);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.36 1997/10/28 14:30:46 kato Exp $
|
||||
* $Id: clock.c,v 1.37 1997/11/19 11:35:22 kato Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -128,12 +128,12 @@ int disable_rtc_set; /* disable resettodr() if != 0 */
|
|||
u_int idelayed;
|
||||
#if defined(I586_CPU) || defined(I686_CPU)
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_bias;
|
||||
u_int i586_ctr_comultiplier;
|
||||
u_int tsc_bias;
|
||||
u_int tsc_comultiplier;
|
||||
#endif
|
||||
u_int i586_ctr_freq;
|
||||
u_int tsc_freq;
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_multiplier;
|
||||
u_int tsc_multiplier;
|
||||
#endif
|
||||
#endif
|
||||
int statclock_disable;
|
||||
|
@ -197,7 +197,7 @@ static void rtc_outb __P((int));
|
|||
#endif
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq);
|
||||
static void set_tsc_freq(u_int i586_freq, u_int i8254_freq);
|
||||
#endif
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
|
||||
|
@ -754,9 +754,9 @@ calibrate_clocks(void)
|
|||
* similar to those for the i8254 clock.
|
||||
*/
|
||||
if (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686) {
|
||||
set_i586_ctr_freq((u_int)rdtsc(), tot_count);
|
||||
set_tsc_freq((u_int)rdtsc(), tot_count);
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz, ", i586_ctr_freq);
|
||||
printf("i586 clock: %u Hz, ", tsc_freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -855,7 +855,7 @@ startrtclock()
|
|||
"%d Hz differs from default of %d Hz by more than 1%%\n",
|
||||
freq, timer_freq);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
i586_ctr_freq = 0;
|
||||
tsc_freq = 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -864,14 +864,14 @@ startrtclock()
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
#ifndef CLK_USE_I586_CALIBRATION
|
||||
if (i586_ctr_freq != 0) {
|
||||
if (tsc_freq != 0) {
|
||||
if (bootverbose)
|
||||
printf(
|
||||
"CLK_USE_I586_CALIBRATION not specified - using old calibration method\n");
|
||||
i586_ctr_freq = 0;
|
||||
tsc_freq = 0;
|
||||
}
|
||||
#endif
|
||||
if (i586_ctr_freq == 0 &&
|
||||
if (tsc_freq == 0 &&
|
||||
(cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) {
|
||||
/*
|
||||
* Calibration of the i586 clock relative to the mc146818A
|
||||
|
@ -880,10 +880,10 @@ startrtclock()
|
|||
*/
|
||||
wrmsr(0x10, 0LL); /* XXX */
|
||||
DELAY(1000000);
|
||||
set_i586_ctr_freq((u_int)rdtsc(), timer_freq);
|
||||
set_tsc_freq((u_int)rdtsc(), timer_freq);
|
||||
#ifdef CLK_USE_I586_CALIBRATION
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz\n", i586_ctr_freq);
|
||||
printf("i586 clock: %u Hz\n", tsc_freq);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -1233,8 +1233,8 @@ cpu_initclocks()
|
|||
/*
|
||||
* Finish setting up anti-jitter measures.
|
||||
*/
|
||||
if (i586_ctr_freq != 0)
|
||||
i586_ctr_bias = rdtsc();
|
||||
if (tsc_freq != 0)
|
||||
tsc_bias = rdtsc();
|
||||
#endif
|
||||
|
||||
#ifndef PC98
|
||||
|
@ -1297,7 +1297,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
|||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
set_i586_ctr_freq(i586_ctr_freq, timer_freq);
|
||||
set_tsc_freq(tsc_freq, timer_freq);
|
||||
#endif
|
||||
}
|
||||
return (error);
|
||||
|
@ -1308,23 +1308,23 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW,
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void
|
||||
set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq)
|
||||
set_tsc_freq(u_int i586_freq, u_int i8254_freq)
|
||||
{
|
||||
u_int comultiplier, multiplier;
|
||||
u_long ef;
|
||||
|
||||
if (i586_freq == 0) {
|
||||
i586_ctr_freq = i586_freq;
|
||||
tsc_freq = i586_freq;
|
||||
return;
|
||||
}
|
||||
comultiplier = ((unsigned long long)i586_freq
|
||||
<< I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq;
|
||||
<< TSC_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << TSC_MULTIPLIER_SHIFT) / i586_freq;
|
||||
ef = read_eflags();
|
||||
disable_intr();
|
||||
i586_ctr_freq = i586_freq;
|
||||
i586_ctr_comultiplier = comultiplier;
|
||||
i586_ctr_multiplier = multiplier;
|
||||
tsc_freq = i586_freq;
|
||||
tsc_comultiplier = comultiplier;
|
||||
tsc_multiplier = multiplier;
|
||||
CLOCK_UNLOCK();
|
||||
write_eflags(ef);
|
||||
}
|
||||
|
@ -1337,10 +1337,10 @@ sysctl_machdep_i586_freq SYSCTL_HANDLER_ARGS
|
|||
|
||||
if (cpu_class != CPUCLASS_586 && cpu_class != CPUCLASS_686)
|
||||
return (EOPNOTSUPP);
|
||||
freq = i586_ctr_freq;
|
||||
freq = tsc_freq;
|
||||
error = sysctl_handle_opaque(oidp, &freq, sizeof freq, req);
|
||||
if (error == 0 && req->newptr != NULL)
|
||||
set_i586_ctr_freq(freq, timer_freq);
|
||||
set_tsc_freq(freq, timer_freq);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: options.pc98,v 1.43 1997/12/05 11:51:29 kato Exp $
|
||||
# $Id: options.pc98,v 1.44 1997/12/10 09:28:59 kato Exp $
|
||||
BOUNCEPAGES opt_bounce.h
|
||||
USER_LDT
|
||||
MATH_EMULATE opt_math_emulate.h
|
||||
|
@ -23,7 +23,7 @@ COM_ESP opt_sio.h
|
|||
COM_MULTIPORT opt_sio.h
|
||||
DSI_SOFT_MODEM opt_sio.h
|
||||
EXTRA_SIO opt_sio.h
|
||||
I586_CTR_GUPROF opt_i586_guprof.h
|
||||
TSC_GUPROF opt_i586_guprof.h
|
||||
I586_PMC_GUPROF opt_i586_guprof.h
|
||||
WLCACHE opt_wavelan.h
|
||||
WLDEBUG opt_wavelan.h
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Steve McCanne's microtime code
|
||||
* $Id: microtime.s,v 1.18 1997/10/29 08:13:32 kato Exp $
|
||||
* $Id: microtime.s,v 1.19 1997/12/15 08:37:13 kato Exp $
|
||||
*/
|
||||
|
||||
#include <machine/asmacros.h>
|
||||
|
@ -52,7 +52,7 @@
|
|||
ENTRY(microtime)
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
movl _i586_ctr_freq, %ecx
|
||||
movl _tsc_freq, %ecx
|
||||
testl %ecx, %ecx
|
||||
jne pentium_microtime
|
||||
#else
|
||||
|
@ -293,8 +293,8 @@ pentium_microtime:
|
|||
pushfl
|
||||
cli
|
||||
.byte 0x0f, 0x31 /* RDTSC */
|
||||
subl _i586_ctr_bias, %eax
|
||||
mull _i586_ctr_multiplier
|
||||
subl _tsc_bias, %eax
|
||||
mull _tsc_multiplier
|
||||
movl %edx, %eax
|
||||
jmp common_microtime
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.36 1997/10/28 14:30:46 kato Exp $
|
||||
* $Id: clock.c,v 1.37 1997/11/19 11:35:22 kato Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -128,12 +128,12 @@ int disable_rtc_set; /* disable resettodr() if != 0 */
|
|||
u_int idelayed;
|
||||
#if defined(I586_CPU) || defined(I686_CPU)
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_bias;
|
||||
u_int i586_ctr_comultiplier;
|
||||
u_int tsc_bias;
|
||||
u_int tsc_comultiplier;
|
||||
#endif
|
||||
u_int i586_ctr_freq;
|
||||
u_int tsc_freq;
|
||||
#ifndef SMP
|
||||
u_int i586_ctr_multiplier;
|
||||
u_int tsc_multiplier;
|
||||
#endif
|
||||
#endif
|
||||
int statclock_disable;
|
||||
|
@ -197,7 +197,7 @@ static void rtc_outb __P((int));
|
|||
#endif
|
||||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq);
|
||||
static void set_tsc_freq(u_int i586_freq, u_int i8254_freq);
|
||||
#endif
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
|
||||
|
@ -754,9 +754,9 @@ calibrate_clocks(void)
|
|||
* similar to those for the i8254 clock.
|
||||
*/
|
||||
if (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686) {
|
||||
set_i586_ctr_freq((u_int)rdtsc(), tot_count);
|
||||
set_tsc_freq((u_int)rdtsc(), tot_count);
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz, ", i586_ctr_freq);
|
||||
printf("i586 clock: %u Hz, ", tsc_freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -855,7 +855,7 @@ startrtclock()
|
|||
"%d Hz differs from default of %d Hz by more than 1%%\n",
|
||||
freq, timer_freq);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
i586_ctr_freq = 0;
|
||||
tsc_freq = 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -864,14 +864,14 @@ startrtclock()
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
#ifndef CLK_USE_I586_CALIBRATION
|
||||
if (i586_ctr_freq != 0) {
|
||||
if (tsc_freq != 0) {
|
||||
if (bootverbose)
|
||||
printf(
|
||||
"CLK_USE_I586_CALIBRATION not specified - using old calibration method\n");
|
||||
i586_ctr_freq = 0;
|
||||
tsc_freq = 0;
|
||||
}
|
||||
#endif
|
||||
if (i586_ctr_freq == 0 &&
|
||||
if (tsc_freq == 0 &&
|
||||
(cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) {
|
||||
/*
|
||||
* Calibration of the i586 clock relative to the mc146818A
|
||||
|
@ -880,10 +880,10 @@ startrtclock()
|
|||
*/
|
||||
wrmsr(0x10, 0LL); /* XXX */
|
||||
DELAY(1000000);
|
||||
set_i586_ctr_freq((u_int)rdtsc(), timer_freq);
|
||||
set_tsc_freq((u_int)rdtsc(), timer_freq);
|
||||
#ifdef CLK_USE_I586_CALIBRATION
|
||||
if (bootverbose)
|
||||
printf("i586 clock: %u Hz\n", i586_ctr_freq);
|
||||
printf("i586 clock: %u Hz\n", tsc_freq);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -1233,8 +1233,8 @@ cpu_initclocks()
|
|||
/*
|
||||
* Finish setting up anti-jitter measures.
|
||||
*/
|
||||
if (i586_ctr_freq != 0)
|
||||
i586_ctr_bias = rdtsc();
|
||||
if (tsc_freq != 0)
|
||||
tsc_bias = rdtsc();
|
||||
#endif
|
||||
|
||||
#ifndef PC98
|
||||
|
@ -1297,7 +1297,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
|||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
set_i586_ctr_freq(i586_ctr_freq, timer_freq);
|
||||
set_tsc_freq(tsc_freq, timer_freq);
|
||||
#endif
|
||||
}
|
||||
return (error);
|
||||
|
@ -1308,23 +1308,23 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW,
|
|||
|
||||
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
|
||||
static void
|
||||
set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq)
|
||||
set_tsc_freq(u_int i586_freq, u_int i8254_freq)
|
||||
{
|
||||
u_int comultiplier, multiplier;
|
||||
u_long ef;
|
||||
|
||||
if (i586_freq == 0) {
|
||||
i586_ctr_freq = i586_freq;
|
||||
tsc_freq = i586_freq;
|
||||
return;
|
||||
}
|
||||
comultiplier = ((unsigned long long)i586_freq
|
||||
<< I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq;
|
||||
<< TSC_COMULTIPLIER_SHIFT) / i8254_freq;
|
||||
multiplier = (1000000LL << TSC_MULTIPLIER_SHIFT) / i586_freq;
|
||||
ef = read_eflags();
|
||||
disable_intr();
|
||||
i586_ctr_freq = i586_freq;
|
||||
i586_ctr_comultiplier = comultiplier;
|
||||
i586_ctr_multiplier = multiplier;
|
||||
tsc_freq = i586_freq;
|
||||
tsc_comultiplier = comultiplier;
|
||||
tsc_multiplier = multiplier;
|
||||
CLOCK_UNLOCK();
|
||||
write_eflags(ef);
|
||||
}
|
||||
|
@ -1337,10 +1337,10 @@ sysctl_machdep_i586_freq SYSCTL_HANDLER_ARGS
|
|||
|
||||
if (cpu_class != CPUCLASS_586 && cpu_class != CPUCLASS_686)
|
||||
return (EOPNOTSUPP);
|
||||
freq = i586_ctr_freq;
|
||||
freq = tsc_freq;
|
||||
error = sysctl_handle_opaque(oidp, &freq, sizeof freq, req);
|
||||
if (error == 0 && req->newptr != NULL)
|
||||
set_i586_ctr_freq(freq, timer_freq);
|
||||
set_tsc_freq(freq, timer_freq);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue