diff options
author | bde <bde@FreeBSD.org> | 1996-08-02 21:16:27 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-08-02 21:16:27 +0000 |
commit | 6a63ec68e3f4386c177e5a48ab38e4202ccbba30 (patch) | |
tree | d63058108217b42c249400371be568d5806baaf4 /sys | |
parent | 1cfe857c9e58f273e2440e88bd52dcc079c7b143 (diff) | |
download | FreeBSD-src-6a63ec68e3f4386c177e5a48ab38e4202ccbba30.zip FreeBSD-src-6a63ec68e3f4386c177e5a48ab38e4202ccbba30.tar.gz |
Eliminated i586_ctr_rate. Use i586_ctr_freq instead.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/identcpu.c | 8 | ||||
-rw-r--r-- | sys/amd64/amd64/tsc.c | 18 | ||||
-rw-r--r-- | sys/amd64/isa/clock.c | 18 | ||||
-rw-r--r-- | sys/i386/i386/identcpu.c | 8 | ||||
-rw-r--r-- | sys/i386/i386/perfmon.c | 5 | ||||
-rw-r--r-- | sys/i386/i386/tsc.c | 18 | ||||
-rw-r--r-- | sys/i386/isa/clock.c | 18 | ||||
-rw-r--r-- | sys/i386/isa/random_machdep.c | 4 | ||||
-rw-r--r-- | sys/isa/atrtc.c | 18 | ||||
-rw-r--r-- | sys/kern/kern_random.c | 4 |
10 files changed, 43 insertions, 76 deletions
diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c index 7d23b7d..d5acc8d 100644 --- a/sys/amd64/amd64/identcpu.c +++ b/sys/amd64/amd64/identcpu.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp - * $Id$ + * $Id: identcpu.c,v 1.1 1996/07/08 19:44:38 wollman Exp $ */ #include <sys/param.h> @@ -169,16 +169,14 @@ identifycpu(void) #if defined(I586_CPU) case CPUCLASS_586: printf("%d.%02d-MHz ", - ((100 * i586_ctr_rate) >> I586_CTR_RATE_SHIFT) / 100, - ((100 * i586_ctr_rate) >> I586_CTR_RATE_SHIFT) % 100); + i586_ctr_freq / 1000000, (i586_ctr_freq / 10000) % 100); printf("586"); break; #endif #if defined(I686_CPU) case CPUCLASS_686: printf("%d.%02d-MHz ", - ((100 * i586_ctr_rate) >> I586_CTR_RATE_SHIFT) / 100, - ((100 * i586_ctr_rate) >> I586_CTR_RATE_SHIFT) % 100); + i586_ctr_freq / 1000000, (i586_ctr_freq / 10000) % 100); printf("686"); break; #endif diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c index 7257b2f..ab7c3b6 100644 --- a/sys/amd64/amd64/tsc.c +++ b/sys/amd64/amd64/tsc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.65 1996/07/21 08:20:51 joerg Exp $ + * $Id: clock.c,v 1.66 1996/07/30 19:26:47 bde Exp $ */ /* @@ -102,11 +102,10 @@ int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */ u_int idelayed; #if defined(I586_CPU) || defined(I686_CPU) +u_int i586_ctr_bias; u_int i586_ctr_comultiplier; u_int i586_ctr_freq; u_int i586_ctr_multiplier; -unsigned i586_ctr_rate; -long long i586_ctr_bias; long long i586_last_tick; unsigned long i586_avg_tick; #endif @@ -630,7 +629,6 @@ startrtclock() freq, timer_freq); #if defined(I586_CPU) || defined(I686_CPU) i586_ctr_freq = 0; - i586_ctr_rate = 0; #endif } @@ -638,15 +636,14 @@ startrtclock() #if defined(I586_CPU) || defined(I686_CPU) #ifndef CLK_USE_I586_CALIBRATION - if (i586_ctr_rate != 0) { + if (i586_ctr_freq != 0) { if (bootverbose) printf( "CLK_USE_I586_CALIBRATION not specified - using old calibration method\n"); i586_ctr_freq = 0; - i586_ctr_rate = 0; } #endif - if (i586_ctr_rate == 0 && + if (i586_ctr_freq == 0 && (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) { /* * Calibration of the i586 clock relative to the mc146818A @@ -815,7 +812,7 @@ cpu_initclocks() /* * Finish setting up anti-jitter measures. */ - if (i586_ctr_rate) { + if (i586_ctr_freq != 0) { i586_last_tick = rdtsc(); i586_ctr_bias = i586_last_tick; } @@ -878,24 +875,21 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW, static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq) { - u_int comultiplier, multiplier, rate; + u_int comultiplier, multiplier; u_long ef; if (i586_freq == 0) { i586_ctr_freq = i586_freq; - i586_ctr_rate = 0; return; } comultiplier = ((unsigned long long)i586_freq << I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq; multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq; - rate = ((unsigned long long)i586_freq << I586_CTR_RATE_SHIFT) / 1000000; ef = read_eflags(); disable_intr(); i586_ctr_freq = i586_freq; i586_ctr_comultiplier = comultiplier; i586_ctr_multiplier = multiplier; - i586_ctr_rate = rate; write_eflags(ef); } diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index 7257b2f..ab7c3b6 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.65 1996/07/21 08:20:51 joerg Exp $ + * $Id: clock.c,v 1.66 1996/07/30 19:26:47 bde Exp $ */ /* @@ -102,11 +102,10 @@ int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */ u_int idelayed; #if defined(I586_CPU) || defined(I686_CPU) +u_int i586_ctr_bias; u_int i586_ctr_comultiplier; u_int i586_ctr_freq; u_int i586_ctr_multiplier; -unsigned i586_ctr_rate; -long long i586_ctr_bias; long long i586_last_tick; unsigned long i586_avg_tick; #endif @@ -630,7 +629,6 @@ startrtclock() freq, timer_freq); #if defined(I586_CPU) || defined(I686_CPU) i586_ctr_freq = 0; - i586_ctr_rate = 0; #endif } @@ -638,15 +636,14 @@ startrtclock() #if defined(I586_CPU) || defined(I686_CPU) #ifndef CLK_USE_I586_CALIBRATION - if (i586_ctr_rate != 0) { + if (i586_ctr_freq != 0) { if (bootverbose) printf( "CLK_USE_I586_CALIBRATION not specified - using old calibration method\n"); i586_ctr_freq = 0; - i586_ctr_rate = 0; } #endif - if (i586_ctr_rate == 0 && + if (i586_ctr_freq == 0 && (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) { /* * Calibration of the i586 clock relative to the mc146818A @@ -815,7 +812,7 @@ cpu_initclocks() /* * Finish setting up anti-jitter measures. */ - if (i586_ctr_rate) { + if (i586_ctr_freq != 0) { i586_last_tick = rdtsc(); i586_ctr_bias = i586_last_tick; } @@ -878,24 +875,21 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW, static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq) { - u_int comultiplier, multiplier, rate; + u_int comultiplier, multiplier; u_long ef; if (i586_freq == 0) { i586_ctr_freq = i586_freq; - i586_ctr_rate = 0; return; } comultiplier = ((unsigned long long)i586_freq << I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq; multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq; - rate = ((unsigned long long)i586_freq << I586_CTR_RATE_SHIFT) / 1000000; ef = read_eflags(); disable_intr(); i586_ctr_freq = i586_freq; i586_ctr_comultiplier = comultiplier; i586_ctr_multiplier = multiplier; - i586_ctr_rate = rate; write_eflags(ef); } diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c index 7d23b7d..d5acc8d 100644 --- a/sys/i386/i386/identcpu.c +++ b/sys/i386/i386/identcpu.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp - * $Id$ + * $Id: identcpu.c,v 1.1 1996/07/08 19:44:38 wollman Exp $ */ #include <sys/param.h> @@ -169,16 +169,14 @@ identifycpu(void) #if defined(I586_CPU) case CPUCLASS_586: printf("%d.%02d-MHz ", - ((100 * i586_ctr_rate) >> I586_CTR_RATE_SHIFT) / 100, - ((100 * i586_ctr_rate) >> I586_CTR_RATE_SHIFT) % 100); + i586_ctr_freq / 1000000, (i586_ctr_freq / 10000) % 100); printf("586"); break; #endif #if defined(I686_CPU) case CPUCLASS_686: printf("%d.%02d-MHz ", - ((100 * i586_ctr_rate) >> I586_CTR_RATE_SHIFT) / 100, - ((100 * i586_ctr_rate) >> I586_CTR_RATE_SHIFT) % 100); + i586_ctr_freq / 1000000, (i586_ctr_freq / 10000) % 100); printf("686"); break; #endif diff --git a/sys/i386/i386/perfmon.c b/sys/i386/i386/perfmon.c index 02c5cab..edccede 100644 --- a/sys/i386/i386/perfmon.c +++ b/sys/i386/i386/perfmon.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: perfmon.c,v 1.5 1996/03/29 17:48:21 wollman Exp $ + * $Id: perfmon.c,v 1.6 1996/06/12 05:02:51 gpalmer Exp $ */ #include <sys/param.h> @@ -339,7 +339,8 @@ perfmon_ioctl(dev_t dev, int cmd, caddr_t param, int flags, struct proc *p) case PMIOTSTAMP: pmct = (struct pmc_tstamp *)param; - pmct->pmct_rate = i586_ctr_rate >> I586_CTR_RATE_SHIFT; + /* XXX interface loses precision. */ + pmct->pmct_rate = i586_ctr_freq / 1000000; pmct->pmct_value = rdtsc(); rv = 0; break; diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c index 7257b2f..ab7c3b6 100644 --- a/sys/i386/i386/tsc.c +++ b/sys/i386/i386/tsc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.65 1996/07/21 08:20:51 joerg Exp $ + * $Id: clock.c,v 1.66 1996/07/30 19:26:47 bde Exp $ */ /* @@ -102,11 +102,10 @@ int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */ u_int idelayed; #if defined(I586_CPU) || defined(I686_CPU) +u_int i586_ctr_bias; u_int i586_ctr_comultiplier; u_int i586_ctr_freq; u_int i586_ctr_multiplier; -unsigned i586_ctr_rate; -long long i586_ctr_bias; long long i586_last_tick; unsigned long i586_avg_tick; #endif @@ -630,7 +629,6 @@ startrtclock() freq, timer_freq); #if defined(I586_CPU) || defined(I686_CPU) i586_ctr_freq = 0; - i586_ctr_rate = 0; #endif } @@ -638,15 +636,14 @@ startrtclock() #if defined(I586_CPU) || defined(I686_CPU) #ifndef CLK_USE_I586_CALIBRATION - if (i586_ctr_rate != 0) { + if (i586_ctr_freq != 0) { if (bootverbose) printf( "CLK_USE_I586_CALIBRATION not specified - using old calibration method\n"); i586_ctr_freq = 0; - i586_ctr_rate = 0; } #endif - if (i586_ctr_rate == 0 && + if (i586_ctr_freq == 0 && (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) { /* * Calibration of the i586 clock relative to the mc146818A @@ -815,7 +812,7 @@ cpu_initclocks() /* * Finish setting up anti-jitter measures. */ - if (i586_ctr_rate) { + if (i586_ctr_freq != 0) { i586_last_tick = rdtsc(); i586_ctr_bias = i586_last_tick; } @@ -878,24 +875,21 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW, static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq) { - u_int comultiplier, multiplier, rate; + u_int comultiplier, multiplier; u_long ef; if (i586_freq == 0) { i586_ctr_freq = i586_freq; - i586_ctr_rate = 0; return; } comultiplier = ((unsigned long long)i586_freq << I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq; multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq; - rate = ((unsigned long long)i586_freq << I586_CTR_RATE_SHIFT) / 1000000; ef = read_eflags(); disable_intr(); i586_ctr_freq = i586_freq; i586_ctr_comultiplier = comultiplier; i586_ctr_multiplier = multiplier; - i586_ctr_rate = rate; write_eflags(ef); } diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index 7257b2f..ab7c3b6 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.65 1996/07/21 08:20:51 joerg Exp $ + * $Id: clock.c,v 1.66 1996/07/30 19:26:47 bde Exp $ */ /* @@ -102,11 +102,10 @@ int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */ u_int idelayed; #if defined(I586_CPU) || defined(I686_CPU) +u_int i586_ctr_bias; u_int i586_ctr_comultiplier; u_int i586_ctr_freq; u_int i586_ctr_multiplier; -unsigned i586_ctr_rate; -long long i586_ctr_bias; long long i586_last_tick; unsigned long i586_avg_tick; #endif @@ -630,7 +629,6 @@ startrtclock() freq, timer_freq); #if defined(I586_CPU) || defined(I686_CPU) i586_ctr_freq = 0; - i586_ctr_rate = 0; #endif } @@ -638,15 +636,14 @@ startrtclock() #if defined(I586_CPU) || defined(I686_CPU) #ifndef CLK_USE_I586_CALIBRATION - if (i586_ctr_rate != 0) { + if (i586_ctr_freq != 0) { if (bootverbose) printf( "CLK_USE_I586_CALIBRATION not specified - using old calibration method\n"); i586_ctr_freq = 0; - i586_ctr_rate = 0; } #endif - if (i586_ctr_rate == 0 && + if (i586_ctr_freq == 0 && (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) { /* * Calibration of the i586 clock relative to the mc146818A @@ -815,7 +812,7 @@ cpu_initclocks() /* * Finish setting up anti-jitter measures. */ - if (i586_ctr_rate) { + if (i586_ctr_freq != 0) { i586_last_tick = rdtsc(); i586_ctr_bias = i586_last_tick; } @@ -878,24 +875,21 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW, static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq) { - u_int comultiplier, multiplier, rate; + u_int comultiplier, multiplier; u_long ef; if (i586_freq == 0) { i586_ctr_freq = i586_freq; - i586_ctr_rate = 0; return; } comultiplier = ((unsigned long long)i586_freq << I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq; multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq; - rate = ((unsigned long long)i586_freq << I586_CTR_RATE_SHIFT) / 1000000; ef = read_eflags(); disable_intr(); i586_ctr_freq = i586_freq; i586_ctr_comultiplier = comultiplier; i586_ctr_multiplier = multiplier; - i586_ctr_rate = rate; write_eflags(ef); } diff --git a/sys/i386/isa/random_machdep.c b/sys/i386/isa/random_machdep.c index 2b713ba..7a6ea06 100644 --- a/sys/i386/isa/random_machdep.c +++ b/sys/i386/isa/random_machdep.c @@ -1,7 +1,7 @@ /* * random_machdep.c -- A strong random number generator * - * $Id: random_machdep.c,v 1.8 1996/06/12 05:03:48 gpalmer Exp $ + * $Id: random_machdep.c,v 1.9 1996/06/17 16:47:43 bde Exp $ * * Version 0.95, last modified 18-Oct-95 * @@ -183,7 +183,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_rate != 0) { + if (i586_ctr_freq != 0) { num ^= (u_int32_t) rdtsc() << 16; r->entropy_count += 2; } else { diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index 7257b2f..ab7c3b6 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.65 1996/07/21 08:20:51 joerg Exp $ + * $Id: clock.c,v 1.66 1996/07/30 19:26:47 bde Exp $ */ /* @@ -102,11 +102,10 @@ int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */ u_int idelayed; #if defined(I586_CPU) || defined(I686_CPU) +u_int i586_ctr_bias; u_int i586_ctr_comultiplier; u_int i586_ctr_freq; u_int i586_ctr_multiplier; -unsigned i586_ctr_rate; -long long i586_ctr_bias; long long i586_last_tick; unsigned long i586_avg_tick; #endif @@ -630,7 +629,6 @@ startrtclock() freq, timer_freq); #if defined(I586_CPU) || defined(I686_CPU) i586_ctr_freq = 0; - i586_ctr_rate = 0; #endif } @@ -638,15 +636,14 @@ startrtclock() #if defined(I586_CPU) || defined(I686_CPU) #ifndef CLK_USE_I586_CALIBRATION - if (i586_ctr_rate != 0) { + if (i586_ctr_freq != 0) { if (bootverbose) printf( "CLK_USE_I586_CALIBRATION not specified - using old calibration method\n"); i586_ctr_freq = 0; - i586_ctr_rate = 0; } #endif - if (i586_ctr_rate == 0 && + if (i586_ctr_freq == 0 && (cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686)) { /* * Calibration of the i586 clock relative to the mc146818A @@ -815,7 +812,7 @@ cpu_initclocks() /* * Finish setting up anti-jitter measures. */ - if (i586_ctr_rate) { + if (i586_ctr_freq != 0) { i586_last_tick = rdtsc(); i586_ctr_bias = i586_last_tick; } @@ -878,24 +875,21 @@ SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW, static void set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq) { - u_int comultiplier, multiplier, rate; + u_int comultiplier, multiplier; u_long ef; if (i586_freq == 0) { i586_ctr_freq = i586_freq; - i586_ctr_rate = 0; return; } comultiplier = ((unsigned long long)i586_freq << I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq; multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq; - rate = ((unsigned long long)i586_freq << I586_CTR_RATE_SHIFT) / 1000000; ef = read_eflags(); disable_intr(); i586_ctr_freq = i586_freq; i586_ctr_comultiplier = comultiplier; i586_ctr_multiplier = multiplier; - i586_ctr_rate = rate; write_eflags(ef); } diff --git a/sys/kern/kern_random.c b/sys/kern/kern_random.c index 2b713ba..7a6ea06 100644 --- a/sys/kern/kern_random.c +++ b/sys/kern/kern_random.c @@ -1,7 +1,7 @@ /* * random_machdep.c -- A strong random number generator * - * $Id: random_machdep.c,v 1.8 1996/06/12 05:03:48 gpalmer Exp $ + * $Id: random_machdep.c,v 1.9 1996/06/17 16:47:43 bde Exp $ * * Version 0.95, last modified 18-Oct-95 * @@ -183,7 +183,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_rate != 0) { + if (i586_ctr_freq != 0) { num ^= (u_int32_t) rdtsc() << 16; r->entropy_count += 2; } else { |