aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorWu Zhangjin <wuzhangjin@gmail.com>2010-05-06 13:29:44 -0400
committerRalf Baechle <ralf@linux-mips.org>2010-05-21 16:31:18 -0400
commit86e5a5202148736bffed49499a1dc8c1a311d3ab (patch)
tree838fcb1c97f5b2e2f8366c9e2d697ef9254b9d45 /arch
parent0103d23f44b1e9f8d2e89cc197e21192f6914f24 (diff)
MIPS: Oprofile: Loongson: Unify macro for setting events
Unified macro for counter0 and counter1 to set the event in the control register. This will be needed by Perf. Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> Cc: linux-mips@linux-mips.org Patchwork: http://patchwork.linux-mips.org/patch/1200/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/oprofile/op_model_loongson2.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/mips/oprofile/op_model_loongson2.c b/arch/mips/oprofile/op_model_loongson2.c
index fa3bf661ae29..93d8b7deb91d 100644
--- a/arch/mips/oprofile/op_model_loongson2.c
+++ b/arch/mips/oprofile/op_model_loongson2.c
@@ -24,8 +24,8 @@
24 */ 24 */
25#define LOONGSON2_CPU_TYPE "mips/loongson2" 25#define LOONGSON2_CPU_TYPE "mips/loongson2"
26 26
27#define LOONGSON2_COUNTER1_EVENT(event) ((event & 0x0f) << 5) 27#define LOONGSON2_PERFCTRL_EVENT(idx, event) \
28#define LOONGSON2_COUNTER2_EVENT(event) ((event & 0x0f) << 9) 28 (((event) & 0x0f) << ((idx) ? 9 : 5))
29 29
30#define LOONGSON2_PERFCNT_EXL (1UL << 0) 30#define LOONGSON2_PERFCNT_EXL (1UL << 0)
31#define LOONGSON2_PERFCNT_KERNEL (1UL << 1) 31#define LOONGSON2_PERFCNT_KERNEL (1UL << 1)
@@ -60,12 +60,12 @@ static void loongson2_reg_setup(struct op_counter_config *cfg)
60 /* Compute the performance counter ctrl word. */ 60 /* Compute the performance counter ctrl word. */
61 /* For now count kernel and user mode */ 61 /* For now count kernel and user mode */
62 if (cfg[0].enabled) { 62 if (cfg[0].enabled) {
63 ctrl |= LOONGSON2_COUNTER1_EVENT(cfg[0].event); 63 ctrl |= LOONGSON2_PERFCTRL_EVENT(0, cfg[0].event);
64 reg.reset_counter1 = 0x80000000ULL - cfg[0].count; 64 reg.reset_counter1 = 0x80000000ULL - cfg[0].count;
65 } 65 }
66 66
67 if (cfg[1].enabled) { 67 if (cfg[1].enabled) {
68 ctrl |= LOONGSON2_COUNTER2_EVENT(cfg[1].event); 68 ctrl |= LOONGSON2_PERFCTRL_EVENT(1, cfg[1].event);
69 reg.reset_counter2 = (0x80000000ULL - cfg[1].count); 69 reg.reset_counter2 = (0x80000000ULL - cfg[1].count);
70 } 70 }
71 71