diff options
Diffstat (limited to 'arch/blackfin/oprofile/common.c')
-rw-r--r-- | arch/blackfin/oprofile/common.c | 119 |
1 files changed, 0 insertions, 119 deletions
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) |