2 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
4 * Based on alpha version.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
15 #define OP_MAX_COUNTER 8
17 /* Per-counter configuration as set via oprofilefs. */
18 struct op_counter_config
{
20 unsigned long enabled
;
24 /* We dont support per counter user/kernel selection */
26 unsigned long unit_mask
;
29 /* System-wide configuration as set via oprofilefs. */
30 struct op_system_config
{
34 unsigned long enable_kernel
;
35 unsigned long enable_user
;
36 unsigned long backtrace_spinlocks
;
39 /* Per-arch configuration */
40 struct op_ppc64_model
{
41 void (*reg_setup
) (struct op_counter_config
*,
42 struct op_system_config
*,
44 void (*cpu_setup
) (void *);
45 void (*start
) (struct op_counter_config
*);
47 void (*handle_interrupt
) (struct pt_regs
*,
48 struct op_counter_config
*);
52 static inline unsigned int ctr_read(unsigned int i
)
56 return mfspr(SPRN_PMC1
);
58 return mfspr(SPRN_PMC2
);
60 return mfspr(SPRN_PMC3
);
62 return mfspr(SPRN_PMC4
);
64 return mfspr(SPRN_PMC5
);
66 return mfspr(SPRN_PMC6
);
68 return mfspr(SPRN_PMC7
);
70 return mfspr(SPRN_PMC8
);
76 static inline void ctr_write(unsigned int i
, unsigned int val
)
80 mtspr(SPRN_PMC1
, val
);
83 mtspr(SPRN_PMC2
, val
);
86 mtspr(SPRN_PMC3
, val
);
89 mtspr(SPRN_PMC4
, val
);
92 mtspr(SPRN_PMC5
, val
);
95 mtspr(SPRN_PMC6
, val
);
98 mtspr(SPRN_PMC7
, val
);
101 mtspr(SPRN_PMC8
, val
);