ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-ia64 / sn / clksupport.h
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
7  */
8
9 /*
10  * This file contains definitions for accessing a platform supported high resolution
11  * clock. The clock is monitonically increasing and can be accessed from any node
12  * in the system. The clock is synchronized across nodes - all nodes see the
13  * same value.
14  * 
15  *      RTC_COUNTER_ADDR - contains the address of the counter 
16  *
17  *      GET_RTC_COUNTER() - macro to read the value of the clock
18  *
19  *      RTC_CYCLES_PER_SEC - clock frequency in ticks per second        
20  *
21  */
22
23 #ifndef _ASM_IA64_SN_CLKSUPPORT_H
24 #define _ASM_IA64_SN_CLKSUPPORT_H
25
26 #include <asm/sn/arch.h>
27 #include <asm/sn/addrs.h>
28 #include <asm/sn/sn2/addrs.h>
29 #include <asm/sn/sn2/shubio.h>
30 #include <asm/sn/sn2/shub_mmr.h>
31
32 typedef long clkreg_t;
33
34 extern unsigned long sn_rtc_cycles_per_second;
35 extern unsigned long sn_rtc_per_itc;
36
37 #define RTC_MASK                SH_RTC_MASK
38 #define RTC_COUNTER_ADDR        ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
39 #define RTC_COMPARE_A_ADDR      ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
40 #define RTC_COMPARE_B_ADDR      ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
41 #define RTC_INT_PENDING_A_ADDR  ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
42 #define RTC_INT_PENDING_B_ADDR  ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
43 #define RTC_INT_ENABLED_A_ADDR  ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
44 #define RTC_INT_ENABLED_B_ADDR  ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
45
46 #define SN_RTC_PER_ITC_SHIFT    34
47 #define GET_RTC_COUNTER()       (*RTC_COUNTER_ADDR)
48 #define rtc_time()              GET_RTC_COUNTER()
49
50 #define RTC_CYCLES_PER_SEC      sn_rtc_cycles_per_second
51
52 #endif /* _ASM_IA64_SN_CLKSUPPORT_H */