| 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 *)); | 
| Thomas Gleixner | cd05a1f | 2007-03-17 00:25:52 +0100 | [diff] [blame] | 22 | extern void tick_resume_oneshot(void); | 
| Thomas Gleixner | 79bf2bb | 2007-02-16 01:28:03 -0800 | [diff] [blame] | 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); | 
| Thomas Gleixner | cd05a1f | 2007-03-17 00:25:52 +0100 | [diff] [blame] | 28 | extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); | 
| Thomas Gleixner | 79bf2bb | 2007-02-16 01:28:03 -0800 | [diff] [blame] | 29 | # else /* BROADCAST */ | 
|  | 30 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | 
|  | 31 | { | 
|  | 32 | BUG(); | 
|  | 33 | } | 
|  | 34 | static inline void tick_broadcast_oneshot_control(unsigned long reason) { } | 
|  | 35 | static inline void tick_broadcast_switch_to_oneshot(void) { } | 
|  | 36 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } | 
|  | 37 | # endif /* !BROADCAST */ | 
|  | 38 |  | 
|  | 39 | #else /* !ONESHOT */ | 
|  | 40 | static inline | 
|  | 41 | void tick_setup_oneshot(struct clock_event_device *newdev, | 
|  | 42 | void (*handler)(struct clock_event_device *), | 
|  | 43 | ktime_t nextevt) | 
|  | 44 | { | 
|  | 45 | BUG(); | 
|  | 46 | } | 
| Thomas Gleixner | cd05a1f | 2007-03-17 00:25:52 +0100 | [diff] [blame] | 47 | static inline void tick_resume_oneshot(void) | 
|  | 48 | { | 
|  | 49 | BUG(); | 
|  | 50 | } | 
| Thomas Gleixner | 79bf2bb | 2007-02-16 01:28:03 -0800 | [diff] [blame] | 51 | static inline int tick_program_event(ktime_t expires, int force) | 
|  | 52 | { | 
|  | 53 | return 0; | 
|  | 54 | } | 
|  | 55 | static inline void tick_oneshot_notify(void) { } | 
|  | 56 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | 
|  | 57 | { | 
|  | 58 | BUG(); | 
|  | 59 | } | 
|  | 60 | static inline void tick_broadcast_oneshot_control(unsigned long reason) { } | 
|  | 61 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } | 
| Thomas Gleixner | cd05a1f | 2007-03-17 00:25:52 +0100 | [diff] [blame] | 62 | static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) | 
|  | 63 | { | 
|  | 64 | return 0; | 
|  | 65 | } | 
| Thomas Gleixner | 79bf2bb | 2007-02-16 01:28:03 -0800 | [diff] [blame] | 66 | #endif /* !TICK_ONESHOT */ | 
|  | 67 |  | 
|  | 68 | /* | 
| Thomas Gleixner | f8381cb | 2007-02-16 01:28:02 -0800 | [diff] [blame] | 69 | * Broadcasting support | 
|  | 70 | */ | 
|  | 71 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | 
|  | 72 | extern int tick_do_broadcast(cpumask_t mask); | 
| Thomas Gleixner | f8381cb | 2007-02-16 01:28:02 -0800 | [diff] [blame] | 73 |  | 
|  | 74 | extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu); | 
|  | 75 | extern int tick_check_broadcast_device(struct clock_event_device *dev); | 
|  | 76 | extern int tick_is_broadcast_device(struct clock_event_device *dev); | 
|  | 77 | extern void tick_broadcast_on_off(unsigned long reason, int *oncpu); | 
|  | 78 | extern void tick_shutdown_broadcast(unsigned int *cpup); | 
| Thomas Gleixner | 6321dd6 | 2007-03-06 08:25:42 +0100 | [diff] [blame] | 79 | extern void tick_suspend_broadcast(void); | 
|  | 80 | extern int tick_resume_broadcast(void); | 
| Thomas Gleixner | f8381cb | 2007-02-16 01:28:02 -0800 | [diff] [blame] | 81 |  | 
|  | 82 | extern void | 
|  | 83 | tick_set_periodic_handler(struct clock_event_device *dev, int broadcast); | 
|  | 84 |  | 
|  | 85 | #else /* !BROADCAST */ | 
|  | 86 |  | 
|  | 87 | static inline int tick_check_broadcast_device(struct clock_event_device *dev) | 
|  | 88 | { | 
|  | 89 | return 0; | 
|  | 90 | } | 
|  | 91 |  | 
|  | 92 | static inline int tick_is_broadcast_device(struct clock_event_device *dev) | 
|  | 93 | { | 
|  | 94 | return 0; | 
|  | 95 | } | 
|  | 96 | static inline int tick_device_uses_broadcast(struct clock_event_device *dev, | 
|  | 97 | int cpu) | 
|  | 98 | { | 
|  | 99 | return 0; | 
|  | 100 | } | 
|  | 101 | static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { } | 
|  | 102 | static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { } | 
|  | 103 | static inline void tick_shutdown_broadcast(unsigned int *cpup) { } | 
| Thomas Gleixner | 6321dd6 | 2007-03-06 08:25:42 +0100 | [diff] [blame] | 104 | static inline void tick_suspend_broadcast(void) { } | 
|  | 105 | static inline int tick_resume_broadcast(void) { return 0; } | 
| Thomas Gleixner | f8381cb | 2007-02-16 01:28:02 -0800 | [diff] [blame] | 106 |  | 
|  | 107 | /* | 
|  | 108 | * Set the periodic handler in non broadcast mode | 
|  | 109 | */ | 
|  | 110 | static inline void tick_set_periodic_handler(struct clock_event_device *dev, | 
|  | 111 | int broadcast) | 
|  | 112 | { | 
|  | 113 | dev->event_handler = tick_handle_periodic; | 
|  | 114 | } | 
|  | 115 | #endif /* !BROADCAST */ | 
|  | 116 |  | 
|  | 117 | /* | 
|  | 118 | * Check, if the device is functional or a dummy for broadcast | 
|  | 119 | */ | 
|  | 120 | static inline int tick_device_is_functional(struct clock_event_device *dev) | 
|  | 121 | { | 
|  | 122 | return !(dev->features & CLOCK_EVT_FEAT_DUMMY); | 
|  | 123 | } |