delay.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef _ASM_IA64_DELAY_H
  2. #define _ASM_IA64_DELAY_H
  3. /*
  4. * Delay routines using a pre-computed "cycles/usec" value.
  5. *
  6. * Copyright (C) 1998, 1999 Hewlett-Packard Co
  7. * David Mosberger-Tang <davidm@hpl.hp.com>
  8. * Copyright (C) 1999 VA Linux Systems
  9. * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
  10. * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
  11. * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/sched.h>
  15. #include <linux/compiler.h>
  16. #include <asm/intrinsics.h>
  17. #include <asm/processor.h>
  18. static __inline__ void
  19. ia64_set_itm (unsigned long val)
  20. {
  21. ia64_setreg(_IA64_REG_CR_ITM, val);
  22. ia64_srlz_d();
  23. }
  24. static __inline__ unsigned long
  25. ia64_get_itm (void)
  26. {
  27. unsigned long result;
  28. result = ia64_getreg(_IA64_REG_CR_ITM);
  29. ia64_srlz_d();
  30. return result;
  31. }
  32. static __inline__ void
  33. ia64_set_itv (unsigned long val)
  34. {
  35. ia64_setreg(_IA64_REG_CR_ITV, val);
  36. ia64_srlz_d();
  37. }
  38. static __inline__ unsigned long
  39. ia64_get_itv (void)
  40. {
  41. return ia64_getreg(_IA64_REG_CR_ITV);
  42. }
  43. static __inline__ void
  44. ia64_set_itc (unsigned long val)
  45. {
  46. ia64_setreg(_IA64_REG_AR_ITC, val);
  47. ia64_srlz_d();
  48. }
  49. static __inline__ unsigned long
  50. ia64_get_itc (void)
  51. {
  52. unsigned long result;
  53. result = ia64_getreg(_IA64_REG_AR_ITC);
  54. ia64_barrier();
  55. #ifdef CONFIG_ITANIUM
  56. while (unlikely((__s32) result == -1)) {
  57. result = ia64_getreg(_IA64_REG_AR_ITC);
  58. ia64_barrier();
  59. }
  60. #endif
  61. return result;
  62. }
  63. extern void ia64_delay_loop (unsigned long loops);
  64. static __inline__ void
  65. __delay (unsigned long loops)
  66. {
  67. if (unlikely(loops < 1))
  68. return;
  69. ia64_delay_loop (loops - 1);
  70. }
  71. extern void udelay (unsigned long usecs);
  72. #endif /* _ASM_IA64_DELAY_H */