2 * tick internal variable and functions used by low/high res code
4 DECLARE_PER_CPU(struct tick_device
, tick_cpu_device
);
5 extern spinlock_t tick_device_lock
;
6 extern ktime_t tick_next_period
;
7 extern ktime_t tick_period
;
8 extern int tick_do_timer_cpu __read_mostly
;
10 extern void tick_setup_periodic(struct clock_event_device
*dev
, int broadcast
);
11 extern void tick_handle_periodic(struct clock_event_device
*dev
);
13 extern void clockevents_shutdown(struct clock_event_device
*dev
);
16 * NO_HZ / high resolution timer shared code
18 #ifdef CONFIG_TICK_ONESHOT
19 extern void tick_setup_oneshot(struct clock_event_device
*newdev
,
20 void (*handler
)(struct clock_event_device
*),
22 extern int tick_dev_program_event(struct clock_event_device
*dev
,
23 ktime_t expires
, int force
);
24 extern int tick_program_event(ktime_t expires
, int force
);
25 extern void tick_oneshot_notify(void);
26 extern int tick_switch_to_oneshot(void (*handler
)(struct clock_event_device
*));
27 extern void tick_resume_oneshot(void);
28 # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
29 extern void tick_broadcast_setup_oneshot(struct clock_event_device
*bc
);
30 extern void tick_broadcast_oneshot_control(unsigned long reason
);
31 extern void tick_broadcast_switch_to_oneshot(void);
32 extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup
);
33 extern int tick_resume_broadcast_oneshot(struct clock_event_device
*bc
);
34 # else /* BROADCAST */
35 static inline void tick_broadcast_setup_oneshot(struct clock_event_device
*bc
)
39 static inline void tick_broadcast_oneshot_control(unsigned long reason
) { }
40 static inline void tick_broadcast_switch_to_oneshot(void) { }
41 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup
) { }
42 # endif /* !BROADCAST */
46 void tick_setup_oneshot(struct clock_event_device
*newdev
,
47 void (*handler
)(struct clock_event_device
*),
52 static inline void tick_resume_oneshot(void)
56 static inline int tick_program_event(ktime_t expires
, int force
)
60 static inline void tick_oneshot_notify(void) { }
61 static inline void tick_broadcast_setup_oneshot(struct clock_event_device
*bc
)
65 static inline void tick_broadcast_oneshot_control(unsigned long reason
) { }
66 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup
) { }
67 static inline int tick_resume_broadcast_oneshot(struct clock_event_device
*bc
)
71 #endif /* !TICK_ONESHOT */
74 * Broadcasting support
76 #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
77 extern int tick_device_uses_broadcast(struct clock_event_device
*dev
, int cpu
);
78 extern int tick_check_broadcast_device(struct clock_event_device
*dev
);
79 extern int tick_is_broadcast_device(struct clock_event_device
*dev
);
80 extern void tick_broadcast_on_off(unsigned long reason
, int *oncpu
);
81 extern void tick_shutdown_broadcast(unsigned int *cpup
);
82 extern void tick_suspend_broadcast(void);
83 extern int tick_resume_broadcast(void);
86 tick_set_periodic_handler(struct clock_event_device
*dev
, int broadcast
);
88 #else /* !BROADCAST */
90 static inline int tick_check_broadcast_device(struct clock_event_device
*dev
)
95 static inline int tick_is_broadcast_device(struct clock_event_device
*dev
)
99 static inline int tick_device_uses_broadcast(struct clock_event_device
*dev
,
104 static inline void tick_do_periodic_broadcast(struct clock_event_device
*d
) { }
105 static inline void tick_broadcast_on_off(unsigned long reason
, int *oncpu
) { }
106 static inline void tick_shutdown_broadcast(unsigned int *cpup
) { }
107 static inline void tick_suspend_broadcast(void) { }
108 static inline int tick_resume_broadcast(void) { return 0; }
111 * Set the periodic handler in non broadcast mode
113 static inline void tick_set_periodic_handler(struct clock_event_device
*dev
,
116 dev
->event_handler
= tick_handle_periodic
;
118 #endif /* !BROADCAST */
121 * Check, if the device is functional or a dummy for broadcast
123 static inline int tick_device_is_functional(struct clock_event_device
*dev
)
125 return !(dev
->features
& CLOCK_EVT_FEAT_DUMMY
);