Commit | Line | Data |
---|---|---|
dd56fdf2 | 1 | #ifndef _ASM_POWERPC_TIMEX_H |
2 | #define _ASM_POWERPC_TIMEX_H | |
3 | ||
4 | #ifdef __KERNEL__ | |
5 | ||
1da177e4 | 6 | /* |
dd56fdf2 | 7 | * PowerPC architecture timex specifications |
1da177e4 | 8 | */ |
1da177e4 | 9 | |
1da177e4 LT |
10 | #include <asm/cputable.h> |
11 | ||
cbd27b8c | 12 | #define CLOCK_TICK_RATE 1024000 /* Underlying HZ */ |
1da177e4 LT |
13 | |
14 | typedef unsigned long cycles_t; | |
15 | ||
1da177e4 LT |
16 | static inline cycles_t get_cycles(void) |
17 | { | |
dd56fdf2 | 18 | cycles_t ret; |
19 | ||
20 | #ifdef __powerpc64__ | |
21 | ||
22 | __asm__ __volatile__("mftb %0" : "=r" (ret) : ); | |
23 | ||
24 | #else | |
25 | /* | |
26 | * For the "cycle" counter we use the timebase lower half. | |
27 | * Currently only used on SMP. | |
28 | */ | |
29 | ||
30 | ret = 0; | |
1da177e4 LT |
31 | |
32 | __asm__ __volatile__( | |
33 | "98: mftb %0\n" | |
34 | "99:\n" | |
35 | ".section __ftr_fixup,\"a\"\n" | |
36 | " .long %1\n" | |
37 | " .long 0\n" | |
38 | " .long 98b\n" | |
39 | " .long 99b\n" | |
40 | ".previous" | |
41 | : "=r" (ret) : "i" (CPU_FTR_601)); | |
dd56fdf2 | 42 | #endif |
43 | ||
1da177e4 LT |
44 | return ret; |
45 | } | |
46 | ||
dd56fdf2 | 47 | #endif /* __KERNEL__ */ |
48 | #endif /* _ASM_POWERPC_TIMEX_H */ |