diff options
author | David S. Miller <davem@davemloft.net> | 2012-08-17 02:26:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-08-19 02:26:18 -0400 |
commit | 73a6b0538c131d489fe7a2581deddb72faca496b (patch) | |
tree | 3d74b564d96900134d168eff200f802970fb7d70 /arch/sparc/include/asm | |
parent | 09d053c797f4a559af0647e4283b9b9ec0682d10 (diff) |
sparc64: Abstract away the NMI PIC counter computation.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/include/asm')
-rw-r--r-- | arch/sparc/include/asm/pcr.h | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/arch/sparc/include/asm/pcr.h b/arch/sparc/include/asm/pcr.h index d53abf75198..4c71bec2065 100644 --- a/arch/sparc/include/asm/pcr.h +++ b/arch/sparc/include/asm/pcr.h | |||
@@ -6,6 +6,7 @@ struct pcr_ops { | |||
6 | void (*write_pcr)(unsigned long, u64); | 6 | void (*write_pcr)(unsigned long, u64); |
7 | u64 (*read_pic)(unsigned long); | 7 | u64 (*read_pic)(unsigned long); |
8 | void (*write_pic)(unsigned long, u64); | 8 | void (*write_pic)(unsigned long, u64); |
9 | u64 (*nmi_picl_value)(unsigned int nmi_hz); | ||
9 | }; | 10 | }; |
10 | extern const struct pcr_ops *pcr_ops; | 11 | extern const struct pcr_ops *pcr_ops; |
11 | 12 | ||
@@ -29,20 +30,6 @@ extern void schedule_deferred_pcr_work(void); | |||
29 | #define PCR_N2_SL1_SHIFT 27 | 30 | #define PCR_N2_SL1_SHIFT 27 |
30 | #define PCR_N2_OV1 0x80000000 | 31 | #define PCR_N2_OV1 0x80000000 |
31 | 32 | ||
32 | extern unsigned int picl_shift; | ||
33 | |||
34 | /* In order to commonize as much of the implementation as | ||
35 | * possible, we use PICH as our counter. Mostly this is | ||
36 | * to accommodate Niagara-1 which can only count insn cycles | ||
37 | * in PICH. | ||
38 | */ | ||
39 | static inline u64 picl_value(unsigned int nmi_hz) | ||
40 | { | ||
41 | u32 delta = local_cpu_data().clock_tick / (nmi_hz << picl_shift); | ||
42 | |||
43 | return ((u64)((0 - delta) & 0xffffffff)) << 32; | ||
44 | } | ||
45 | |||
46 | extern u64 pcr_enable; | 33 | extern u64 pcr_enable; |
47 | 34 | ||
48 | extern int pcr_arch_init(void); | 35 | extern int pcr_arch_init(void); |