timer.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* $Id: timer.h,v 1.3 2000/05/09 17:40:15 davem Exp $
  2. * timer.h: System timer definitions for sun5.
  3. *
  4. * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
  5. */
  6. #ifndef _SPARC64_TIMER_H
  7. #define _SPARC64_TIMER_H
  8. #include <linux/types.h>
  9. /* How timers work:
  10. *
  11. * On uniprocessors we just use counter zero for the system wide
  12. * ticker, this performs thread scheduling, clock book keeping,
  13. * and runs timer based events. Previously we used the Ultra
  14. * %tick interrupt for this purpose.
  15. *
  16. * On multiprocessors we pick one cpu as the master level 10 tick
  17. * processor. Here this counter zero tick handles clock book
  18. * keeping and timer events only. Each Ultra has it's level
  19. * 14 %tick interrupt set to fire off as well, even the master
  20. * tick cpu runs this locally. This ticker performs thread
  21. * scheduling, system/user tick counting for the current thread,
  22. * and also profiling if enabled.
  23. */
  24. #include <linux/config.h>
  25. /* Two timers, traditionally steered to PIL's 10 and 14 respectively.
  26. * But since INO packets are used on sun5, we could use any PIL level
  27. * we like, however for now we use the normal ones.
  28. *
  29. * The 'reg' and 'interrupts' properties for these live in nodes named
  30. * 'counter-timer'. The first of three 'reg' properties describe where
  31. * the sun5_timer registers are. The other two I have no idea. (XXX)
  32. */
  33. struct sun5_timer {
  34. u64 count0;
  35. u64 limit0;
  36. u64 count1;
  37. u64 limit1;
  38. };
  39. #define SUN5_LIMIT_ENABLE 0x80000000
  40. #define SUN5_LIMIT_TOZERO 0x40000000
  41. #define SUN5_LIMIT_ZRESTART 0x20000000
  42. #define SUN5_LIMIT_CMASK 0x1fffffff
  43. /* Given a HZ value, set the limit register to so that the timer IRQ
  44. * gets delivered that often.
  45. */
  46. #define SUN5_HZ_TO_LIMIT(__hz) (1000000/(__hz))
  47. struct sparc64_tick_ops {
  48. void (*init_tick)(unsigned long);
  49. unsigned long (*get_tick)(void);
  50. unsigned long (*get_compare)(void);
  51. unsigned long (*add_tick)(unsigned long, unsigned long);
  52. unsigned long (*add_compare)(unsigned long);
  53. unsigned long softint_mask;
  54. };
  55. extern struct sparc64_tick_ops *tick_ops;
  56. #ifdef CONFIG_SMP
  57. extern unsigned long timer_tick_offset;
  58. struct pt_regs;
  59. extern void timer_tick_interrupt(struct pt_regs *);
  60. #endif
  61. extern unsigned long sparc64_get_clock_tick(unsigned int cpu);
  62. #endif /* _SPARC64_TIMER_H */