aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/oprofile_impl.h
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2005-12-15 21:02:04 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-08 23:06:03 -0500
commit555d97ac87aef08bb55dff6f05e68fe2987d6f6d (patch)
tree7016485d112af04b972dcc749e437a7131424252 /include/asm-powerpc/oprofile_impl.h
parente5cd040409dc0f8d34a21827d6b74918b3a4fccf (diff)
[PATCH] powerpc: G4+ oprofile support
This patch adds oprofile support for the 7450 and all its multitudinous derivatives. * Added 7450 (and derivatives) support for oprofile * Changed e500 cputable to have oprofile model and cpu_type fields * Added support for classic 32-bit performance monitor interrupt * Cleaned up common powerpc oprofile code to be as common as possible * Cleaned up oprofile_impl.h to reflect 32 bit classic code * Added 32-bit MMCRx bitfield definitions and SPR numbers Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/oprofile_impl.h')
-rw-r--r--include/asm-powerpc/oprofile_impl.h31
1 files changed, 22 insertions, 9 deletions
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index 8013cd273ced..b48d35e40172 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -22,24 +22,22 @@ struct op_counter_config {
22 unsigned long enabled; 22 unsigned long enabled;
23 unsigned long event; 23 unsigned long event;
24 unsigned long count; 24 unsigned long count;
25 /* Classic doesn't support per-counter user/kernel selection */
25 unsigned long kernel; 26 unsigned long kernel;
26#ifdef __powerpc64__
27 /* We dont support per counter user/kernel selection */
28#endif
29 unsigned long user; 27 unsigned long user;
30 unsigned long unit_mask; 28 unsigned long unit_mask;
31}; 29};
32 30
33/* System-wide configuration as set via oprofilefs. */ 31/* System-wide configuration as set via oprofilefs. */
34struct op_system_config { 32struct op_system_config {
35#ifdef __powerpc64__ 33#ifdef CONFIG_PPC64
36 unsigned long mmcr0; 34 unsigned long mmcr0;
37 unsigned long mmcr1; 35 unsigned long mmcr1;
38 unsigned long mmcra; 36 unsigned long mmcra;
39#endif 37#endif
40 unsigned long enable_kernel; 38 unsigned long enable_kernel;
41 unsigned long enable_user; 39 unsigned long enable_user;
42#ifdef __powerpc64__ 40#ifdef CONFIG_PPC64
43 unsigned long backtrace_spinlocks; 41 unsigned long backtrace_spinlocks;
44#endif 42#endif
45}; 43};
@@ -49,9 +47,7 @@ struct op_powerpc_model {
49 void (*reg_setup) (struct op_counter_config *, 47 void (*reg_setup) (struct op_counter_config *,
50 struct op_system_config *, 48 struct op_system_config *,
51 int num_counters); 49 int num_counters);
52#ifdef __powerpc64__
53 void (*cpu_setup) (void *); 50 void (*cpu_setup) (void *);
54#endif
55 void (*start) (struct op_counter_config *); 51 void (*start) (struct op_counter_config *);
56 void (*stop) (void); 52 void (*stop) (void);
57 void (*handle_interrupt) (struct pt_regs *, 53 void (*handle_interrupt) (struct pt_regs *,
@@ -59,10 +55,19 @@ struct op_powerpc_model {
59 int num_counters; 55 int num_counters;
60}; 56};
61 57
62#ifdef __powerpc64__ 58#ifdef CONFIG_FSL_BOOKE
59extern struct op_powerpc_model op_model_fsl_booke;
60#else /* Otherwise, it's classic */
61
62#ifdef CONFIG_PPC64
63extern struct op_powerpc_model op_model_rs64; 63extern struct op_powerpc_model op_model_rs64;
64extern struct op_powerpc_model op_model_power4; 64extern struct op_powerpc_model op_model_power4;
65 65
66#else /* Otherwise, CONFIG_PPC32 */
67extern struct op_powerpc_model op_model_7450;
68#endif
69
70/* All the classic PPC parts use these */
66static inline unsigned int ctr_read(unsigned int i) 71static inline unsigned int ctr_read(unsigned int i)
67{ 72{
68 switch(i) { 73 switch(i) {
@@ -78,10 +83,14 @@ static inline unsigned int ctr_read(unsigned int i)
78 return mfspr(SPRN_PMC5); 83 return mfspr(SPRN_PMC5);
79 case 5: 84 case 5:
80 return mfspr(SPRN_PMC6); 85 return mfspr(SPRN_PMC6);
86
87/* No PPC32 chip has more than 6 so far */
88#ifdef CONFIG_PPC64
81 case 6: 89 case 6:
82 return mfspr(SPRN_PMC7); 90 return mfspr(SPRN_PMC7);
83 case 7: 91 case 7:
84 return mfspr(SPRN_PMC8); 92 return mfspr(SPRN_PMC8);
93#endif
85 default: 94 default:
86 return 0; 95 return 0;
87 } 96 }
@@ -108,16 +117,20 @@ static inline void ctr_write(unsigned int i, unsigned int val)
108 case 5: 117 case 5:
109 mtspr(SPRN_PMC6, val); 118 mtspr(SPRN_PMC6, val);
110 break; 119 break;
120
121/* No PPC32 chip has more than 6, yet */
122#ifdef CONFIG_PPC64
111 case 6: 123 case 6:
112 mtspr(SPRN_PMC7, val); 124 mtspr(SPRN_PMC7, val);
113 break; 125 break;
114 case 7: 126 case 7:
115 mtspr(SPRN_PMC8, val); 127 mtspr(SPRN_PMC8, val);
116 break; 128 break;
129#endif
117 default: 130 default:
118 break; 131 break;
119 } 132 }
120} 133}
121#endif /* __powerpc64__ */ 134#endif /* !CONFIG_FSL_BOOKE */
122 135
123#endif /* _ASM_POWERPC_OPROFILE_IMPL_H */ 136#endif /* _ASM_POWERPC_OPROFILE_IMPL_H */