From 846693813977e7301e8d54540e0b866100249dea Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 4 Sep 2002 19:32:18 +0000 Subject: [PATCH] Do not employ timecounter hardware if our hz does not support their correct rewinding. --- sys/kern/kern_tc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index d3d437d441d1..42c713486507 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -278,11 +278,19 @@ getmicrotime(struct timeval *tvp) void tc_init(struct timecounter *tc) { + unsigned u; + printf("Timecounter \"%s\" frequency %lu Hz", + tc->tc_name, (u_long)tc->tc_frequency); + + u = tc->tc_frequency / tc->tc_counter_mask; + if (u > hz) { + printf(" -- Insufficient hz, needs at least %u\n", u); + return; + } tc->tc_next = timecounters; timecounters = tc; - printf("Timecounter \"%s\" frequency %lu Hz\n", - tc->tc_name, (u_long)tc->tc_frequency); + printf("\n"); (void)tc->tc_get_timecount(tc); (void)tc->tc_get_timecount(tc); timecounter = tc;