1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
5 * Based on alpha version.
8 #ifndef _ASM_POWERPC_OPROFILE_IMPL_H
9 #define _ASM_POWERPC_OPROFILE_IMPL_H
12 #define OP_MAX_COUNTER 8
14 /* Per-counter configuration as set via oprofilefs. */
15 struct op_counter_config
{
16 unsigned long enabled
;
19 /* Classic doesn't support per-counter user/kernel selection */
22 unsigned long unit_mask
;
25 /* System-wide configuration as set via oprofilefs. */
26 struct op_system_config
{
31 #ifdef CONFIG_OPROFILE_CELL
32 /* Register for oprofile user tool to check cell kernel profiling
35 unsigned long cell_support
;
38 unsigned long enable_kernel
;
39 unsigned long enable_user
;
42 /* Per-arch configuration */
43 struct op_powerpc_model
{
44 int (*reg_setup
) (struct op_counter_config
*,
45 struct op_system_config
*,
47 int (*cpu_setup
) (struct op_counter_config
*);
48 int (*start
) (struct op_counter_config
*);
49 int (*global_start
) (struct op_counter_config
*);
51 void (*global_stop
) (void);
52 int (*sync_start
)(void);
53 int (*sync_stop
)(void);
54 void (*handle_interrupt
) (struct pt_regs
*,
55 struct op_counter_config
*);
59 extern struct op_powerpc_model op_model_fsl_emb
;
60 extern struct op_powerpc_model op_model_power4
;
61 extern struct op_powerpc_model op_model_7450
;
62 extern struct op_powerpc_model op_model_cell
;
63 extern struct op_powerpc_model op_model_pa6t
;
66 /* All the classic PPC parts use these */
67 static inline unsigned int classic_ctr_read(unsigned int i
)
71 return mfspr(SPRN_PMC1
);
73 return mfspr(SPRN_PMC2
);
75 return mfspr(SPRN_PMC3
);
77 return mfspr(SPRN_PMC4
);
79 return mfspr(SPRN_PMC5
);
81 return mfspr(SPRN_PMC6
);
83 /* No PPC32 chip has more than 6 so far */
86 return mfspr(SPRN_PMC7
);
88 return mfspr(SPRN_PMC8
);
95 static inline void classic_ctr_write(unsigned int i
, unsigned int val
)
99 mtspr(SPRN_PMC1
, val
);
102 mtspr(SPRN_PMC2
, val
);
105 mtspr(SPRN_PMC3
, val
);
108 mtspr(SPRN_PMC4
, val
);
111 mtspr(SPRN_PMC5
, val
);
114 mtspr(SPRN_PMC6
, val
);
117 /* No PPC32 chip has more than 6, yet */
120 mtspr(SPRN_PMC7
, val
);
123 mtspr(SPRN_PMC8
, val
);
132 extern void op_powerpc_backtrace(struct pt_regs
* const regs
, unsigned int depth
);
134 #endif /* __KERNEL__ */
135 #endif /* _ASM_POWERPC_OPROFILE_IMPL_H */