aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/oprofile_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-powerpc/oprofile_impl.h')
-rw-r--r--include/asm-powerpc/oprofile_impl.h33
1 files changed, 24 insertions, 9 deletions
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index 8013cd273ced..338e6a7cff4a 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -11,6 +11,7 @@
11 11
12#ifndef _ASM_POWERPC_OPROFILE_IMPL_H 12#ifndef _ASM_POWERPC_OPROFILE_IMPL_H
13#define _ASM_POWERPC_OPROFILE_IMPL_H 13#define _ASM_POWERPC_OPROFILE_IMPL_H
14#ifdef __KERNEL__
14 15
15#define OP_MAX_COUNTER 8 16#define OP_MAX_COUNTER 8
16 17
@@ -22,24 +23,22 @@ struct op_counter_config {
22 unsigned long enabled; 23 unsigned long enabled;
23 unsigned long event; 24 unsigned long event;
24 unsigned long count; 25 unsigned long count;
26 /* Classic doesn't support per-counter user/kernel selection */
25 unsigned long kernel; 27 unsigned long kernel;
26#ifdef __powerpc64__
27 /* We dont support per counter user/kernel selection */
28#endif
29 unsigned long user; 28 unsigned long user;
30 unsigned long unit_mask; 29 unsigned long unit_mask;
31}; 30};
32 31
33/* System-wide configuration as set via oprofilefs. */ 32/* System-wide configuration as set via oprofilefs. */
34struct op_system_config { 33struct op_system_config {
35#ifdef __powerpc64__ 34#ifdef CONFIG_PPC64
36 unsigned long mmcr0; 35 unsigned long mmcr0;
37 unsigned long mmcr1; 36 unsigned long mmcr1;
38 unsigned long mmcra; 37 unsigned long mmcra;
39#endif 38#endif
40 unsigned long enable_kernel; 39 unsigned long enable_kernel;
41 unsigned long enable_user; 40 unsigned long enable_user;
42#ifdef __powerpc64__ 41#ifdef CONFIG_PPC64
43 unsigned long backtrace_spinlocks; 42 unsigned long backtrace_spinlocks;
44#endif 43#endif
45}; 44};
@@ -49,9 +48,7 @@ struct op_powerpc_model {
49 void (*reg_setup) (struct op_counter_config *, 48 void (*reg_setup) (struct op_counter_config *,
50 struct op_system_config *, 49 struct op_system_config *,
51 int num_counters); 50 int num_counters);
52#ifdef __powerpc64__
53 void (*cpu_setup) (void *); 51 void (*cpu_setup) (void *);
54#endif
55 void (*start) (struct op_counter_config *); 52 void (*start) (struct op_counter_config *);
56 void (*stop) (void); 53 void (*stop) (void);
57 void (*handle_interrupt) (struct pt_regs *, 54 void (*handle_interrupt) (struct pt_regs *,
@@ -59,10 +56,19 @@ struct op_powerpc_model {
59 int num_counters; 56 int num_counters;
60}; 57};
61 58
62#ifdef __powerpc64__ 59#ifdef CONFIG_FSL_BOOKE
60extern struct op_powerpc_model op_model_fsl_booke;
61#else /* Otherwise, it's classic */
62
63#ifdef CONFIG_PPC64
63extern struct op_powerpc_model op_model_rs64; 64extern struct op_powerpc_model op_model_rs64;
64extern struct op_powerpc_model op_model_power4; 65extern struct op_powerpc_model op_model_power4;
65 66
67#else /* Otherwise, CONFIG_PPC32 */
68extern struct op_powerpc_model op_model_7450;
69#endif
70
71/* All the classic PPC parts use these */
66static inline unsigned int ctr_read(unsigned int i) 72static inline unsigned int ctr_read(unsigned int i)
67{ 73{
68 switch(i) { 74 switch(i) {
@@ -78,10 +84,14 @@ static inline unsigned int ctr_read(unsigned int i)
78 return mfspr(SPRN_PMC5); 84 return mfspr(SPRN_PMC5);
79 case 5: 85 case 5:
80 return mfspr(SPRN_PMC6); 86 return mfspr(SPRN_PMC6);
87
88/* No PPC32 chip has more than 6 so far */
89#ifdef CONFIG_PPC64
81 case 6: 90 case 6:
82 return mfspr(SPRN_PMC7); 91 return mfspr(SPRN_PMC7);
83 case 7: 92 case 7:
84 return mfspr(SPRN_PMC8); 93 return mfspr(SPRN_PMC8);
94#endif
85 default: 95 default:
86 return 0; 96 return 0;
87 } 97 }
@@ -108,16 +118,21 @@ static inline void ctr_write(unsigned int i, unsigned int val)
108 case 5: 118 case 5:
109 mtspr(SPRN_PMC6, val); 119 mtspr(SPRN_PMC6, val);
110 break; 120 break;
121
122/* No PPC32 chip has more than 6, yet */
123#ifdef CONFIG_PPC64
111 case 6: 124 case 6:
112 mtspr(SPRN_PMC7, val); 125 mtspr(SPRN_PMC7, val);
113 break; 126 break;
114 case 7: 127 case 7:
115 mtspr(SPRN_PMC8, val); 128 mtspr(SPRN_PMC8, val);
116 break; 129 break;
130#endif
117 default: 131 default:
118 break; 132 break;
119 } 133 }
120} 134}
121#endif /* __powerpc64__ */ 135#endif /* !CONFIG_FSL_BOOKE */
122 136
137#endif /* __KERNEL__ */
123#endif /* _ASM_POWERPC_OPROFILE_IMPL_H */ 138#endif /* _ASM_POWERPC_OPROFILE_IMPL_H */