summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_clocksource.c
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-05-17 20:10:12 +0000
committerian <ian@FreeBSD.org>2014-05-17 20:10:12 +0000
commit9f4d42e0d5ac9fd53ce7499b7ba78d5c2f392dcf (patch)
tree66ee73217081a18f0aebac5e3c89d11ff179ea73 /sys/kern/kern_clocksource.c
parentaa723a2c5a49290b58ee56c47638f702d3422410 (diff)
downloadFreeBSD-src-9f4d42e0d5ac9fd53ce7499b7ba78d5c2f392dcf.zip
FreeBSD-src-9f4d42e0d5ac9fd53ce7499b7ba78d5c2f392dcf.tar.gz
MFC 264019, 264041, 264048, 264049, 264050, 264051
Add support for event timers whose clock frequency can change while running. Apparently all ARM configs build kern_et.c, but only a few of them also build kern_clocksource.c, un-break the build by not referencing functions in kern_clocksource if NO_EVENTTIMERS is defined. Add variable-frequency support to the arm mpcore eventtimer driver. mpcore_timer: Disable the timer and clear any pending bit, then setup the new counter register values, then restart the timer. Also re-nest the parens properly for casting the result of converting time and frequency to a count.
Diffstat (limited to 'sys/kern/kern_clocksource.c')
-rw-r--r--sys/kern/kern_clocksource.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c
index 0edb238..c76750f 100644
--- a/sys/kern/kern_clocksource.c
+++ b/sys/kern/kern_clocksource.c
@@ -800,6 +800,25 @@ cpu_activeclock(void)
spinlock_exit();
}
+/*
+ * Change the frequency of the given timer. This changes et->et_frequency and
+ * if et is the active timer it reconfigures the timer on all CPUs. This is
+ * intended to be a private interface for the use of et_change_frequency() only.
+ */
+void
+cpu_et_frequency(struct eventtimer *et, uint64_t newfreq)
+{
+
+ ET_LOCK();
+ if (et == timer) {
+ configtimer(0);
+ et->et_frequency = newfreq;
+ configtimer(1);
+ } else
+ et->et_frequency = newfreq;
+ ET_UNLOCK();
+}
+
#ifdef KDTRACE_HOOKS
void
clocksource_cyc_set(const struct bintime *bt)
OpenPOWER on IntegriCloud