1/* $Id: timer.h,v 1.1.1.1 2008/10/15 03:27:27 james26_jang 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
28struct sun5_timer {
29	u64	count0;
30	u64	limit0;
31	u64	count1;
32	u64	limit1;
33};
34
35#define SUN5_LIMIT_ENABLE	0x80000000
36#define SUN5_LIMIT_TOZERO	0x40000000
37#define SUN5_LIMIT_ZRESTART	0x20000000
38#define SUN5_LIMIT_CMASK	0x1fffffff
39
40/* Given a HZ value, set the limit register to so that the timer IRQ
41 * gets delivered that often.
42 */
43#define SUN5_HZ_TO_LIMIT(__hz)  (1000000/(__hz))
44
45#ifdef CONFIG_SMP
46extern unsigned long timer_tick_offset;
47extern void timer_tick_interrupt(struct pt_regs *);
48#endif
49
50#endif /* _SPARC64_TIMER_H */
51