Make the machdep.i8254_freq and machdep.tsc_freq sysctls modify the
timecounter as well Asked for by: bde, jhay
This commit is contained in:
parent
477f9db33d
commit
0bb2226a4d
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.130 1999/04/21 07:26:27 peter Exp $
|
||||
* $Id: clock.c,v 1.131 1999/04/21 07:41:40 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1115,6 +1115,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
||||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
i8254_timecounter.tc_frequency = freq;
|
||||
update_timecounter(&i8254_timecounter);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
@ -1135,6 +1136,7 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
|
||||
if (error == 0 && req->newptr != NULL) {
|
||||
tsc_freq = freq;
|
||||
tsc_timecounter.tc_frequency = tsc_freq;
|
||||
update_timecounter(&tsc_timecounter);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.130 1999/04/21 07:26:27 peter Exp $
|
||||
* $Id: clock.c,v 1.131 1999/04/21 07:41:40 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1115,6 +1115,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
||||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
i8254_timecounter.tc_frequency = freq;
|
||||
update_timecounter(&i8254_timecounter);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
@ -1135,6 +1136,7 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
|
||||
if (error == 0 && req->newptr != NULL) {
|
||||
tsc_freq = freq;
|
||||
tsc_timecounter.tc_frequency = tsc_freq;
|
||||
update_timecounter(&tsc_timecounter);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.130 1999/04/21 07:26:27 peter Exp $
|
||||
* $Id: clock.c,v 1.131 1999/04/21 07:41:40 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1115,6 +1115,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
||||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
i8254_timecounter.tc_frequency = freq;
|
||||
update_timecounter(&i8254_timecounter);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
@ -1135,6 +1136,7 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
|
||||
if (error == 0 && req->newptr != NULL) {
|
||||
tsc_freq = freq;
|
||||
tsc_timecounter.tc_frequency = tsc_freq;
|
||||
update_timecounter(&tsc_timecounter);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.130 1999/04/21 07:26:27 peter Exp $
|
||||
* $Id: clock.c,v 1.131 1999/04/21 07:41:40 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1115,6 +1115,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
||||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
i8254_timecounter.tc_frequency = freq;
|
||||
update_timecounter(&i8254_timecounter);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
@ -1135,6 +1136,7 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
|
||||
if (error == 0 && req->newptr != NULL) {
|
||||
tsc_freq = freq;
|
||||
tsc_timecounter.tc_frequency = tsc_freq;
|
||||
update_timecounter(&tsc_timecounter);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.130 1999/04/21 07:26:27 peter Exp $
|
||||
* $Id: clock.c,v 1.131 1999/04/21 07:41:40 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1115,6 +1115,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
|
||||
return (EBUSY); /* too much trouble to handle */
|
||||
set_timer_freq(freq, hz);
|
||||
i8254_timecounter.tc_frequency = freq;
|
||||
update_timecounter(&i8254_timecounter);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
@ -1135,6 +1136,7 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
|
||||
if (error == 0 && req->newptr != NULL) {
|
||||
tsc_freq = freq;
|
||||
tsc_timecounter.tc_frequency = tsc_freq;
|
||||
update_timecounter(&tsc_timecounter);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
|
||||
* $Id: kern_clock.c,v 1.92 1999/03/12 21:58:54 phk Exp $
|
||||
* $Id: kern_clock.c,v 1.93 1999/04/02 13:57:21 phk Exp $
|
||||
*/
|
||||
|
||||
#include "opt_ntp.h"
|
||||
@ -656,12 +656,18 @@ tco_setscales(struct timecounter *tc)
|
||||
|
||||
scale = 1000000000LL << 32;
|
||||
scale += tc->tc_adjustment;
|
||||
scale /= tc->tc_frequency;
|
||||
scale /= tc->tc_tweak->tc_frequency;
|
||||
tc->tc_scale_micro = scale / 1000;
|
||||
tc->tc_scale_nano_f = scale & 0xffffffff;
|
||||
tc->tc_scale_nano_i = scale >> 32;
|
||||
}
|
||||
|
||||
void
|
||||
update_timecounter(struct timecounter *tc)
|
||||
{
|
||||
tco_setscales(tc);
|
||||
}
|
||||
|
||||
void
|
||||
init_timecounter(struct timecounter *tc)
|
||||
{
|
||||
@ -670,9 +676,9 @@ init_timecounter(struct timecounter *tc)
|
||||
int i;
|
||||
|
||||
tc->tc_adjustment = 0;
|
||||
tc->tc_tweak = tc;
|
||||
tco_setscales(tc);
|
||||
tc->tc_offset_count = tc->tc_get_timecount(tc);
|
||||
tc->tc_tweak = tc;
|
||||
MALLOC(t1, struct timecounter *, sizeof *t1, M_TIMECOUNTER, M_WAITOK);
|
||||
*t1 = *tc;
|
||||
t2 = t1;
|
||||
|
@ -37,7 +37,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
|
||||
* $Id: kern_clock.c,v 1.92 1999/03/12 21:58:54 phk Exp $
|
||||
* $Id: kern_clock.c,v 1.93 1999/04/02 13:57:21 phk Exp $
|
||||
*/
|
||||
|
||||
#include "opt_ntp.h"
|
||||
@ -656,12 +656,18 @@ tco_setscales(struct timecounter *tc)
|
||||
|
||||
scale = 1000000000LL << 32;
|
||||
scale += tc->tc_adjustment;
|
||||
scale /= tc->tc_frequency;
|
||||
scale /= tc->tc_tweak->tc_frequency;
|
||||
tc->tc_scale_micro = scale / 1000;
|
||||
tc->tc_scale_nano_f = scale & 0xffffffff;
|
||||
tc->tc_scale_nano_i = scale >> 32;
|
||||
}
|
||||
|
||||
void
|
||||
update_timecounter(struct timecounter *tc)
|
||||
{
|
||||
tco_setscales(tc);
|
||||
}
|
||||
|
||||
void
|
||||
init_timecounter(struct timecounter *tc)
|
||||
{
|
||||
@ -670,9 +676,9 @@ init_timecounter(struct timecounter *tc)
|
||||
int i;
|
||||
|
||||
tc->tc_adjustment = 0;
|
||||
tc->tc_tweak = tc;
|
||||
tco_setscales(tc);
|
||||
tc->tc_offset_count = tc->tc_get_timecount(tc);
|
||||
tc->tc_tweak = tc;
|
||||
MALLOC(t1, struct timecounter *, sizeof *t1, M_TIMECOUNTER, M_WAITOK);
|
||||
*t1 = *tc;
|
||||
t2 = t1;
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)time.h 8.5 (Berkeley) 5/4/95
|
||||
* $Id: time.h,v 1.36 1999/03/08 12:36:14 phk Exp $
|
||||
* $Id: time.h,v 1.37 1999/03/11 15:09:41 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_TIME_H_
|
||||
@ -280,6 +280,7 @@ void set_timecounter __P((struct timespec *ts));
|
||||
void timevaladd __P((struct timeval *, struct timeval *));
|
||||
void timevalsub __P((struct timeval *, struct timeval *));
|
||||
int tvtohz __P((struct timeval *));
|
||||
void update_timecounter __P((struct timecounter *tc));
|
||||
#else /* !KERNEL */
|
||||
#include <time.h>
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)time.h 8.5 (Berkeley) 5/4/95
|
||||
* $Id: time.h,v 1.36 1999/03/08 12:36:14 phk Exp $
|
||||
* $Id: time.h,v 1.37 1999/03/11 15:09:41 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_TIME_H_
|
||||
@ -280,6 +280,7 @@ void set_timecounter __P((struct timespec *ts));
|
||||
void timevaladd __P((struct timeval *, struct timeval *));
|
||||
void timevalsub __P((struct timeval *, struct timeval *));
|
||||
int tvtohz __P((struct timeval *));
|
||||
void update_timecounter __P((struct timecounter *tc));
|
||||
#else /* !KERNEL */
|
||||
#include <time.h>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user