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