]>
Commit | Line | Data |
---|---|---|
f8381cba TG |
1 | /* |
2 | * tick internal variable and functions used by low/high res code | |
3 | */ | |
e2830b5c TH |
4 | #include <linux/hrtimer.h> |
5 | #include <linux/tick.h> | |
6441402b | 6 | |
eb93e4d9 TG |
7 | extern seqlock_t jiffies_lock; |
8 | ||
7cf37e87 | 9 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD |
6441402b TG |
10 | |
11 | #define TICK_DO_TIMER_NONE -1 | |
12 | #define TICK_DO_TIMER_BOOT -2 | |
13 | ||
f8381cba | 14 | DECLARE_PER_CPU(struct tick_device, tick_cpu_device); |
f8381cba TG |
15 | extern ktime_t tick_next_period; |
16 | extern ktime_t tick_period; | |
d3ed7824 | 17 | extern int tick_do_timer_cpu __read_mostly; |
f8381cba TG |
18 | |
19 | extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast); | |
20 | extern void tick_handle_periodic(struct clock_event_device *dev); | |
7172a286 | 21 | extern void tick_check_new_device(struct clock_event_device *dev); |
8c53daf6 TG |
22 | extern void tick_handover_do_timer(int *cpup); |
23 | extern void tick_shutdown(unsigned int *cpup); | |
24 | extern void tick_suspend(void); | |
25 | extern void tick_resume(void); | |
f8381cba | 26 | |
2344abbc TG |
27 | extern void clockevents_shutdown(struct clock_event_device *dev); |
28 | ||
79bf2bb3 TG |
29 | /* |
30 | * NO_HZ / high resolution timer shared code | |
31 | */ | |
32 | #ifdef CONFIG_TICK_ONESHOT | |
33 | extern void tick_setup_oneshot(struct clock_event_device *newdev, | |
34 | void (*handler)(struct clock_event_device *), | |
35 | ktime_t nextevt); | |
36 | extern int tick_program_event(ktime_t expires, int force); | |
37 | extern void tick_oneshot_notify(void); | |
38 | extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); | |
cd05a1f8 | 39 | extern void tick_resume_oneshot(void); |
79bf2bb3 TG |
40 | # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST |
41 | extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); | |
42 | extern void tick_broadcast_oneshot_control(unsigned long reason); | |
43 | extern void tick_broadcast_switch_to_oneshot(void); | |
44 | extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); | |
cd05a1f8 | 45 | extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); |
27ce4cb4 | 46 | extern int tick_broadcast_oneshot_active(void); |
fb02fbc1 | 47 | extern void tick_check_oneshot_broadcast(int cpu); |
3a142a06 | 48 | bool tick_broadcast_oneshot_available(void); |
79bf2bb3 TG |
49 | # else /* BROADCAST */ |
50 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | |
51 | { | |
52 | BUG(); | |
53 | } | |
54 | static inline void tick_broadcast_oneshot_control(unsigned long reason) { } | |
55 | static inline void tick_broadcast_switch_to_oneshot(void) { } | |
56 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } | |
27ce4cb4 | 57 | static inline int tick_broadcast_oneshot_active(void) { return 0; } |
fb02fbc1 | 58 | static inline void tick_check_oneshot_broadcast(int cpu) { } |
3a142a06 | 59 | static inline bool tick_broadcast_oneshot_available(void) { return true; } |
79bf2bb3 TG |
60 | # endif /* !BROADCAST */ |
61 | ||
62 | #else /* !ONESHOT */ | |
63 | static inline | |
64 | void tick_setup_oneshot(struct clock_event_device *newdev, | |
65 | void (*handler)(struct clock_event_device *), | |
66 | ktime_t nextevt) | |
67 | { | |
68 | BUG(); | |
69 | } | |
cd05a1f8 TG |
70 | static inline void tick_resume_oneshot(void) |
71 | { | |
72 | BUG(); | |
73 | } | |
79bf2bb3 TG |
74 | static inline int tick_program_event(ktime_t expires, int force) |
75 | { | |
76 | return 0; | |
77 | } | |
78 | static inline void tick_oneshot_notify(void) { } | |
79 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | |
80 | { | |
81 | BUG(); | |
82 | } | |
83 | static inline void tick_broadcast_oneshot_control(unsigned long reason) { } | |
84 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } | |
cd05a1f8 TG |
85 | static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) |
86 | { | |
87 | return 0; | |
88 | } | |
f8e256c6 | 89 | static inline int tick_broadcast_oneshot_active(void) { return 0; } |
3a142a06 | 90 | static inline bool tick_broadcast_oneshot_available(void) { return false; } |
79bf2bb3 TG |
91 | #endif /* !TICK_ONESHOT */ |
92 | ||
f8381cba TG |
93 | /* |
94 | * Broadcasting support | |
95 | */ | |
96 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | |
f8381cba | 97 | extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu); |
7172a286 | 98 | extern void tick_install_broadcast_device(struct clock_event_device *dev); |
f8381cba TG |
99 | extern int tick_is_broadcast_device(struct clock_event_device *dev); |
100 | extern void tick_broadcast_on_off(unsigned long reason, int *oncpu); | |
101 | extern void tick_shutdown_broadcast(unsigned int *cpup); | |
6321dd60 TG |
102 | extern void tick_suspend_broadcast(void); |
103 | extern int tick_resume_broadcast(void); | |
b352bc1c | 104 | extern void tick_broadcast_init(void); |
f8381cba TG |
105 | extern void |
106 | tick_set_periodic_handler(struct clock_event_device *dev, int broadcast); | |
107 | ||
108 | #else /* !BROADCAST */ | |
109 | ||
7172a286 | 110 | static inline void tick_install_broadcast_device(struct clock_event_device *dev) |
f8381cba | 111 | { |
f8381cba TG |
112 | } |
113 | ||
114 | static inline int tick_is_broadcast_device(struct clock_event_device *dev) | |
115 | { | |
116 | return 0; | |
117 | } | |
118 | static inline int tick_device_uses_broadcast(struct clock_event_device *dev, | |
119 | int cpu) | |
120 | { | |
121 | return 0; | |
122 | } | |
123 | static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { } | |
124 | static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { } | |
125 | static inline void tick_shutdown_broadcast(unsigned int *cpup) { } | |
6321dd60 TG |
126 | static inline void tick_suspend_broadcast(void) { } |
127 | static inline int tick_resume_broadcast(void) { return 0; } | |
b352bc1c | 128 | static inline void tick_broadcast_init(void) { } |
f8381cba TG |
129 | |
130 | /* | |
131 | * Set the periodic handler in non broadcast mode | |
132 | */ | |
133 | static inline void tick_set_periodic_handler(struct clock_event_device *dev, | |
134 | int broadcast) | |
135 | { | |
136 | dev->event_handler = tick_handle_periodic; | |
137 | } | |
138 | #endif /* !BROADCAST */ | |
139 | ||
140 | /* | |
141 | * Check, if the device is functional or a dummy for broadcast | |
142 | */ | |
143 | static inline int tick_device_is_functional(struct clock_event_device *dev) | |
144 | { | |
145 | return !(dev->features & CLOCK_EVT_FEAT_DUMMY); | |
146 | } | |
e2830b5c | 147 | |
7cf37e87 TG |
148 | #endif |
149 | ||
e2830b5c | 150 | extern void do_timer(unsigned long ticks); |