aboutsummaryrefslogtreecommitdiffstats
path: root/include
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
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')
-rw-r--r--include/asm-powerpc/oprofile_impl.h31
-rw-r--r--include/asm-powerpc/reg.h36
2 files changed, 51 insertions, 16 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 */
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index eb392d038ed7..a9a76857f5aa 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -443,12 +443,35 @@
443#define SPRN_SDAR 781 443#define SPRN_SDAR 781
444 444
445#else /* 32-bit */ 445#else /* 32-bit */
446#define SPRN_MMCR0 0x3B8 /* Monitor Mode Control Register 0 */ 446#define SPRN_MMCR0 952 /* Monitor Mode Control Register 0 */
447#define SPRN_MMCR1 0x3BC /* Monitor Mode Control Register 1 */ 447#define MMCR0_FC 0x80000000UL /* freeze counters */
448#define SPRN_PMC1 0x3B9 /* Performance Counter Register 1 */ 448#define MMCR0_FCS 0x40000000UL /* freeze in supervisor state */
449#define SPRN_PMC2 0x3BA /* Performance Counter Register 2 */ 449#define MMCR0_FCP 0x20000000UL /* freeze in problem state */
450#define SPRN_PMC3 0x3BD /* Performance Counter Register 3 */ 450#define MMCR0_FCM1 0x10000000UL /* freeze counters while MSR mark = 1 */
451#define SPRN_PMC4 0x3BE /* Performance Counter Register 4 */ 451#define MMCR0_FCM0 0x08000000UL /* freeze counters while MSR mark = 0 */
452#define MMCR0_PMXE 0x04000000UL /* performance monitor exception enable */
453#define MMCR0_FCECE 0x02000000UL /* freeze ctrs on enabled cond or event */
454#define MMCR0_TBEE 0x00400000UL /* time base exception enable */
455#define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/
456#define MMCR0_PMCnCE 0x00004000UL /* count enable for all but PMC 1*/
457#define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */
458#define MMCR0_PMC1SEL 0x00001fc0UL /* PMC 1 Event */
459#define MMCR0_PMC2SEL 0x0000003fUL /* PMC 2 Event */
460
461#define SPRN_MMCR1 956
462#define MMCR1_PMC3SEL 0xf8000000UL /* PMC 3 Event */
463#define MMCR1_PMC4SEL 0x07c00000UL /* PMC 4 Event */
464#define MMCR1_PMC5SEL 0x003e0000UL /* PMC 5 Event */
465#define MMCR1_PMC6SEL 0x0001f800UL /* PMC 6 Event */
466#define SPRN_MMCR2 944
467#define SPRN_PMC1 953 /* Performance Counter Register 1 */
468#define SPRN_PMC2 954 /* Performance Counter Register 2 */
469#define SPRN_PMC3 957 /* Performance Counter Register 3 */
470#define SPRN_PMC4 958 /* Performance Counter Register 4 */
471#define SPRN_PMC5 945 /* Performance Counter Register 5 */
472#define SPRN_PMC6 946 /* Performance Counter Register 6 */
473
474#define SPRN_SIAR 955 /* Sampled Instruction Address Register */
452 475
453/* Bit definitions for MMCR0 and PMC1 / PMC2. */ 476/* Bit definitions for MMCR0 and PMC1 / PMC2. */
454#define MMCR0_PMC1_CYCLES (1 << 7) 477#define MMCR0_PMC1_CYCLES (1 << 7)
@@ -458,7 +481,6 @@
458#define MMCR0_PMC2_CYCLES 0x1 481#define MMCR0_PMC2_CYCLES 0x1
459#define MMCR0_PMC2_ITLB 0x7 482#define MMCR0_PMC2_ITLB 0x7
460#define MMCR0_PMC2_LOADMISSTIME 0x5 483#define MMCR0_PMC2_LOADMISSTIME 0x5
461#define MMCR0_PMXE (1 << 26)
462#endif 484#endif
463 485
464/* Processor Version Register (PVR) field extraction */ 486/* Processor Version Register (PVR) field extraction */