timex.h 802 B

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