Eliminated i586_ctr_rate. Use i586_ctr_freq instead.

This commit is contained in:
Bruce Evans 1996-08-02 21:16:27 +00:00
parent d9927d1118
commit 70e53371c4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17395
10 changed files with 43 additions and 76 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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 {

View File

@ -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);
}

View File

@ -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 {