Thomas Gleixner | f8381cb | 2007-02-16 01:28:02 -0800 | [diff] [blame] | 1 | /* |
| 2 | * tick internal variable and functions used by low/high res code |
| 3 | */ |
| 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 | |
| 9 | extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast); |
| 10 | extern void tick_handle_periodic(struct clock_event_device *dev); |
| 11 | |
| 12 | /* |
Thomas Gleixner | 79bf2bb | 2007-02-16 01:28:03 -0800 | [diff] [blame^] | 13 | * NO_HZ / high resolution timer shared code |
| 14 | */ |
| 15 | #ifdef CONFIG_TICK_ONESHOT |
| 16 | extern void tick_setup_oneshot(struct clock_event_device *newdev, |
| 17 | void (*handler)(struct clock_event_device *), |
| 18 | ktime_t nextevt); |
| 19 | extern int tick_program_event(ktime_t expires, int force); |
| 20 | extern void tick_oneshot_notify(void); |
| 21 | extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); |
| 22 | |
| 23 | # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST |
| 24 | extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); |
| 25 | extern void tick_broadcast_oneshot_control(unsigned long reason); |
| 26 | extern void tick_broadcast_switch_to_oneshot(void); |
| 27 | extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); |
| 28 | # else /* BROADCAST */ |
| 29 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) |
| 30 | { |
| 31 | BUG(); |
| 32 | } |
| 33 | static inline void tick_broadcast_oneshot_control(unsigned long reason) { } |
| 34 | static inline void tick_broadcast_switch_to_oneshot(void) { } |
| 35 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } |
| 36 | # endif /* !BROADCAST */ |
| 37 | |
| 38 | #else /* !ONESHOT */ |
| 39 | static inline |
| 40 | void tick_setup_oneshot(struct clock_event_device *newdev, |
| 41 | void (*handler)(struct clock_event_device *), |
| 42 | ktime_t nextevt) |
| 43 | { |
| 44 | BUG(); |
| 45 | } |
| 46 | static inline int tick_program_event(ktime_t expires, int force) |
| 47 | { |
| 48 | return 0; |
| 49 | } |
| 50 | static inline void tick_oneshot_notify(void) { } |
| 51 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) |
| 52 | { |
| 53 | BUG(); |
| 54 | } |
| 55 | static inline void tick_broadcast_oneshot_control(unsigned long reason) { } |
| 56 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } |
| 57 | #endif /* !TICK_ONESHOT */ |
| 58 | |
| 59 | /* |
Thomas Gleixner | f8381cb | 2007-02-16 01:28:02 -0800 | [diff] [blame] | 60 | * Broadcasting support |
| 61 | */ |
| 62 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST |
| 63 | extern int tick_do_broadcast(cpumask_t mask); |
Thomas Gleixner | f8381cb | 2007-02-16 01:28:02 -0800 | [diff] [blame] | 64 | |
| 65 | extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu); |
| 66 | extern int tick_check_broadcast_device(struct clock_event_device *dev); |
| 67 | extern int tick_is_broadcast_device(struct clock_event_device *dev); |
| 68 | extern void tick_broadcast_on_off(unsigned long reason, int *oncpu); |
| 69 | extern void tick_shutdown_broadcast(unsigned int *cpup); |
| 70 | |
| 71 | extern void |
| 72 | tick_set_periodic_handler(struct clock_event_device *dev, int broadcast); |
| 73 | |
| 74 | #else /* !BROADCAST */ |
| 75 | |
| 76 | static inline int tick_check_broadcast_device(struct clock_event_device *dev) |
| 77 | { |
| 78 | return 0; |
| 79 | } |
| 80 | |
| 81 | static inline int tick_is_broadcast_device(struct clock_event_device *dev) |
| 82 | { |
| 83 | return 0; |
| 84 | } |
| 85 | static inline int tick_device_uses_broadcast(struct clock_event_device *dev, |
| 86 | int cpu) |
| 87 | { |
| 88 | return 0; |
| 89 | } |
| 90 | static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { } |
| 91 | static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { } |
| 92 | static inline void tick_shutdown_broadcast(unsigned int *cpup) { } |
| 93 | |
| 94 | /* |
| 95 | * Set the periodic handler in non broadcast mode |
| 96 | */ |
| 97 | static inline void tick_set_periodic_handler(struct clock_event_device *dev, |
| 98 | int broadcast) |
| 99 | { |
| 100 | dev->event_handler = tick_handle_periodic; |
| 101 | } |
| 102 | #endif /* !BROADCAST */ |
| 103 | |
| 104 | /* |
| 105 | * Check, if the device is functional or a dummy for broadcast |
| 106 | */ |
| 107 | static inline int tick_device_is_functional(struct clock_event_device *dev) |
| 108 | { |
| 109 | return !(dev->features & CLOCK_EVT_FEAT_DUMMY); |
| 110 | } |