summaryrefslogtreecommitdiffstats
path: root/sys/sys/eventhandler.h
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2007-03-26 18:03:29 +0000
committernjl <njl@FreeBSD.org>2007-03-26 18:03:29 +0000
commit4933ca0aa02fff68e3e30186b454ed25d7d926fb (patch)
tree38a5baa5f3b7261150b7178ed80307e7f2bd65c9 /sys/sys/eventhandler.h
parent3cb53690e0c2c81ed3b336133bf003c7b3173abf (diff)
downloadFreeBSD-src-4933ca0aa02fff68e3e30186b454ed25d7d926fb.zip
FreeBSD-src-4933ca0aa02fff68e3e30186b454ed25d7d926fb.tar.gz
Add an interface for drivers to be notified of changes to CPU frequency.
cpufreq_pre_change is called before the change, giving each driver a chance to revoke the change. cpufreq_post_change provides the results of the change (success or failure). cpufreq_levels_changed gives the unit number of the cpufreq device whose number of available levels has changed. Hook in all the drivers I could find that needed it. * TSC: update TSC frequency value. When the available levels change, take the highest possible level and notify the timecounter set_cputicker() of that freq. This gets rid of the "calcru: runtime went backwards" messages. * identcpu: updates the sysctl hw.clockrate value * Profiling: if profiling is active when the clock changes, let the user know the results may be inaccurate. Reviewed by: bde, phk MFC after: 1 month
Diffstat (limited to 'sys/sys/eventhandler.h')
-rw-r--r--sys/sys/eventhandler.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/sys/eventhandler.h b/sys/sys/eventhandler.h
index f4f1b8c..d18b635 100644
--- a/sys/sys/eventhandler.h
+++ b/sys/sys/eventhandler.h
@@ -104,6 +104,17 @@ struct eventhandler_entry_ ## name \
}; \
struct __hack
+#define EVENTHANDLER_DEFINE(name, func, arg, priority) \
+ static eventhandler_tag name ## _tag; \
+ static void name ## _evh_init(void *ctx) \
+ { \
+ name ## _tag = EVENTHANDLER_REGISTER(name, func, ctx, \
+ priority); \
+ } \
+ SYSINIT(name ## _evh_init, SI_SUB_CONFIGURE, SI_ORDER_ANY, \
+ name ## _evh_init, arg) \
+ struct __hack
+
#define EVENTHANDLER_INVOKE(name, ...) \
do { \
struct eventhandler_list *_el; \
OpenPOWER on IntegriCloud