diff options
-rw-r--r-- | arch/blackfin/Kconfig | 6 | ||||
-rw-r--r-- | arch/blackfin/mach-common/interrupt.S | 22 | ||||
-rw-r--r-- | arch/blackfin/mach-common/irqpanic.c | 12 | ||||
-rw-r--r-- | arch/blackfin/oprofile/Makefile | 1 | ||||
-rw-r--r-- | arch/blackfin/oprofile/common.c | 119 | ||||
-rw-r--r-- | arch/blackfin/oprofile/op_blackfin.h | 98 | ||||
-rw-r--r-- | arch/blackfin/oprofile/op_model_bf533.c | 161 | ||||
-rw-r--r-- | arch/blackfin/oprofile/timer_int.c | 73 |
8 files changed, 0 insertions, 492 deletions
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index bbfeecae6403..56ee44d7b2d9 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -1007,12 +1007,6 @@ config EBIU_FCTLVAL | |||
1007 | hex "Flash Memory Bank Control Register" | 1007 | hex "Flash Memory Bank Control Register" |
1008 | depends on BF54x | 1008 | depends on BF54x |
1009 | default 6 | 1009 | default 6 |
1010 | |||
1011 | config HARDWARE_PM | ||
1012 | bool "OProfile use hardware porformance monitor" | ||
1013 | depends on OPROFILE=y | ||
1014 | default n | ||
1015 | |||
1016 | endmenu | 1010 | endmenu |
1017 | 1011 | ||
1018 | ############################################################################# | 1012 | ############################################################################# |
diff --git a/arch/blackfin/mach-common/interrupt.S b/arch/blackfin/mach-common/interrupt.S index c1bdd1edc8eb..473df0f7fa78 100644 --- a/arch/blackfin/mach-common/interrupt.S +++ b/arch/blackfin/mach-common/interrupt.S | |||
@@ -165,16 +165,6 @@ ENTRY(_evt_ivhw) | |||
165 | r0 = [p2]; | 165 | r0 = [p2]; |
166 | [sp + PT_IPEND] = r0; | 166 | [sp + PT_IPEND] = r0; |
167 | 167 | ||
168 | #ifdef CONFIG_HARDWARE_PM | ||
169 | r7 = [sp + PT_SEQSTAT]; | ||
170 | r7 = r7 >>> 0xe; | ||
171 | r6 = 0x1F; | ||
172 | r7 = r7 & r6; | ||
173 | r5 = 0x12; | ||
174 | cc = r7 == r5; | ||
175 | if cc jump .Lcall_do_ovf; /* deal with performance counter overflow */ | ||
176 | #endif | ||
177 | |||
178 | /* set the EXCAUSE to HWERR for trap_c */ | 168 | /* set the EXCAUSE to HWERR for trap_c */ |
179 | r0 = [sp + PT_SEQSTAT]; | 169 | r0 = [sp + PT_SEQSTAT]; |
180 | R1.L = LO(VEC_HWERR); | 170 | R1.L = LO(VEC_HWERR); |
@@ -200,18 +190,6 @@ ENTRY(_evt_ivhw) | |||
200 | .Lcommon_restore_all_sys: | 190 | .Lcommon_restore_all_sys: |
201 | RESTORE_ALL_SYS | 191 | RESTORE_ALL_SYS |
202 | rti; | 192 | rti; |
203 | |||
204 | #ifdef CONFIG_HARDWARE_PM | ||
205 | .Lcall_do_ovf: | ||
206 | |||
207 | R0 = SP; | ||
208 | SP += -12; | ||
209 | call _pm_overflow; | ||
210 | SP += 12; | ||
211 | |||
212 | jump .Lcommon_restore_all_sys; | ||
213 | #endif | ||
214 | |||
215 | ENDPROC(_evt_ivhw) | 193 | ENDPROC(_evt_ivhw) |
216 | 194 | ||
217 | /* Interrupt routine for evt2 (NMI). | 195 | /* Interrupt routine for evt2 (NMI). |
diff --git a/arch/blackfin/mach-common/irqpanic.c b/arch/blackfin/mach-common/irqpanic.c index 7b69413c1556..05004df0f78b 100644 --- a/arch/blackfin/mach-common/irqpanic.c +++ b/arch/blackfin/mach-common/irqpanic.c | |||
@@ -33,8 +33,6 @@ | |||
33 | #include <asm/traps.h> | 33 | #include <asm/traps.h> |
34 | #include <asm/blackfin.h> | 34 | #include <asm/blackfin.h> |
35 | 35 | ||
36 | #include "../oprofile/op_blackfin.h" | ||
37 | |||
38 | #ifdef CONFIG_DEBUG_ICACHE_CHECK | 36 | #ifdef CONFIG_DEBUG_ICACHE_CHECK |
39 | #define L1_ICACHE_START 0xffa10000 | 37 | #define L1_ICACHE_START 0xffa10000 |
40 | #define L1_ICACHE_END 0xffa13fff | 38 | #define L1_ICACHE_END 0xffa13fff |
@@ -134,13 +132,3 @@ asmlinkage void irq_panic(int reason, struct pt_regs *regs) | |||
134 | #endif | 132 | #endif |
135 | 133 | ||
136 | } | 134 | } |
137 | |||
138 | #ifdef CONFIG_HARDWARE_PM | ||
139 | /* | ||
140 | * call the handler of Performance overflow | ||
141 | */ | ||
142 | asmlinkage void pm_overflow(struct pt_regs *regs) | ||
143 | { | ||
144 | pm_overflow_handler(regs); | ||
145 | } | ||
146 | #endif | ||
diff --git a/arch/blackfin/oprofile/Makefile b/arch/blackfin/oprofile/Makefile index 634e300d67e2..f11749078b53 100644 --- a/arch/blackfin/oprofile/Makefile +++ b/arch/blackfin/oprofile/Makefile | |||
@@ -11,4 +11,3 @@ DRIVER_OBJS := $(addprefix ../../../drivers/oprofile/, \ | |||
11 | timer_int.o ) | 11 | timer_int.o ) |
12 | 12 | ||
13 | oprofile-y := $(DRIVER_OBJS) common.o | 13 | oprofile-y := $(DRIVER_OBJS) common.o |
14 | oprofile-$(CONFIG_HARDWARE_PM) += op_model_bf533.o | ||
diff --git a/arch/blackfin/oprofile/common.c b/arch/blackfin/oprofile/common.c index cf8f48848d1b..beace4fb22e1 100644 --- a/arch/blackfin/oprofile/common.c +++ b/arch/blackfin/oprofile/common.c | |||
@@ -30,129 +30,10 @@ | |||
30 | 30 | ||
31 | #include <linux/oprofile.h> | 31 | #include <linux/oprofile.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/smp.h> | ||
34 | #include <linux/errno.h> | ||
35 | #include <linux/mutex.h> | ||
36 | #include <linux/ptrace.h> | ||
37 | #include <linux/irq.h> | ||
38 | #include <linux/io.h> | ||
39 | 33 | ||
40 | #include <asm/system.h> | ||
41 | #include <asm/blackfin.h> | ||
42 | |||
43 | #include "op_blackfin.h" | ||
44 | |||
45 | #define BFIN_533_ID 0xE5040003 | ||
46 | #define BFIN_537_ID 0xE5040002 | ||
47 | |||
48 | static int pfmon_enabled; | ||
49 | static struct mutex pfmon_lock; | ||
50 | |||
51 | struct op_bfin533_model *model; | ||
52 | |||
53 | struct op_counter_config ctr[OP_MAX_COUNTER]; | ||
54 | |||
55 | static int op_bfin_setup(void) | ||
56 | { | ||
57 | int ret; | ||
58 | |||
59 | /* Pre-compute the values to stuff in the hardware registers. */ | ||
60 | spin_lock(&oprofilefs_lock); | ||
61 | ret = model->reg_setup(ctr); | ||
62 | spin_unlock(&oprofilefs_lock); | ||
63 | |||
64 | return ret; | ||
65 | } | ||
66 | |||
67 | static void op_bfin_shutdown(void) | ||
68 | { | ||
69 | #if 0 | ||
70 | /* what is the difference between shutdown and stop? */ | ||
71 | #endif | ||
72 | } | ||
73 | |||
74 | static int op_bfin_start(void) | ||
75 | { | ||
76 | int ret = -EBUSY; | ||
77 | |||
78 | printk(KERN_INFO "KSDBG:in %s\n", __func__); | ||
79 | mutex_lock(&pfmon_lock); | ||
80 | if (!pfmon_enabled) { | ||
81 | ret = model->start(ctr); | ||
82 | pfmon_enabled = !ret; | ||
83 | } | ||
84 | mutex_unlock(&pfmon_lock); | ||
85 | |||
86 | return ret; | ||
87 | } | ||
88 | |||
89 | static void op_bfin_stop(void) | ||
90 | { | ||
91 | mutex_lock(&pfmon_lock); | ||
92 | if (pfmon_enabled) { | ||
93 | model->stop(); | ||
94 | pfmon_enabled = 0; | ||
95 | } | ||
96 | mutex_unlock(&pfmon_lock); | ||
97 | } | ||
98 | |||
99 | static int op_bfin_create_files(struct super_block *sb, struct dentry *root) | ||
100 | { | ||
101 | int i; | ||
102 | |||
103 | for (i = 0; i < model->num_counters; ++i) { | ||
104 | struct dentry *dir; | ||
105 | char buf[3]; | ||
106 | printk(KERN_INFO "Oprofile: creating files... \n"); | ||
107 | |||
108 | snprintf(buf, sizeof buf, "%d", i); | ||
109 | dir = oprofilefs_mkdir(sb, root, buf); | ||
110 | |||
111 | oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled); | ||
112 | oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event); | ||
113 | oprofilefs_create_ulong(sb, dir, "count", &ctr[i].count); | ||
114 | /* | ||
115 | * We dont support per counter user/kernel selection, but | ||
116 | * we leave the entries because userspace expects them | ||
117 | */ | ||
118 | oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel); | ||
119 | oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user); | ||
120 | oprofilefs_create_ulong(sb, dir, "unit_mask", | ||
121 | &ctr[i].unit_mask); | ||
122 | } | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | int __init oprofile_arch_init(struct oprofile_operations *ops) | 34 | int __init oprofile_arch_init(struct oprofile_operations *ops) |
127 | { | 35 | { |
128 | #ifdef CONFIG_HARDWARE_PM | ||
129 | mutex_init(&pfmon_lock); | ||
130 | |||
131 | |||
132 | switch (bfin_read_CHIPID() & CHIPID_MANUFACTURE) { | ||
133 | case 0xca: | ||
134 | printk(KERN_INFO "Oprofile: cpu vendor is Analog Devices.\n"); | ||
135 | model = &op_model_bfin533; | ||
136 | model->num_counters = 2; | ||
137 | break; | ||
138 | default: | ||
139 | return -ENODEV; | ||
140 | } | ||
141 | |||
142 | ops->cpu_type = model->name; | ||
143 | ops->create_files = op_bfin_create_files; | ||
144 | ops->setup = op_bfin_setup; | ||
145 | ops->shutdown = op_bfin_shutdown; | ||
146 | ops->start = op_bfin_start; | ||
147 | ops->stop = op_bfin_stop; | ||
148 | |||
149 | printk(KERN_INFO "oprofile: using %s performance monitoring.\n", | ||
150 | ops->cpu_type); | ||
151 | |||
152 | return 0; | ||
153 | #else | ||
154 | return -1; | 36 | return -1; |
155 | #endif | ||
156 | } | 37 | } |
157 | 38 | ||
158 | void oprofile_arch_exit(void) | 39 | void oprofile_arch_exit(void) |
diff --git a/arch/blackfin/oprofile/op_blackfin.h b/arch/blackfin/oprofile/op_blackfin.h deleted file mode 100644 index 37aec0eb00d0..000000000000 --- a/arch/blackfin/oprofile/op_blackfin.h +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | * File: arch/blackfin/oprofile/op_blackfin.h | ||
3 | * Based on: | ||
4 | * Author: Anton Blanchard <anton@au.ibm.com> | ||
5 | * | ||
6 | * Created: | ||
7 | * Description: | ||
8 | * | ||
9 | * Modified: | ||
10 | * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM | ||
11 | * Copyright 2004-2006 Analog Devices Inc. | ||
12 | * | ||
13 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License as published by | ||
17 | * the Free Software Foundation; either version 2 of the License, or | ||
18 | * (at your option) any later version. | ||
19 | * | ||
20 | * This program is distributed in the hope that it will be useful, | ||
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
23 | * GNU General Public License for more details. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License | ||
26 | * along with this program; if not, see the file COPYING, or write | ||
27 | * to the Free Software Foundation, Inc., | ||
28 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
29 | */ | ||
30 | |||
31 | #ifndef OP_BLACKFIN_H | ||
32 | #define OP_BLACKFIN_H 1 | ||
33 | |||
34 | #define OP_MAX_COUNTER 2 | ||
35 | |||
36 | #include <asm/blackfin.h> | ||
37 | |||
38 | /* Per-counter configuration as set via oprofilefs. */ | ||
39 | struct op_counter_config { | ||
40 | unsigned long valid; | ||
41 | unsigned long enabled; | ||
42 | unsigned long event; | ||
43 | unsigned long count; | ||
44 | unsigned long kernel; | ||
45 | unsigned long user; | ||
46 | unsigned long unit_mask; | ||
47 | }; | ||
48 | |||
49 | /* System-wide configuration as set via oprofilefs. */ | ||
50 | struct op_system_config { | ||
51 | unsigned long enable_kernel; | ||
52 | unsigned long enable_user; | ||
53 | }; | ||
54 | |||
55 | /* Per-arch configuration */ | ||
56 | struct op_bfin533_model { | ||
57 | int (*reg_setup) (struct op_counter_config *); | ||
58 | int (*start) (struct op_counter_config *); | ||
59 | void (*stop) (void); | ||
60 | int num_counters; | ||
61 | char *name; | ||
62 | }; | ||
63 | |||
64 | extern struct op_bfin533_model op_model_bfin533; | ||
65 | |||
66 | static inline unsigned int ctr_read(void) | ||
67 | { | ||
68 | unsigned int tmp; | ||
69 | |||
70 | tmp = bfin_read_PFCTL(); | ||
71 | CSYNC(); | ||
72 | |||
73 | return tmp; | ||
74 | } | ||
75 | |||
76 | static inline void ctr_write(unsigned int val) | ||
77 | { | ||
78 | bfin_write_PFCTL(val); | ||
79 | CSYNC(); | ||
80 | } | ||
81 | |||
82 | static inline void count_read(unsigned int *count) | ||
83 | { | ||
84 | count[0] = bfin_read_PFCNTR0(); | ||
85 | count[1] = bfin_read_PFCNTR1(); | ||
86 | CSYNC(); | ||
87 | } | ||
88 | |||
89 | static inline void count_write(unsigned int *count) | ||
90 | { | ||
91 | bfin_write_PFCNTR0(count[0]); | ||
92 | bfin_write_PFCNTR1(count[1]); | ||
93 | CSYNC(); | ||
94 | } | ||
95 | |||
96 | extern int pm_overflow_handler(struct pt_regs *regs); | ||
97 | |||
98 | #endif | ||
diff --git a/arch/blackfin/oprofile/op_model_bf533.c b/arch/blackfin/oprofile/op_model_bf533.c deleted file mode 100644 index 0e34df169b2d..000000000000 --- a/arch/blackfin/oprofile/op_model_bf533.c +++ /dev/null | |||
@@ -1,161 +0,0 @@ | |||
1 | /* | ||
2 | * File: arch/blackfin/oprofile/op_model_bf533.c | ||
3 | * Based on: | ||
4 | * Author: Anton Blanchard <anton@au.ibm.com> | ||
5 | * | ||
6 | * Created: | ||
7 | * Description: | ||
8 | * | ||
9 | * Modified: | ||
10 | * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM | ||
11 | * Copyright 2004-2006 Analog Devices Inc. | ||
12 | * | ||
13 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License as published by | ||
17 | * the Free Software Foundation; either version 2 of the License, or | ||
18 | * (at your option) any later version. | ||
19 | * | ||
20 | * This program is distributed in the hope that it will be useful, | ||
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
23 | * GNU General Public License for more details. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License | ||
26 | * along with this program; if not, see the file COPYING, or write | ||
27 | * to the Free Software Foundation, Inc., | ||
28 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
29 | */ | ||
30 | |||
31 | #include <linux/oprofile.h> | ||
32 | #include <linux/init.h> | ||
33 | #include <linux/smp.h> | ||
34 | #include <linux/interrupt.h> | ||
35 | #include <linux/ptrace.h> | ||
36 | #include <linux/irq.h> | ||
37 | #include <linux/io.h> | ||
38 | #include <asm/system.h> | ||
39 | #include <asm/processor.h> | ||
40 | #include <asm/blackfin.h> | ||
41 | |||
42 | #include "op_blackfin.h" | ||
43 | |||
44 | #define PM_ENABLE 0x01; | ||
45 | #define PM_CTL1_ENABLE 0x18 | ||
46 | #define PM_CTL0_ENABLE 0xC000 | ||
47 | #define COUNT_EDGE_ONLY 0x3000000 | ||
48 | |||
49 | static int oprofile_running; | ||
50 | |||
51 | static unsigned curr_pfctl, curr_count[2]; | ||
52 | |||
53 | static int bfin533_reg_setup(struct op_counter_config *ctr) | ||
54 | { | ||
55 | unsigned int pfctl = 0; | ||
56 | unsigned int count[2]; | ||
57 | |||
58 | /* set Blackfin perf monitor regs with ctr */ | ||
59 | if (ctr[0].enabled) { | ||
60 | pfctl |= (PM_CTL0_ENABLE | ((char)ctr[0].event << 5)); | ||
61 | count[0] = 0xFFFFFFFF - ctr[0].count; | ||
62 | curr_count[0] = count[0]; | ||
63 | } | ||
64 | if (ctr[1].enabled) { | ||
65 | pfctl |= (PM_CTL1_ENABLE | ((char)ctr[1].event << 16)); | ||
66 | count[1] = 0xFFFFFFFF - ctr[1].count; | ||
67 | curr_count[1] = count[1]; | ||
68 | } | ||
69 | |||
70 | pr_debug("ctr[0].enabled=%d,ctr[1].enabled=%d,ctr[0].event<<5=0x%x,ctr[1].event<<16=0x%x\n", ctr[0].enabled, ctr[1].enabled, ctr[0].event << 5, ctr[1].event << 16); | ||
71 | pfctl |= COUNT_EDGE_ONLY; | ||
72 | curr_pfctl = pfctl; | ||
73 | |||
74 | pr_debug("write 0x%x to pfctl\n", pfctl); | ||
75 | ctr_write(pfctl); | ||
76 | count_write(count); | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | static int bfin533_start(struct op_counter_config *ctr) | ||
82 | { | ||
83 | unsigned int pfctl = ctr_read(); | ||
84 | |||
85 | pfctl |= PM_ENABLE; | ||
86 | curr_pfctl = pfctl; | ||
87 | |||
88 | ctr_write(pfctl); | ||
89 | |||
90 | oprofile_running = 1; | ||
91 | pr_debug("start oprofile counter \n"); | ||
92 | |||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | static void bfin533_stop(void) | ||
97 | { | ||
98 | int pfctl; | ||
99 | |||
100 | pfctl = ctr_read(); | ||
101 | pfctl &= ~PM_ENABLE; | ||
102 | /* freeze counters */ | ||
103 | ctr_write(pfctl); | ||
104 | |||
105 | oprofile_running = 0; | ||
106 | pr_debug("stop oprofile counter \n"); | ||
107 | } | ||
108 | |||
109 | static int get_kernel(void) | ||
110 | { | ||
111 | int ipend, is_kernel; | ||
112 | |||
113 | ipend = bfin_read_IPEND(); | ||
114 | |||
115 | /* test bit 15 */ | ||
116 | is_kernel = ((ipend & 0x8000) != 0); | ||
117 | |||
118 | return is_kernel; | ||
119 | } | ||
120 | |||
121 | int pm_overflow_handler(struct pt_regs *regs) | ||
122 | { | ||
123 | int is_kernel; | ||
124 | int i, cpu; | ||
125 | unsigned int pc, pfctl; | ||
126 | unsigned int count[2]; | ||
127 | |||
128 | pr_debug("get interrupt in %s\n", __func__); | ||
129 | if (oprofile_running == 0) { | ||
130 | pr_debug("error: entering interrupt when oprofile is stopped.\n\r"); | ||
131 | return -1; | ||
132 | } | ||
133 | |||
134 | is_kernel = get_kernel(); | ||
135 | cpu = smp_processor_id(); | ||
136 | pc = regs->pc; | ||
137 | pfctl = ctr_read(); | ||
138 | |||
139 | /* read the two event counter regs */ | ||
140 | count_read(count); | ||
141 | |||
142 | /* if the counter overflows, add sample to oprofile buffer */ | ||
143 | for (i = 0; i < 2; ++i) { | ||
144 | if (oprofile_running) { | ||
145 | oprofile_add_sample(regs, i); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | /* reset the perfmon counter */ | ||
150 | ctr_write(curr_pfctl); | ||
151 | count_write(curr_count); | ||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | struct op_bfin533_model op_model_bfin533 = { | ||
156 | .reg_setup = bfin533_reg_setup, | ||
157 | .start = bfin533_start, | ||
158 | .stop = bfin533_stop, | ||
159 | .num_counters = 2, | ||
160 | .name = "blackfin/bf533" | ||
161 | }; | ||
diff --git a/arch/blackfin/oprofile/timer_int.c b/arch/blackfin/oprofile/timer_int.c deleted file mode 100644 index 6c6f8606af4c..000000000000 --- a/arch/blackfin/oprofile/timer_int.c +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* | ||
2 | * File: arch/blackfin/oprofile/timer_int.c | ||
3 | * Based on: | ||
4 | * Author: Michael Kang | ||
5 | * | ||
6 | * Created: | ||
7 | * Description: | ||
8 | * | ||
9 | * Modified: | ||
10 | * Copyright 2004-2006 Analog Devices Inc. | ||
11 | * | ||
12 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License as published by | ||
16 | * the Free Software Foundation; either version 2 of the License, or | ||
17 | * (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, see the file COPYING, or write | ||
26 | * to the Free Software Foundation, Inc., | ||
27 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
28 | */ | ||
29 | |||
30 | #include <linux/init.h> | ||
31 | #include <linux/smp.h> | ||
32 | #include <linux/irq.h> | ||
33 | #include <linux/oprofile.h> | ||
34 | #include <linux/ptrace.h> | ||
35 | |||
36 | static void enable_sys_timer0() | ||
37 | { | ||
38 | } | ||
39 | static void disable_sys_timer0() | ||
40 | { | ||
41 | } | ||
42 | |||
43 | static irqreturn_t sys_timer0_int_handler(int irq, void *dev_id, | ||
44 | struct pt_regs *regs) | ||
45 | { | ||
46 | oprofile_add_sample(regs, 0); | ||
47 | return IRQ_HANDLED; | ||
48 | } | ||
49 | |||
50 | static int sys_timer0_start(void) | ||
51 | { | ||
52 | enable_sys_timer0(); | ||
53 | return request_irq(IVG11, sys_timer0_int_handler, 0, "sys_timer0", NULL); | ||
54 | } | ||
55 | |||
56 | static void sys_timer0_stop(void) | ||
57 | { | ||
58 | disable_sys_timer(); | ||
59 | } | ||
60 | |||
61 | int __init sys_timer0_init(struct oprofile_operations *ops) | ||
62 | { | ||
63 | extern int nmi_active; | ||
64 | |||
65 | if (nmi_active <= 0) | ||
66 | return -ENODEV; | ||
67 | |||
68 | ops->start = timer_start; | ||
69 | ops->stop = timer_stop; | ||
70 | ops->cpu_type = "timer"; | ||
71 | printk(KERN_INFO "oprofile: using NMI timer interrupt.\n"); | ||
72 | return 0; | ||
73 | } | ||