diff options
Diffstat (limited to 'include/asm-s390/timex.h')
-rw-r--r-- | include/asm-s390/timex.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/include/asm-s390/timex.h b/include/asm-s390/timex.h index 4df4a41029a3..98229db24314 100644 --- a/include/asm-s390/timex.h +++ b/include/asm-s390/timex.h | |||
@@ -11,6 +11,41 @@ | |||
11 | #ifndef _ASM_S390_TIMEX_H | 11 | #ifndef _ASM_S390_TIMEX_H |
12 | #define _ASM_S390_TIMEX_H | 12 | #define _ASM_S390_TIMEX_H |
13 | 13 | ||
14 | /* Inline functions for clock register access. */ | ||
15 | static inline int set_clock(__u64 time) | ||
16 | { | ||
17 | int cc; | ||
18 | |||
19 | asm volatile( | ||
20 | " sck 0(%2)\n" | ||
21 | " ipm %0\n" | ||
22 | " srl %0,28\n" | ||
23 | : "=d" (cc) : "m" (time), "a" (&time) : "cc"); | ||
24 | return cc; | ||
25 | } | ||
26 | |||
27 | static inline int store_clock(__u64 *time) | ||
28 | { | ||
29 | int cc; | ||
30 | |||
31 | asm volatile( | ||
32 | " stck 0(%2)\n" | ||
33 | " ipm %0\n" | ||
34 | " srl %0,28\n" | ||
35 | : "=d" (cc), "=m" (*time) : "a" (time) : "cc"); | ||
36 | return cc; | ||
37 | } | ||
38 | |||
39 | static inline void set_clock_comparator(__u64 time) | ||
40 | { | ||
41 | asm volatile("sckc 0(%1)" : : "m" (time), "a" (&time)); | ||
42 | } | ||
43 | |||
44 | static inline void store_clock_comparator(__u64 *time) | ||
45 | { | ||
46 | asm volatile("stckc 0(%1)" : "=m" (*time) : "a" (time)); | ||
47 | } | ||
48 | |||
14 | #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ | 49 | #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ |
15 | 50 | ||
16 | typedef unsigned long long cycles_t; | 51 | typedef unsigned long long cycles_t; |
@@ -27,9 +62,24 @@ static inline unsigned long long get_clock (void) | |||
27 | return clk; | 62 | return clk; |
28 | } | 63 | } |
29 | 64 | ||
65 | static inline void get_clock_extended(void *dest) | ||
66 | { | ||
67 | typedef struct { unsigned long long clk[2]; } __clock_t; | ||
68 | |||
69 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) | ||
70 | asm volatile("stcke %0" : "=Q" (*((__clock_t *)dest)) : : "cc"); | ||
71 | #else /* __GNUC__ */ | ||
72 | asm volatile("stcke 0(%1)" : "=m" (*((__clock_t *)dest)) | ||
73 | : "a" ((__clock_t *)dest) : "cc"); | ||
74 | #endif /* __GNUC__ */ | ||
75 | } | ||
76 | |||
30 | static inline cycles_t get_cycles(void) | 77 | static inline cycles_t get_cycles(void) |
31 | { | 78 | { |
32 | return (cycles_t) get_clock() >> 2; | 79 | return (cycles_t) get_clock() >> 2; |
33 | } | 80 | } |
34 | 81 | ||
82 | int get_sync_clock(unsigned long long *clock); | ||
83 | void init_cpu_timer(void); | ||
84 | |||
35 | #endif | 85 | #endif |