delay.h 1.7 KB

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