]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - kernel/time/tick-internal.h
dmaengine: dw: provide DMA capabilities
[mirror_ubuntu-zesty-kernel.git] / kernel / time / tick-internal.h
CommitLineData
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
8b094cd0
TG
7#include "timekeeping.h"
8
eb93e4d9
TG
9extern seqlock_t jiffies_lock;
10
c7e99fc7
TG
11#define CS_NAME_LEN 32
12
7cf37e87 13#ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD
6441402b
TG
14
15#define TICK_DO_TIMER_NONE -1
16#define TICK_DO_TIMER_BOOT -2
17
f8381cba 18DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
f8381cba
TG
19extern ktime_t tick_next_period;
20extern ktime_t tick_period;
d3ed7824 21extern int tick_do_timer_cpu __read_mostly;
f8381cba
TG
22
23extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
24extern void tick_handle_periodic(struct clock_event_device *dev);
7172a286 25extern void tick_check_new_device(struct clock_event_device *dev);
8c53daf6
TG
26extern void tick_handover_do_timer(int *cpup);
27extern void tick_shutdown(unsigned int *cpup);
28extern void tick_suspend(void);
29extern void tick_resume(void);
03e13cf5
TG
30extern bool tick_check_replacement(struct clock_event_device *curdev,
31 struct clock_event_device *newdev);
32extern void tick_install_replacement(struct clock_event_device *dev);
f8381cba 33
2344abbc
TG
34extern void clockevents_shutdown(struct clock_event_device *dev);
35
891292a7 36extern ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt);
03e13cf5 37
79bf2bb3
TG
38/*
39 * NO_HZ / high resolution timer shared code
40 */
41#ifdef CONFIG_TICK_ONESHOT
42extern void tick_setup_oneshot(struct clock_event_device *newdev,
43 void (*handler)(struct clock_event_device *),
44 ktime_t nextevt);
45extern int tick_program_event(ktime_t expires, int force);
46extern void tick_oneshot_notify(void);
47extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
cd05a1f8 48extern void tick_resume_oneshot(void);
79bf2bb3
TG
49# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
50extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
da7e6f45 51extern int tick_broadcast_oneshot_control(unsigned long reason);
79bf2bb3
TG
52extern void tick_broadcast_switch_to_oneshot(void);
53extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
cd05a1f8 54extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
27ce4cb4 55extern int tick_broadcast_oneshot_active(void);
e8fcaa5c 56extern void tick_check_oneshot_broadcast_this_cpu(void);
3a142a06 57bool tick_broadcast_oneshot_available(void);
79bf2bb3
TG
58# else /* BROADCAST */
59static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
60{
61 BUG();
62}
da7e6f45 63static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
79bf2bb3
TG
64static inline void tick_broadcast_switch_to_oneshot(void) { }
65static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
27ce4cb4 66static inline int tick_broadcast_oneshot_active(void) { return 0; }
e8fcaa5c 67static inline void tick_check_oneshot_broadcast_this_cpu(void) { }
3a142a06 68static inline bool tick_broadcast_oneshot_available(void) { return true; }
79bf2bb3
TG
69# endif /* !BROADCAST */
70
71#else /* !ONESHOT */
72static inline
73void tick_setup_oneshot(struct clock_event_device *newdev,
74 void (*handler)(struct clock_event_device *),
75 ktime_t nextevt)
76{
77 BUG();
78}
cd05a1f8
TG
79static inline void tick_resume_oneshot(void)
80{
81 BUG();
82}
79bf2bb3
TG
83static inline int tick_program_event(ktime_t expires, int force)
84{
85 return 0;
86}
87static inline void tick_oneshot_notify(void) { }
88static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
89{
90 BUG();
91}
da7e6f45 92static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
79bf2bb3 93static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
cd05a1f8
TG
94static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
95{
96 return 0;
97}
f8e256c6 98static inline int tick_broadcast_oneshot_active(void) { return 0; }
3a142a06 99static inline bool tick_broadcast_oneshot_available(void) { return false; }
79bf2bb3
TG
100#endif /* !TICK_ONESHOT */
101
a80e49e2
FW
102/* NO_HZ_FULL internal */
103#ifdef CONFIG_NO_HZ_FULL
104extern void tick_nohz_init(void);
105# else
106static inline void tick_nohz_init(void) { }
107#endif
108
f8381cba
TG
109/*
110 * Broadcasting support
111 */
112#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
f8381cba 113extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu);
7172a286 114extern void tick_install_broadcast_device(struct clock_event_device *dev);
f8381cba
TG
115extern int tick_is_broadcast_device(struct clock_event_device *dev);
116extern void tick_broadcast_on_off(unsigned long reason, int *oncpu);
117extern void tick_shutdown_broadcast(unsigned int *cpup);
6321dd60
TG
118extern void tick_suspend_broadcast(void);
119extern int tick_resume_broadcast(void);
b352bc1c 120extern void tick_broadcast_init(void);
f8381cba
TG
121extern void
122tick_set_periodic_handler(struct clock_event_device *dev, int broadcast);
627ee794 123int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq);
f8381cba
TG
124
125#else /* !BROADCAST */
126
7172a286 127static inline void tick_install_broadcast_device(struct clock_event_device *dev)
f8381cba 128{
f8381cba
TG
129}
130
131static inline int tick_is_broadcast_device(struct clock_event_device *dev)
132{
133 return 0;
134}
135static inline int tick_device_uses_broadcast(struct clock_event_device *dev,
136 int cpu)
137{
138 return 0;
139}
140static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { }
141static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { }
142static inline void tick_shutdown_broadcast(unsigned int *cpup) { }
6321dd60
TG
143static inline void tick_suspend_broadcast(void) { }
144static inline int tick_resume_broadcast(void) { return 0; }
b352bc1c 145static inline void tick_broadcast_init(void) { }
627ee794
TG
146static inline int tick_broadcast_update_freq(struct clock_event_device *dev,
147 u32 freq) { return -ENODEV; }
f8381cba
TG
148
149/*
150 * Set the periodic handler in non broadcast mode
151 */
152static inline void tick_set_periodic_handler(struct clock_event_device *dev,
153 int broadcast)
154{
155 dev->event_handler = tick_handle_periodic;
156}
157#endif /* !BROADCAST */
158
159/*
160 * Check, if the device is functional or a dummy for broadcast
161 */
162static inline int tick_device_is_functional(struct clock_event_device *dev)
163{
164 return !(dev->features & CLOCK_EVT_FEAT_DUMMY);
165}
e2830b5c 166
f1689bb7
TG
167int __clockevents_update_freq(struct clock_event_device *dev, u32 freq);
168
7cf37e87
TG
169#endif
170
e2830b5c 171extern void do_timer(unsigned long ticks);
47a1b796 172extern void update_wall_time(void);