diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/alpha/oprofile/op_model_ev6.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/alpha/oprofile/op_model_ev6.c')
-rw-r--r-- | arch/alpha/oprofile/op_model_ev6.c | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/arch/alpha/oprofile/op_model_ev6.c b/arch/alpha/oprofile/op_model_ev6.c new file mode 100644 index 000000000000..0869f85f5748 --- /dev/null +++ b/arch/alpha/oprofile/op_model_ev6.c | |||
@@ -0,0 +1,103 @@ | |||
1 | /** | ||
2 | * @file arch/alpha/oprofile/op_model_ev6.c | ||
3 | * | ||
4 | * @remark Copyright 2002 OProfile authors | ||
5 | * @remark Read the file COPYING | ||
6 | * | ||
7 | * @author Richard Henderson <rth@twiddle.net> | ||
8 | */ | ||
9 | |||
10 | #include <linux/oprofile.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/smp.h> | ||
13 | #include <asm/ptrace.h> | ||
14 | #include <asm/system.h> | ||
15 | |||
16 | #include "op_impl.h" | ||
17 | |||
18 | |||
19 | /* Compute all of the registers in preparation for enabling profiling. */ | ||
20 | |||
21 | static void | ||
22 | ev6_reg_setup(struct op_register_config *reg, | ||
23 | struct op_counter_config *ctr, | ||
24 | struct op_system_config *sys) | ||
25 | { | ||
26 | unsigned long ctl, reset, need_reset, i; | ||
27 | |||
28 | /* Select desired events. We've mapped the event numbers | ||
29 | such that they fit directly into the event selection fields. */ | ||
30 | ctl = 0; | ||
31 | if (ctr[0].enabled && ctr[0].event) | ||
32 | ctl |= (ctr[0].event & 1) << 4; | ||
33 | if (ctr[1].enabled) | ||
34 | ctl |= (ctr[1].event - 2) & 15; | ||
35 | reg->mux_select = ctl; | ||
36 | |||
37 | /* Select logging options. */ | ||
38 | /* ??? Need to come up with some mechanism to trace only | ||
39 | selected processes. EV6 does not have a mechanism to | ||
40 | select kernel or user mode only. For now, enable always. */ | ||
41 | reg->proc_mode = 0; | ||
42 | |||
43 | /* EV6 cannot change the width of the counters as with the | ||
44 | other implementations. But fortunately, we can write to | ||
45 | the counters and set the value such that it will overflow | ||
46 | at the right time. */ | ||
47 | reset = need_reset = 0; | ||
48 | for (i = 0; i < 2; ++i) { | ||
49 | unsigned long count = ctr[i].count; | ||
50 | if (!ctr[i].enabled) | ||
51 | continue; | ||
52 | |||
53 | if (count > 0x100000) | ||
54 | count = 0x100000; | ||
55 | ctr[i].count = count; | ||
56 | reset |= (0x100000 - count) << (i ? 6 : 28); | ||
57 | if (count != 0x100000) | ||
58 | need_reset |= 1 << i; | ||
59 | } | ||
60 | reg->reset_values = reset; | ||
61 | reg->need_reset = need_reset; | ||
62 | } | ||
63 | |||
64 | /* Program all of the registers in preparation for enabling profiling. */ | ||
65 | |||
66 | static void | ||
67 | ev6_cpu_setup (void *x) | ||
68 | { | ||
69 | struct op_register_config *reg = x; | ||
70 | |||
71 | wrperfmon(2, reg->mux_select); | ||
72 | wrperfmon(3, reg->proc_mode); | ||
73 | wrperfmon(6, reg->reset_values | 3); | ||
74 | } | ||
75 | |||
76 | /* CTR is a counter for which the user has requested an interrupt count | ||
77 | in between one of the widths selectable in hardware. Reset the count | ||
78 | for CTR to the value stored in REG->RESET_VALUES. */ | ||
79 | |||
80 | static void | ||
81 | ev6_reset_ctr(struct op_register_config *reg, unsigned long ctr) | ||
82 | { | ||
83 | wrperfmon(6, reg->reset_values | (1 << ctr)); | ||
84 | } | ||
85 | |||
86 | static void | ||
87 | ev6_handle_interrupt(unsigned long which, struct pt_regs *regs, | ||
88 | struct op_counter_config *ctr) | ||
89 | { | ||
90 | /* Record the sample. */ | ||
91 | oprofile_add_sample(regs, which); | ||
92 | } | ||
93 | |||
94 | |||
95 | struct op_axp_model op_model_ev6 = { | ||
96 | .reg_setup = ev6_reg_setup, | ||
97 | .cpu_setup = ev6_cpu_setup, | ||
98 | .reset_ctr = ev6_reset_ctr, | ||
99 | .handle_interrupt = ev6_handle_interrupt, | ||
100 | .cpu_type = "alpha/ev6", | ||
101 | .num_counters = 2, | ||
102 | .can_set_proc_mode = 0, | ||
103 | }; | ||