diff options
author | Andy Fleming <afleming@freescale.com> | 2006-10-27 16:06:32 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-10-31 22:52:48 -0500 |
commit | dd6c89f686bdb2a5de72fab636fc839e5a0add6d (patch) | |
tree | 0175b22323dcff97dea9a85b8c01561eeb94a0b1 /include/asm-powerpc | |
parent | e0da0daee14862e0a5c49f2059641a8deb27eca2 (diff) |
[POWERPC] Fix oprofile support for e500 in arch/powerpc
Fixed a compile error in building the 85xx support with oprofile, and in
the process cleaned up some issues with the fsl_booke performance monitor
code.
* Reorganized FSL Book-E performance monitoring code so that the 7450
wouldn't be built if the e500 was, and cleaned it up so it was more
self-contained.
* Added a cpu_setup function for FSL Book-E. The original
cpu_setup function prototype had no arguments, assuming that
the reg_setup function would copy the required information into
variables which represented the registers. This was silly for
e500, since it has 1 register per counter (rather than 3 for
all counters), so the code has been restructured to have
cpu_setup take the current counter config array as an argument,
with op_powerpc_setup() invoking op_powerpc_cpu_setup() through
on_each_cpu(), and op_powerpc_cpu_setup() invoking the
model-specific cpu_setup function with an argument. The
argument is ignored on all other platforms at present.
* Fixed a confusing line where a trinary operator only had two
arguments
Signed-off-by: Andrew Fleming <afleming@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r-- | include/asm-powerpc/oprofile_impl.h | 87 | ||||
-rw-r--r-- | include/asm-powerpc/pmc.h | 13 |
2 files changed, 85 insertions, 15 deletions
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h index 5b33994cd488..07a10e590c1d 100644 --- a/include/asm-powerpc/oprofile_impl.h +++ b/include/asm-powerpc/oprofile_impl.h | |||
@@ -42,7 +42,7 @@ struct op_powerpc_model { | |||
42 | void (*reg_setup) (struct op_counter_config *, | 42 | void (*reg_setup) (struct op_counter_config *, |
43 | struct op_system_config *, | 43 | struct op_system_config *, |
44 | int num_counters); | 44 | int num_counters); |
45 | void (*cpu_setup) (void *); | 45 | void (*cpu_setup) (struct op_counter_config *); |
46 | void (*start) (struct op_counter_config *); | 46 | void (*start) (struct op_counter_config *); |
47 | void (*stop) (void); | 47 | void (*stop) (void); |
48 | void (*handle_interrupt) (struct pt_regs *, | 48 | void (*handle_interrupt) (struct pt_regs *, |
@@ -121,7 +121,90 @@ static inline void ctr_write(unsigned int i, unsigned int val) | |||
121 | break; | 121 | break; |
122 | } | 122 | } |
123 | } | 123 | } |
124 | #endif /* !CONFIG_FSL_BOOKE */ | 124 | #else /* CONFIG_FSL_BOOKE */ |
125 | static inline u32 get_pmlca(int ctr) | ||
126 | { | ||
127 | u32 pmlca; | ||
128 | |||
129 | switch (ctr) { | ||
130 | case 0: | ||
131 | pmlca = mfpmr(PMRN_PMLCA0); | ||
132 | break; | ||
133 | case 1: | ||
134 | pmlca = mfpmr(PMRN_PMLCA1); | ||
135 | break; | ||
136 | case 2: | ||
137 | pmlca = mfpmr(PMRN_PMLCA2); | ||
138 | break; | ||
139 | case 3: | ||
140 | pmlca = mfpmr(PMRN_PMLCA3); | ||
141 | break; | ||
142 | default: | ||
143 | panic("Bad ctr number\n"); | ||
144 | } | ||
145 | |||
146 | return pmlca; | ||
147 | } | ||
148 | |||
149 | static inline void set_pmlca(int ctr, u32 pmlca) | ||
150 | { | ||
151 | switch (ctr) { | ||
152 | case 0: | ||
153 | mtpmr(PMRN_PMLCA0, pmlca); | ||
154 | break; | ||
155 | case 1: | ||
156 | mtpmr(PMRN_PMLCA1, pmlca); | ||
157 | break; | ||
158 | case 2: | ||
159 | mtpmr(PMRN_PMLCA2, pmlca); | ||
160 | break; | ||
161 | case 3: | ||
162 | mtpmr(PMRN_PMLCA3, pmlca); | ||
163 | break; | ||
164 | default: | ||
165 | panic("Bad ctr number\n"); | ||
166 | } | ||
167 | } | ||
168 | |||
169 | static inline unsigned int ctr_read(unsigned int i) | ||
170 | { | ||
171 | switch(i) { | ||
172 | case 0: | ||
173 | return mfpmr(PMRN_PMC0); | ||
174 | case 1: | ||
175 | return mfpmr(PMRN_PMC1); | ||
176 | case 2: | ||
177 | return mfpmr(PMRN_PMC2); | ||
178 | case 3: | ||
179 | return mfpmr(PMRN_PMC3); | ||
180 | default: | ||
181 | return 0; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | static inline void ctr_write(unsigned int i, unsigned int val) | ||
186 | { | ||
187 | switch(i) { | ||
188 | case 0: | ||
189 | mtpmr(PMRN_PMC0, val); | ||
190 | break; | ||
191 | case 1: | ||
192 | mtpmr(PMRN_PMC1, val); | ||
193 | break; | ||
194 | case 2: | ||
195 | mtpmr(PMRN_PMC2, val); | ||
196 | break; | ||
197 | case 3: | ||
198 | mtpmr(PMRN_PMC3, val); | ||
199 | break; | ||
200 | default: | ||
201 | break; | ||
202 | } | ||
203 | } | ||
204 | |||
205 | |||
206 | #endif /* CONFIG_FSL_BOOKE */ | ||
207 | |||
125 | 208 | ||
126 | extern void op_powerpc_backtrace(struct pt_regs * const regs, unsigned int depth); | 209 | extern void op_powerpc_backtrace(struct pt_regs * const regs, unsigned int depth); |
127 | 210 | ||
diff --git a/include/asm-powerpc/pmc.h b/include/asm-powerpc/pmc.h index 07d6a4279319..8588be68e0ad 100644 --- a/include/asm-powerpc/pmc.h +++ b/include/asm-powerpc/pmc.h | |||
@@ -32,18 +32,5 @@ void release_pmc_hardware(void); | |||
32 | void power4_enable_pmcs(void); | 32 | void power4_enable_pmcs(void); |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #ifdef CONFIG_FSL_BOOKE | ||
36 | void init_pmc_stop(int ctr); | ||
37 | void set_pmc_event(int ctr, int event); | ||
38 | void set_pmc_user_kernel(int ctr, int user, int kernel); | ||
39 | void set_pmc_marked(int ctr, int mark0, int mark1); | ||
40 | void pmc_start_ctr(int ctr, int enable); | ||
41 | void pmc_start_ctrs(int enable); | ||
42 | void pmc_stop_ctrs(void); | ||
43 | void dump_pmcs(void); | ||
44 | |||
45 | extern struct op_powerpc_model op_model_fsl_booke; | ||
46 | #endif | ||
47 | |||
48 | #endif /* __KERNEL__ */ | 35 | #endif /* __KERNEL__ */ |
49 | #endif /* _POWERPC_PMC_H */ | 36 | #endif /* _POWERPC_PMC_H */ |