diff options
| author | Richard Henderson <rth@twiddle.net> | 2013-07-14 17:50:21 -0400 |
|---|---|---|
| committer | Matt Turner <mattst88@gmail.com> | 2013-11-16 19:33:21 -0500 |
| commit | 4914d7b458e35a7db2f9c7dc6eb014620254bbbf (patch) | |
| tree | 07bc9c2eedb174f0710dddca3950dcb12789236c /arch/alpha/include/asm | |
| parent | a1659d6d128a7e0c2985bce7c957b66af1f71181 (diff) | |
alpha: Use qemu+cserve provided high-res clock and alarm.
QEMU provides a high-resolution timer and alarm; use this for
a clock source and clock event source when available.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'arch/alpha/include/asm')
| -rw-r--r-- | arch/alpha/include/asm/pal.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/arch/alpha/include/asm/pal.h b/arch/alpha/include/asm/pal.h index e78ec9bcc768..5422a47646fc 100644 --- a/arch/alpha/include/asm/pal.h +++ b/arch/alpha/include/asm/pal.h | |||
| @@ -112,5 +112,75 @@ __CALL_PAL_RW1(wtint, unsigned long, unsigned long); | |||
| 112 | #define tbiap() __tbi(-1, /* no second argument */) | 112 | #define tbiap() __tbi(-1, /* no second argument */) |
| 113 | #define tbia() __tbi(-2, /* no second argument */) | 113 | #define tbia() __tbi(-2, /* no second argument */) |
| 114 | 114 | ||
| 115 | /* | ||
| 116 | * QEMU Cserv routines.. | ||
| 117 | */ | ||
| 118 | |||
| 119 | static inline unsigned long | ||
| 120 | qemu_get_walltime(void) | ||
| 121 | { | ||
| 122 | register unsigned long v0 __asm__("$0"); | ||
| 123 | register unsigned long a0 __asm__("$16") = 3; | ||
| 124 | |||
| 125 | asm("call_pal %2 # cserve get_time" | ||
| 126 | : "=r"(v0), "+r"(a0) | ||
| 127 | : "i"(PAL_cserve) | ||
| 128 | : "$17", "$18", "$19", "$20", "$21"); | ||
| 129 | |||
| 130 | return v0; | ||
| 131 | } | ||
| 132 | |||
| 133 | static inline unsigned long | ||
| 134 | qemu_get_alarm(void) | ||
| 135 | { | ||
| 136 | register unsigned long v0 __asm__("$0"); | ||
| 137 | register unsigned long a0 __asm__("$16") = 4; | ||
| 138 | |||
| 139 | asm("call_pal %2 # cserve get_alarm" | ||
| 140 | : "=r"(v0), "+r"(a0) | ||
| 141 | : "i"(PAL_cserve) | ||
| 142 | : "$17", "$18", "$19", "$20", "$21"); | ||
| 143 | |||
| 144 | return v0; | ||
| 145 | } | ||
| 146 | |||
| 147 | static inline void | ||
| 148 | qemu_set_alarm_rel(unsigned long expire) | ||
| 149 | { | ||
| 150 | register unsigned long a0 __asm__("$16") = 5; | ||
| 151 | register unsigned long a1 __asm__("$17") = expire; | ||
| 152 | |||
| 153 | asm volatile("call_pal %2 # cserve set_alarm_rel" | ||
| 154 | : "+r"(a0), "+r"(a1) | ||
| 155 | : "i"(PAL_cserve) | ||
| 156 | : "$0", "$18", "$19", "$20", "$21"); | ||
| 157 | } | ||
| 158 | |||
| 159 | static inline void | ||
| 160 | qemu_set_alarm_abs(unsigned long expire) | ||
| 161 | { | ||
| 162 | register unsigned long a0 __asm__("$16") = 6; | ||
| 163 | register unsigned long a1 __asm__("$17") = expire; | ||
| 164 | |||
| 165 | asm volatile("call_pal %2 # cserve set_alarm_abs" | ||
| 166 | : "+r"(a0), "+r"(a1) | ||
| 167 | : "i"(PAL_cserve) | ||
| 168 | : "$0", "$18", "$19", "$20", "$21"); | ||
| 169 | } | ||
| 170 | |||
| 171 | static inline unsigned long | ||
| 172 | qemu_get_vmtime(void) | ||
| 173 | { | ||
| 174 | register unsigned long v0 __asm__("$0"); | ||
| 175 | register unsigned long a0 __asm__("$16") = 7; | ||
| 176 | |||
| 177 | asm("call_pal %2 # cserve get_time" | ||
| 178 | : "=r"(v0), "+r"(a0) | ||
| 179 | : "i"(PAL_cserve) | ||
| 180 | : "$17", "$18", "$19", "$20", "$21"); | ||
| 181 | |||
| 182 | return v0; | ||
| 183 | } | ||
| 184 | |||
| 115 | #endif /* !__ASSEMBLY__ */ | 185 | #endif /* !__ASSEMBLY__ */ |
| 116 | #endif /* __ALPHA_PAL_H */ | 186 | #endif /* __ALPHA_PAL_H */ |
