diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 1998-03-31 10:44:56 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1998-03-31 10:44:56 +0000 |
| commit | 75da0aa2980182101859b22b99dd79ae0268ba1b (patch) | |
| tree | 23529899735f3b324155d49866dfae15fa4fd2b8 /sys/kern/kern_tc.c | |
| parent | e40c3a225b88c6625c27a013c322be587a2531c6 (diff) | |
Notes
Diffstat (limited to 'sys/kern/kern_tc.c')
| -rw-r--r-- | sys/kern/kern_tc.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 35d95bfbe1a4..4b34e76d2407 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -39,7 +39,7 @@ static volatile int print_tci = 1; * SUCH DAMAGE. * * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 - * $Id: kern_clock.c,v 1.59 1998/03/26 20:51:31 phk Exp $ + * $Id: kern_clock.c,v 1.60 1998/03/30 09:50:00 phk Exp $ */ #include <sys/param.h> @@ -618,9 +618,9 @@ init_timecounter(struct timecounter *tc) ts1.tv_sec -= ts0.tv_sec; tc->cost = ts1.tv_sec * 1000000000 + ts1.tv_nsec - ts0.tv_nsec; tc->cost >>= 8; - if (print_tci) - printf("Timecounter \"%s\" frequency %lu Hz cost %u ns\n", - tc->name, tc->frequency, tc->cost); + if (print_tci && strcmp(tc->name, "dummy")) + printf("Timecounter \"%s\" frequency %lu Hz cost %u ns\n", + tc->name, tc->frequency, tc->cost); /* XXX: For now always start using the counter. */ tc->offset_count = tc->get_timecount(); @@ -750,3 +750,35 @@ SYSCTL_PROC(_kern_timecounter, OID_AUTO, frequency, CTLTYPE_INT | CTLFLAG_RW, SYSCTL_PROC(_kern_timecounter, OID_AUTO, adjustment, CTLTYPE_INT | CTLFLAG_RW, 0, sizeof(int), sysctl_kern_timecounter_adjustment, "I", ""); + +/* + * Implement a dummy timecounter which we can use until we get a real one + * in the air. This allows the console and other early stuff to use + * timeservices. + */ + +static u_int64_t +dummy_get_timecount(void) +{ + static u_int64_t now; + return (++now); +} + +static struct timecounter dummy_timecounter[3] = { + { + 0, + dummy_get_timecount, + ~0, + 100000, + "dummy" + } +}; + +static void +initdummytimecounter(dummy) + void *dummy; +{ + init_timecounter(dummy_timecounter); +} + +SYSINIT(dummytc, SI_SUB_CONSOLE, SI_ORDER_FIRST, initdummytimecounter, NULL) |
