]>
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 | 10 | #include <asm/cputable.h> |
859deea9 | 11 | #include <asm/reg.h> |
1da177e4 | 12 | |
cbd27b8c | 13 | #define CLOCK_TICK_RATE 1024000 /* Underlying HZ */ |
1da177e4 LT |
14 | |
15 | typedef unsigned long cycles_t; | |
16 | ||
1da177e4 LT |
17 | static inline cycles_t get_cycles(void) |
18 | { | |
dd56fdf2 | 19 | #ifdef __powerpc64__ |
859deea9 | 20 | return mftb(); |
dd56fdf2 | 21 | #else |
859deea9 BH |
22 | cycles_t ret; |
23 | ||
dd56fdf2 | 24 | /* |
25 | * For the "cycle" counter we use the timebase lower half. | |
26 | * Currently only used on SMP. | |
27 | */ | |
28 | ||
29 | ret = 0; | |
1da177e4 LT |
30 | |
31 | __asm__ __volatile__( | |
0909c8c2 | 32 | "97: mftb %0\n" |
1da177e4 LT |
33 | "99:\n" |
34 | ".section __ftr_fixup,\"a\"\n" | |
0909c8c2 BH |
35 | ".align 2\n" |
36 | "98:\n" | |
1da177e4 LT |
37 | " .long %1\n" |
38 | " .long 0\n" | |
0909c8c2 BH |
39 | " .long 97b-98b\n" |
40 | " .long 99b-98b\n" | |
fac23fe4 ME |
41 | " .long 0\n" |
42 | " .long 0\n" | |
1da177e4 LT |
43 | ".previous" |
44 | : "=r" (ret) : "i" (CPU_FTR_601)); | |
45 | return ret; | |
859deea9 | 46 | #endif |
1da177e4 LT |
47 | } |
48 | ||
dd56fdf2 | 49 | #endif /* __KERNEL__ */ |
50 | #endif /* _ASM_POWERPC_TIMEX_H */ |