diff options
Diffstat (limited to 'sys/sys/timetc.h')
-rw-r--r-- | sys/sys/timetc.h | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/sys/sys/timetc.h b/sys/sys/timetc.h index ce81c34..dccee13 100644 --- a/sys/sys/timetc.h +++ b/sys/sys/timetc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: timetc.h,v 1.10 2019/10/26 21:16:38 cheloha Exp $ */ +/* $OpenBSD: timetc.h,v 1.12 2020/07/06 13:33:09 pirofti Exp $ */ /* * Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org> @@ -24,10 +24,11 @@ #ifndef _SYS_TIMETC_H_ #define _SYS_TIMETC_H_ -#ifndef _KERNEL +#if !defined(_KERNEL) && !defined(_LIBC) #error "no user-serviceable parts inside" #endif +#include <machine/timetc.h> #include <sys/queue.h> /*- @@ -48,8 +49,8 @@ typedef void timecounter_pps_t(struct timecounter *); /* * Locks used to protect struct members in this file: * I immutable after initialization - * t tc_lock - * w windup_mtx + * T tc_lock + * W windup_mtx */ struct timecounter { @@ -80,19 +81,42 @@ struct timecounter { */ void *tc_priv; /* [I] */ /* Pointer to the timecounter's private parts. */ + int tc_user; /* [I] */ + /* Expose this timecounter to userland. */ SLIST_ENTRY(timecounter) tc_next; /* [I] */ /* Pointer to the next timecounter. */ - int64_t tc_freq_adj; /* [tw] */ + int64_t tc_freq_adj; /* [T,W] */ /* Current frequency adjustment. */ u_int64_t tc_precision; /* [I] */ /* Precision of the counter. Computed in tc_init(). */ }; +struct timekeep { + /* set at initialization */ + uint32_t tk_version; /* version number */ + + /* timehands members */ + uint64_t tk_scale; + u_int tk_offset_count; + struct bintime tk_offset; + struct bintime tk_naptime; + struct bintime tk_boottime; + volatile u_int tk_generation; + + /* timecounter members */ + int tk_user; + u_int tk_counter_mask; +}; +#define TK_VERSION 0 + struct rwlock; extern struct rwlock tc_lock; extern struct timecounter *timecounter; +extern struct uvm_object *timekeep_object; +extern struct timekeep *timekeep; + u_int64_t tc_getfrequency(void); u_int64_t tc_getprecision(void); void tc_init(struct timecounter *tc); |