timex.h 776 B

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