timex.h 823 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #include <asm/reg.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. #ifdef __powerpc64__
  14. return mftb();
  15. #else
  16. cycles_t ret;
  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. "97: mftb %0\n"
  24. "99:\n"
  25. ".section __ftr_fixup,\"a\"\n"
  26. ".align 2\n"
  27. "98:\n"
  28. " .long %1\n"
  29. " .long 0\n"
  30. " .long 97b-98b\n"
  31. " .long 99b-98b\n"
  32. " .long 0\n"
  33. " .long 0\n"
  34. ".previous"
  35. : "=r" (ret) : "i" (CPU_FTR_601));
  36. return ret;
  37. #endif
  38. }
  39. #endif /* __KERNEL__ */
  40. #endif /* _ASM_POWERPC_TIMEX_H */