diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2005-02-22 16:51:30 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2005-10-29 14:30:44 -0400 |
commit | 65bda1a95d395c256818d1d8129487a4497b29d8 (patch) | |
tree | 57bea8a2593b17b987cbc188ecf07c341fda5dbc /arch/mips/sibyte/sb1250/bcm1250_tbprof.c | |
parent | 4912ba72d6e27d0f19ec062ffd00a8c0165a2f67 (diff) |
Switch SiByte drivers back to __raw_*() functions.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/sibyte/sb1250/bcm1250_tbprof.c')
-rw-r--r-- | arch/mips/sibyte/sb1250/bcm1250_tbprof.c | 130 |
1 files changed, 68 insertions, 62 deletions
diff --git a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c index dba3d0872e7e..e4dfeb52dcec 100644 --- a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c +++ b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c | |||
@@ -65,24 +65,25 @@ static void arm_tb(void) | |||
65 | u_int64_t tb_options = M_SCD_TRACE_CFG_FREEZE_FULL; | 65 | u_int64_t tb_options = M_SCD_TRACE_CFG_FREEZE_FULL; |
66 | /* Generate an SCD_PERFCNT interrupt in TB_PERIOD Zclks to | 66 | /* Generate an SCD_PERFCNT interrupt in TB_PERIOD Zclks to |
67 | trigger start of trace. XXX vary sampling period */ | 67 | trigger start of trace. XXX vary sampling period */ |
68 | bus_writeq(0, IOADDR(A_SCD_PERF_CNT_1)); | 68 | __raw_writeq(0, IOADDR(A_SCD_PERF_CNT_1)); |
69 | scdperfcnt = bus_readq(IOADDR(A_SCD_PERF_CNT_CFG)); | 69 | scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG)); |
70 | /* Unfortunately, in Pass 2 we must clear all counters to knock down | 70 | /* Unfortunately, in Pass 2 we must clear all counters to knock down |
71 | a previous interrupt request. This means that bus profiling | 71 | a previous interrupt request. This means that bus profiling |
72 | requires ALL of the SCD perf counters. */ | 72 | requires ALL of the SCD perf counters. */ |
73 | bus_writeq((scdperfcnt & ~M_SPC_CFG_SRC1) | // keep counters 0,2,3 as is | 73 | __raw_writeq((scdperfcnt & ~M_SPC_CFG_SRC1) | |
74 | M_SPC_CFG_ENABLE | // enable counting | 74 | // keep counters 0,2,3 as is |
75 | M_SPC_CFG_CLEAR | // clear all counters | 75 | M_SPC_CFG_ENABLE | // enable counting |
76 | V_SPC_CFG_SRC1(1), // counter 1 counts cycles | 76 | M_SPC_CFG_CLEAR | // clear all counters |
77 | IOADDR(A_SCD_PERF_CNT_CFG)); | 77 | V_SPC_CFG_SRC1(1), // counter 1 counts cycles |
78 | bus_writeq(next, IOADDR(A_SCD_PERF_CNT_1)); | 78 | IOADDR(A_SCD_PERF_CNT_CFG)); |
79 | __raw_writeq(next, IOADDR(A_SCD_PERF_CNT_1)); | ||
79 | /* Reset the trace buffer */ | 80 | /* Reset the trace buffer */ |
80 | bus_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG)); | 81 | __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG)); |
81 | #if 0 && defined(M_SCD_TRACE_CFG_FORCECNT) | 82 | #if 0 && defined(M_SCD_TRACE_CFG_FORCECNT) |
82 | /* XXXKW may want to expose control to the data-collector */ | 83 | /* XXXKW may want to expose control to the data-collector */ |
83 | tb_options |= M_SCD_TRACE_CFG_FORCECNT; | 84 | tb_options |= M_SCD_TRACE_CFG_FORCECNT; |
84 | #endif | 85 | #endif |
85 | bus_writeq(tb_options, IOADDR(A_SCD_TRACE_CFG)); | 86 | __raw_writeq(tb_options, IOADDR(A_SCD_TRACE_CFG)); |
86 | sbp.tb_armed = 1; | 87 | sbp.tb_armed = 1; |
87 | } | 88 | } |
88 | 89 | ||
@@ -94,23 +95,30 @@ static irqreturn_t sbprof_tb_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
94 | /* XXX should use XKPHYS to make writes bypass L2 */ | 95 | /* XXX should use XKPHYS to make writes bypass L2 */ |
95 | u_int64_t *p = sbp.sbprof_tbbuf[sbp.next_tb_sample++]; | 96 | u_int64_t *p = sbp.sbprof_tbbuf[sbp.next_tb_sample++]; |
96 | /* Read out trace */ | 97 | /* Read out trace */ |
97 | bus_writeq(M_SCD_TRACE_CFG_START_READ, IOADDR(A_SCD_TRACE_CFG)); | 98 | __raw_writeq(M_SCD_TRACE_CFG_START_READ, |
99 | IOADDR(A_SCD_TRACE_CFG)); | ||
98 | __asm__ __volatile__ ("sync" : : : "memory"); | 100 | __asm__ __volatile__ ("sync" : : : "memory"); |
99 | /* Loop runs backwards because bundles are read out in reverse order */ | 101 | /* Loop runs backwards because bundles are read out in reverse order */ |
100 | for (i = 256 * 6; i > 0; i -= 6) { | 102 | for (i = 256 * 6; i > 0; i -= 6) { |
101 | // Subscripts decrease to put bundle in the order | 103 | // Subscripts decrease to put bundle in the order |
102 | // t0 lo, t0 hi, t1 lo, t1 hi, t2 lo, t2 hi | 104 | // t0 lo, t0 hi, t1 lo, t1 hi, t2 lo, t2 hi |
103 | p[i-1] = bus_readq(IOADDR(A_SCD_TRACE_READ)); // read t2 hi | 105 | p[i - 1] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); |
104 | p[i-2] = bus_readq(IOADDR(A_SCD_TRACE_READ)); // read t2 lo | 106 | // read t2 hi |
105 | p[i-3] = bus_readq(IOADDR(A_SCD_TRACE_READ)); // read t1 hi | 107 | p[i - 2] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); |
106 | p[i-4] = bus_readq(IOADDR(A_SCD_TRACE_READ)); // read t1 lo | 108 | // read t2 lo |
107 | p[i-5] = bus_readq(IOADDR(A_SCD_TRACE_READ)); // read t0 hi | 109 | p[i - 3] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); |
108 | p[i-6] = bus_readq(IOADDR(A_SCD_TRACE_READ)); // read t0 lo | 110 | // read t1 hi |
111 | p[i - 4] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); | ||
112 | // read t1 lo | ||
113 | p[i - 5] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); | ||
114 | // read t0 hi | ||
115 | p[i - 6] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); | ||
116 | // read t0 lo | ||
109 | } | 117 | } |
110 | if (!sbp.tb_enable) { | 118 | if (!sbp.tb_enable) { |
111 | DBG(printk(DEVNAME ": tb_intr shutdown\n")); | 119 | DBG(printk(DEVNAME ": tb_intr shutdown\n")); |
112 | bus_writeq(M_SCD_TRACE_CFG_RESET, | 120 | __raw_writeq(M_SCD_TRACE_CFG_RESET, |
113 | IOADDR(A_SCD_TRACE_CFG)); | 121 | IOADDR(A_SCD_TRACE_CFG)); |
114 | sbp.tb_armed = 0; | 122 | sbp.tb_armed = 0; |
115 | wake_up(&sbp.tb_sync); | 123 | wake_up(&sbp.tb_sync); |
116 | } else { | 124 | } else { |
@@ -119,7 +127,7 @@ static irqreturn_t sbprof_tb_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
119 | } else { | 127 | } else { |
120 | /* No more trace buffer samples */ | 128 | /* No more trace buffer samples */ |
121 | DBG(printk(DEVNAME ": tb_intr full\n")); | 129 | DBG(printk(DEVNAME ": tb_intr full\n")); |
122 | bus_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG)); | 130 | __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG)); |
123 | sbp.tb_armed = 0; | 131 | sbp.tb_armed = 0; |
124 | if (!sbp.tb_enable) { | 132 | if (!sbp.tb_enable) { |
125 | wake_up(&sbp.tb_sync); | 133 | wake_up(&sbp.tb_sync); |
@@ -153,13 +161,11 @@ int sbprof_zbprof_start(struct file *filp) | |||
153 | return -EBUSY; | 161 | return -EBUSY; |
154 | } | 162 | } |
155 | /* Make sure there isn't a perf-cnt interrupt waiting */ | 163 | /* Make sure there isn't a perf-cnt interrupt waiting */ |
156 | scdperfcnt = bus_readq(IOADDR(A_SCD_PERF_CNT_CFG)); | 164 | scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG)); |
157 | /* Disable and clear counters, override SRC_1 */ | 165 | /* Disable and clear counters, override SRC_1 */ |
158 | bus_writeq((scdperfcnt & ~(M_SPC_CFG_SRC1 | M_SPC_CFG_ENABLE)) | | 166 | __raw_writeq((scdperfcnt & ~(M_SPC_CFG_SRC1 | M_SPC_CFG_ENABLE)) | |
159 | M_SPC_CFG_ENABLE | | 167 | M_SPC_CFG_ENABLE | M_SPC_CFG_CLEAR | V_SPC_CFG_SRC1(1), |
160 | M_SPC_CFG_CLEAR | | 168 | IOADDR(A_SCD_PERF_CNT_CFG)); |
161 | V_SPC_CFG_SRC1(1), | ||
162 | IOADDR(A_SCD_PERF_CNT_CFG)); | ||
163 | 169 | ||
164 | /* We grab this interrupt to prevent others from trying to use | 170 | /* We grab this interrupt to prevent others from trying to use |
165 | it, even though we don't want to service the interrupts | 171 | it, even though we don't want to service the interrupts |
@@ -173,55 +179,55 @@ int sbprof_zbprof_start(struct file *filp) | |||
173 | /* I need the core to mask these, but the interrupt mapper to | 179 | /* I need the core to mask these, but the interrupt mapper to |
174 | pass them through. I am exploiting my knowledge that | 180 | pass them through. I am exploiting my knowledge that |
175 | cp0_status masks out IP[5]. krw */ | 181 | cp0_status masks out IP[5]. krw */ |
176 | bus_writeq(K_INT_MAP_I3, | 182 | __raw_writeq(K_INT_MAP_I3, |
177 | IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MAP_BASE) + | 183 | IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MAP_BASE) + |
178 | (K_INT_PERF_CNT << 3))); | 184 | (K_INT_PERF_CNT << 3))); |
179 | 185 | ||
180 | /* Initialize address traps */ | 186 | /* Initialize address traps */ |
181 | bus_writeq(0, IOADDR(A_ADDR_TRAP_UP_0)); | 187 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_UP_0)); |
182 | bus_writeq(0, IOADDR(A_ADDR_TRAP_UP_1)); | 188 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_UP_1)); |
183 | bus_writeq(0, IOADDR(A_ADDR_TRAP_UP_2)); | 189 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_UP_2)); |
184 | bus_writeq(0, IOADDR(A_ADDR_TRAP_UP_3)); | 190 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_UP_3)); |
185 | 191 | ||
186 | bus_writeq(0, IOADDR(A_ADDR_TRAP_DOWN_0)); | 192 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_DOWN_0)); |
187 | bus_writeq(0, IOADDR(A_ADDR_TRAP_DOWN_1)); | 193 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_DOWN_1)); |
188 | bus_writeq(0, IOADDR(A_ADDR_TRAP_DOWN_2)); | 194 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_DOWN_2)); |
189 | bus_writeq(0, IOADDR(A_ADDR_TRAP_DOWN_3)); | 195 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_DOWN_3)); |
190 | 196 | ||
191 | bus_writeq(0, IOADDR(A_ADDR_TRAP_CFG_0)); | 197 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_CFG_0)); |
192 | bus_writeq(0, IOADDR(A_ADDR_TRAP_CFG_1)); | 198 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_CFG_1)); |
193 | bus_writeq(0, IOADDR(A_ADDR_TRAP_CFG_2)); | 199 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_CFG_2)); |
194 | bus_writeq(0, IOADDR(A_ADDR_TRAP_CFG_3)); | 200 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_CFG_3)); |
195 | 201 | ||
196 | /* Initialize Trace Event 0-7 */ | 202 | /* Initialize Trace Event 0-7 */ |
197 | // when interrupt | 203 | // when interrupt |
198 | bus_writeq(M_SCD_TREVT_INTERRUPT, IOADDR(A_SCD_TRACE_EVENT_0)); | 204 | __raw_writeq(M_SCD_TREVT_INTERRUPT, IOADDR(A_SCD_TRACE_EVENT_0)); |
199 | bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_1)); | 205 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_1)); |
200 | bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_2)); | 206 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_2)); |
201 | bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_3)); | 207 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_3)); |
202 | bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_4)); | 208 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_4)); |
203 | bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_5)); | 209 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_5)); |
204 | bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_6)); | 210 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_6)); |
205 | bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_7)); | 211 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_7)); |
206 | 212 | ||
207 | /* Initialize Trace Sequence 0-7 */ | 213 | /* Initialize Trace Sequence 0-7 */ |
208 | // Start on event 0 (interrupt) | 214 | // Start on event 0 (interrupt) |
209 | bus_writeq(V_SCD_TRSEQ_FUNC_START | 0x0fff, | 215 | __raw_writeq(V_SCD_TRSEQ_FUNC_START | 0x0fff, |
210 | IOADDR(A_SCD_TRACE_SEQUENCE_0)); | 216 | IOADDR(A_SCD_TRACE_SEQUENCE_0)); |
211 | // dsamp when d used | asamp when a used | 217 | // dsamp when d used | asamp when a used |
212 | bus_writeq(M_SCD_TRSEQ_ASAMPLE | M_SCD_TRSEQ_DSAMPLE | | 218 | __raw_writeq(M_SCD_TRSEQ_ASAMPLE | M_SCD_TRSEQ_DSAMPLE | |
213 | K_SCD_TRSEQ_TRIGGER_ALL, | 219 | K_SCD_TRSEQ_TRIGGER_ALL, |
214 | IOADDR(A_SCD_TRACE_SEQUENCE_1)); | 220 | IOADDR(A_SCD_TRACE_SEQUENCE_1)); |
215 | bus_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_2)); | 221 | __raw_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_2)); |
216 | bus_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_3)); | 222 | __raw_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_3)); |
217 | bus_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_4)); | 223 | __raw_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_4)); |
218 | bus_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_5)); | 224 | __raw_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_5)); |
219 | bus_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_6)); | 225 | __raw_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_6)); |
220 | bus_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_7)); | 226 | __raw_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_7)); |
221 | 227 | ||
222 | /* Now indicate the PERF_CNT interrupt as a trace-relevant interrupt */ | 228 | /* Now indicate the PERF_CNT interrupt as a trace-relevant interrupt */ |
223 | bus_writeq((1ULL << K_INT_PERF_CNT), | 229 | __raw_writeq(1ULL << K_INT_PERF_CNT, |
224 | IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_TRACE))); | 230 | IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_TRACE))); |
225 | 231 | ||
226 | arm_tb(); | 232 | arm_tb(); |
227 | 233 | ||