2 * tick internal variable and functions used by low/high res code
5 #define TICK_DO_TIMER_NONE -1
6 #define TICK_DO_TIMER_BOOT -2
8 DECLARE_PER_CPU(struct tick_device
, tick_cpu_device
);
9 extern spinlock_t tick_device_lock
;
10 extern ktime_t tick_next_period
;
11 extern ktime_t tick_period
;
12 extern int tick_do_timer_cpu __read_mostly
;
14 extern void tick_setup_periodic(struct clock_event_device
*dev
, int broadcast
);
15 extern void tick_handle_periodic(struct clock_event_device
*dev
);
17 extern void clockevents_shutdown(struct clock_event_device
*dev
);
20 * NO_HZ / high resolution timer shared code
22 #ifdef CONFIG_TICK_ONESHOT
23 extern void tick_setup_oneshot(struct clock_event_device
*newdev
,
24 void (*handler
)(struct clock_event_device
*),
26 extern int tick_dev_program_event(struct clock_event_device
*dev
,
27 ktime_t expires
, int force
);
28 extern int tick_program_event(ktime_t expires
, int force
);
29 extern void tick_oneshot_notify(void);
30 extern int tick_switch_to_oneshot(void (*handler
)(struct clock_event_device
*));
31 extern void tick_resume_oneshot(void);
32 # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
33 extern void tick_broadcast_setup_oneshot(struct clock_event_device
*bc
);
34 extern void tick_broadcast_oneshot_control(unsigned long reason
);
35 extern void tick_broadcast_switch_to_oneshot(void);
36 extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup
);
37 extern int tick_resume_broadcast_oneshot(struct clock_event_device
*bc
);
38 extern int tick_broadcast_oneshot_active(void);
39 extern void tick_check_oneshot_broadcast(int cpu
);
40 bool tick_broadcast_oneshot_available(void);
41 # else /* BROADCAST */
42 static inline void tick_broadcast_setup_oneshot(struct clock_event_device
*bc
)
46 static inline void tick_broadcast_oneshot_control(unsigned long reason
) { }
47 static inline void tick_broadcast_switch_to_oneshot(void) { }
48 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup
) { }
49 static inline int tick_broadcast_oneshot_active(void) { return 0; }
50 static inline void tick_check_oneshot_broadcast(int cpu
) { }
51 static inline bool tick_broadcast_oneshot_available(void) { return true; }
52 # endif /* !BROADCAST */
56 void tick_setup_oneshot(struct clock_event_device
*newdev
,
57 void (*handler
)(struct clock_event_device
*),
62 static inline void tick_resume_oneshot(void)
66 static inline int tick_program_event(ktime_t expires
, int force
)
70 static inline void tick_oneshot_notify(void) { }
71 static inline void tick_broadcast_setup_oneshot(struct clock_event_device
*bc
)
75 static inline void tick_broadcast_oneshot_control(unsigned long reason
) { }
76 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup
) { }
77 static inline int tick_resume_broadcast_oneshot(struct clock_event_device
*bc
)
81 static inline int tick_broadcast_oneshot_active(void) { return 0; }
82 static inline bool tick_broadcast_oneshot_available(void) { return false; }
83 #endif /* !TICK_ONESHOT */
86 * Broadcasting support
88 #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
89 extern int tick_device_uses_broadcast(struct clock_event_device
*dev
, int cpu
);
90 extern int tick_check_broadcast_device(struct clock_event_device
*dev
);
91 extern int tick_is_broadcast_device(struct clock_event_device
*dev
);
92 extern void tick_broadcast_on_off(unsigned long reason
, int *oncpu
);
93 extern void tick_shutdown_broadcast(unsigned int *cpup
);
94 extern void tick_suspend_broadcast(void);
95 extern int tick_resume_broadcast(void);
98 tick_set_periodic_handler(struct clock_event_device
*dev
, int broadcast
);
100 #else /* !BROADCAST */
102 static inline int tick_check_broadcast_device(struct clock_event_device
*dev
)
107 static inline int tick_is_broadcast_device(struct clock_event_device
*dev
)
111 static inline int tick_device_uses_broadcast(struct clock_event_device
*dev
,
116 static inline void tick_do_periodic_broadcast(struct clock_event_device
*d
) { }
117 static inline void tick_broadcast_on_off(unsigned long reason
, int *oncpu
) { }
118 static inline void tick_shutdown_broadcast(unsigned int *cpup
) { }
119 static inline void tick_suspend_broadcast(void) { }
120 static inline int tick_resume_broadcast(void) { return 0; }
123 * Set the periodic handler in non broadcast mode
125 static inline void tick_set_periodic_handler(struct clock_event_device
*dev
,
128 dev
->event_handler
= tick_handle_periodic
;
130 #endif /* !BROADCAST */
133 * Check, if the device is functional or a dummy for broadcast
135 static inline int tick_device_is_functional(struct clock_event_device
*dev
)
137 return !(dev
->features
& CLOCK_EVT_FEAT_DUMMY
);