2 * Copyright(C) 2015 Linaro Limited. All rights reserved.
3 * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <linux/pm_runtime.h>
19 #include <linux/sysfs.h>
20 #include "coresight-etm4x.h"
22 static int etm4_set_mode_exclude(struct etmv4_drvdata
*drvdata
, bool exclude
)
25 struct etmv4_config
*config
= &drvdata
->config
;
27 idx
= config
->addr_idx
;
30 * TRCACATRn.TYPE bit[1:0]: type of comparison
31 * the trace unit performs
33 if (BMVAL(config
->addr_acc
[idx
], 0, 1) == ETM_INSTR_ADDR
) {
38 * We are performing instruction address comparison. Set the
39 * relevant bit of ViewInst Include/Exclude Control register
40 * for corresponding address comparator pair.
42 if (config
->addr_type
[idx
] != ETM_ADDR_TYPE_RANGE
||
43 config
->addr_type
[idx
+ 1] != ETM_ADDR_TYPE_RANGE
)
46 if (exclude
== true) {
48 * Set exclude bit and unset the include bit
49 * corresponding to comparator pair
51 config
->viiectlr
|= BIT(idx
/ 2 + 16);
52 config
->viiectlr
&= ~BIT(idx
/ 2);
55 * Set include bit and unset exclude bit
56 * corresponding to comparator pair
58 config
->viiectlr
|= BIT(idx
/ 2);
59 config
->viiectlr
&= ~BIT(idx
/ 2 + 16);
65 static ssize_t
nr_pe_cmp_show(struct device
*dev
,
66 struct device_attribute
*attr
,
70 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
72 val
= drvdata
->nr_pe_cmp
;
73 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
75 static DEVICE_ATTR_RO(nr_pe_cmp
);
77 static ssize_t
nr_addr_cmp_show(struct device
*dev
,
78 struct device_attribute
*attr
,
82 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
84 val
= drvdata
->nr_addr_cmp
;
85 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
87 static DEVICE_ATTR_RO(nr_addr_cmp
);
89 static ssize_t
nr_cntr_show(struct device
*dev
,
90 struct device_attribute
*attr
,
94 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
96 val
= drvdata
->nr_cntr
;
97 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
99 static DEVICE_ATTR_RO(nr_cntr
);
101 static ssize_t
nr_ext_inp_show(struct device
*dev
,
102 struct device_attribute
*attr
,
106 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
108 val
= drvdata
->nr_ext_inp
;
109 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
111 static DEVICE_ATTR_RO(nr_ext_inp
);
113 static ssize_t
numcidc_show(struct device
*dev
,
114 struct device_attribute
*attr
,
118 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
120 val
= drvdata
->numcidc
;
121 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
123 static DEVICE_ATTR_RO(numcidc
);
125 static ssize_t
numvmidc_show(struct device
*dev
,
126 struct device_attribute
*attr
,
130 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
132 val
= drvdata
->numvmidc
;
133 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
135 static DEVICE_ATTR_RO(numvmidc
);
137 static ssize_t
nrseqstate_show(struct device
*dev
,
138 struct device_attribute
*attr
,
142 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
144 val
= drvdata
->nrseqstate
;
145 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
147 static DEVICE_ATTR_RO(nrseqstate
);
149 static ssize_t
nr_resource_show(struct device
*dev
,
150 struct device_attribute
*attr
,
154 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
156 val
= drvdata
->nr_resource
;
157 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
159 static DEVICE_ATTR_RO(nr_resource
);
161 static ssize_t
nr_ss_cmp_show(struct device
*dev
,
162 struct device_attribute
*attr
,
166 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
168 val
= drvdata
->nr_ss_cmp
;
169 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
171 static DEVICE_ATTR_RO(nr_ss_cmp
);
173 static ssize_t
reset_store(struct device
*dev
,
174 struct device_attribute
*attr
,
175 const char *buf
, size_t size
)
179 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
180 struct etmv4_config
*config
= &drvdata
->config
;
182 if (kstrtoul(buf
, 16, &val
))
185 spin_lock(&drvdata
->spinlock
);
189 /* Disable data tracing: do not trace load and store data transfers */
190 config
->mode
&= ~(ETM_MODE_LOAD
| ETM_MODE_STORE
);
191 config
->cfg
&= ~(BIT(1) | BIT(2));
193 /* Disable data value and data address tracing */
194 config
->mode
&= ~(ETM_MODE_DATA_TRACE_ADDR
|
195 ETM_MODE_DATA_TRACE_VAL
);
196 config
->cfg
&= ~(BIT(16) | BIT(17));
198 /* Disable all events tracing */
199 config
->eventctrl0
= 0x0;
200 config
->eventctrl1
= 0x0;
202 /* Disable timestamp event */
203 config
->ts_ctrl
= 0x0;
205 /* Disable stalling */
206 config
->stall_ctrl
= 0x0;
208 /* Reset trace synchronization period to 2^8 = 256 bytes*/
209 if (drvdata
->syncpr
== false)
210 config
->syncfreq
= 0x8;
213 * Enable ViewInst to trace everything with start-stop logic in
214 * started state. ARM recommends start-stop logic is set before
217 config
->vinst_ctrl
|= BIT(0);
218 if (drvdata
->nr_addr_cmp
== true) {
219 config
->mode
|= ETM_MODE_VIEWINST_STARTSTOP
;
220 /* SSSTATUS, bit[9] */
221 config
->vinst_ctrl
|= BIT(9);
224 /* No address range filtering for ViewInst */
225 config
->viiectlr
= 0x0;
227 /* No start-stop filtering for ViewInst */
228 config
->vissctlr
= 0x0;
230 /* Disable seq events */
231 for (i
= 0; i
< drvdata
->nrseqstate
-1; i
++)
232 config
->seq_ctrl
[i
] = 0x0;
233 config
->seq_rst
= 0x0;
234 config
->seq_state
= 0x0;
236 /* Disable external input events */
237 config
->ext_inp
= 0x0;
239 config
->cntr_idx
= 0x0;
240 for (i
= 0; i
< drvdata
->nr_cntr
; i
++) {
241 config
->cntrldvr
[i
] = 0x0;
242 config
->cntr_ctrl
[i
] = 0x0;
243 config
->cntr_val
[i
] = 0x0;
246 config
->res_idx
= 0x0;
247 for (i
= 0; i
< drvdata
->nr_resource
; i
++)
248 config
->res_ctrl
[i
] = 0x0;
250 for (i
= 0; i
< drvdata
->nr_ss_cmp
; i
++) {
251 config
->ss_ctrl
[i
] = 0x0;
252 config
->ss_pe_cmp
[i
] = 0x0;
255 config
->addr_idx
= 0x0;
256 for (i
= 0; i
< drvdata
->nr_addr_cmp
* 2; i
++) {
257 config
->addr_val
[i
] = 0x0;
258 config
->addr_acc
[i
] = 0x0;
259 config
->addr_type
[i
] = ETM_ADDR_TYPE_NONE
;
262 config
->ctxid_idx
= 0x0;
263 for (i
= 0; i
< drvdata
->numcidc
; i
++) {
264 config
->ctxid_pid
[i
] = 0x0;
265 config
->ctxid_vpid
[i
] = 0x0;
268 config
->ctxid_mask0
= 0x0;
269 config
->ctxid_mask1
= 0x0;
271 config
->vmid_idx
= 0x0;
272 for (i
= 0; i
< drvdata
->numvmidc
; i
++)
273 config
->vmid_val
[i
] = 0x0;
274 config
->vmid_mask0
= 0x0;
275 config
->vmid_mask1
= 0x0;
277 drvdata
->trcid
= drvdata
->cpu
+ 1;
279 spin_unlock(&drvdata
->spinlock
);
283 static DEVICE_ATTR_WO(reset
);
285 static ssize_t
mode_show(struct device
*dev
,
286 struct device_attribute
*attr
,
290 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
291 struct etmv4_config
*config
= &drvdata
->config
;
294 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
297 static ssize_t
mode_store(struct device
*dev
,
298 struct device_attribute
*attr
,
299 const char *buf
, size_t size
)
301 unsigned long val
, mode
;
302 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
303 struct etmv4_config
*config
= &drvdata
->config
;
305 if (kstrtoul(buf
, 16, &val
))
308 spin_lock(&drvdata
->spinlock
);
309 config
->mode
= val
& ETMv4_MODE_ALL
;
311 if (config
->mode
& ETM_MODE_EXCLUDE
)
312 etm4_set_mode_exclude(drvdata
, true);
314 etm4_set_mode_exclude(drvdata
, false);
316 if (drvdata
->instrp0
== true) {
317 /* start by clearing instruction P0 field */
318 config
->cfg
&= ~(BIT(1) | BIT(2));
319 if (config
->mode
& ETM_MODE_LOAD
)
320 /* 0b01 Trace load instructions as P0 instructions */
321 config
->cfg
|= BIT(1);
322 if (config
->mode
& ETM_MODE_STORE
)
323 /* 0b10 Trace store instructions as P0 instructions */
324 config
->cfg
|= BIT(2);
325 if (config
->mode
& ETM_MODE_LOAD_STORE
)
327 * 0b11 Trace load and store instructions
330 config
->cfg
|= BIT(1) | BIT(2);
333 /* bit[3], Branch broadcast mode */
334 if ((config
->mode
& ETM_MODE_BB
) && (drvdata
->trcbb
== true))
335 config
->cfg
|= BIT(3);
337 config
->cfg
&= ~BIT(3);
339 /* bit[4], Cycle counting instruction trace bit */
340 if ((config
->mode
& ETMv4_MODE_CYCACC
) &&
341 (drvdata
->trccci
== true))
342 config
->cfg
|= BIT(4);
344 config
->cfg
&= ~BIT(4);
346 /* bit[6], Context ID tracing bit */
347 if ((config
->mode
& ETMv4_MODE_CTXID
) && (drvdata
->ctxid_size
))
348 config
->cfg
|= BIT(6);
350 config
->cfg
&= ~BIT(6);
352 if ((config
->mode
& ETM_MODE_VMID
) && (drvdata
->vmid_size
))
353 config
->cfg
|= BIT(7);
355 config
->cfg
&= ~BIT(7);
357 /* bits[10:8], Conditional instruction tracing bit */
358 mode
= ETM_MODE_COND(config
->mode
);
359 if (drvdata
->trccond
== true) {
360 config
->cfg
&= ~(BIT(8) | BIT(9) | BIT(10));
361 config
->cfg
|= mode
<< 8;
364 /* bit[11], Global timestamp tracing bit */
365 if ((config
->mode
& ETMv4_MODE_TIMESTAMP
) && (drvdata
->ts_size
))
366 config
->cfg
|= BIT(11);
368 config
->cfg
&= ~BIT(11);
370 /* bit[12], Return stack enable bit */
371 if ((config
->mode
& ETM_MODE_RETURNSTACK
) &&
372 (drvdata
->retstack
== true))
373 config
->cfg
|= BIT(12);
375 config
->cfg
&= ~BIT(12);
377 /* bits[14:13], Q element enable field */
378 mode
= ETM_MODE_QELEM(config
->mode
);
379 /* start by clearing QE bits */
380 config
->cfg
&= ~(BIT(13) | BIT(14));
381 /* if supported, Q elements with instruction counts are enabled */
382 if ((mode
& BIT(0)) && (drvdata
->q_support
& BIT(0)))
383 config
->cfg
|= BIT(13);
385 * if supported, Q elements with and without instruction
388 if ((mode
& BIT(1)) && (drvdata
->q_support
& BIT(1)))
389 config
->cfg
|= BIT(14);
391 /* bit[11], AMBA Trace Bus (ATB) trigger enable bit */
392 if ((config
->mode
& ETM_MODE_ATB_TRIGGER
) &&
393 (drvdata
->atbtrig
== true))
394 config
->eventctrl1
|= BIT(11);
396 config
->eventctrl1
&= ~BIT(11);
398 /* bit[12], Low-power state behavior override bit */
399 if ((config
->mode
& ETM_MODE_LPOVERRIDE
) &&
400 (drvdata
->lpoverride
== true))
401 config
->eventctrl1
|= BIT(12);
403 config
->eventctrl1
&= ~BIT(12);
405 /* bit[8], Instruction stall bit */
406 if (config
->mode
& ETM_MODE_ISTALL_EN
)
407 config
->stall_ctrl
|= BIT(8);
409 config
->stall_ctrl
&= ~BIT(8);
411 /* bit[10], Prioritize instruction trace bit */
412 if (config
->mode
& ETM_MODE_INSTPRIO
)
413 config
->stall_ctrl
|= BIT(10);
415 config
->stall_ctrl
&= ~BIT(10);
417 /* bit[13], Trace overflow prevention bit */
418 if ((config
->mode
& ETM_MODE_NOOVERFLOW
) &&
419 (drvdata
->nooverflow
== true))
420 config
->stall_ctrl
|= BIT(13);
422 config
->stall_ctrl
&= ~BIT(13);
424 /* bit[9] Start/stop logic control bit */
425 if (config
->mode
& ETM_MODE_VIEWINST_STARTSTOP
)
426 config
->vinst_ctrl
|= BIT(9);
428 config
->vinst_ctrl
&= ~BIT(9);
430 /* bit[10], Whether a trace unit must trace a Reset exception */
431 if (config
->mode
& ETM_MODE_TRACE_RESET
)
432 config
->vinst_ctrl
|= BIT(10);
434 config
->vinst_ctrl
&= ~BIT(10);
436 /* bit[11], Whether a trace unit must trace a system error exception */
437 if ((config
->mode
& ETM_MODE_TRACE_ERR
) &&
438 (drvdata
->trc_error
== true))
439 config
->vinst_ctrl
|= BIT(11);
441 config
->vinst_ctrl
&= ~BIT(11);
443 if (config
->mode
& (ETM_MODE_EXCL_KERN
| ETM_MODE_EXCL_USER
))
444 etm4_config_trace_mode(config
);
446 spin_unlock(&drvdata
->spinlock
);
450 static DEVICE_ATTR_RW(mode
);
452 static ssize_t
pe_show(struct device
*dev
,
453 struct device_attribute
*attr
,
457 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
458 struct etmv4_config
*config
= &drvdata
->config
;
460 val
= config
->pe_sel
;
461 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
464 static ssize_t
pe_store(struct device
*dev
,
465 struct device_attribute
*attr
,
466 const char *buf
, size_t size
)
469 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
470 struct etmv4_config
*config
= &drvdata
->config
;
472 if (kstrtoul(buf
, 16, &val
))
475 spin_lock(&drvdata
->spinlock
);
476 if (val
> drvdata
->nr_pe
) {
477 spin_unlock(&drvdata
->spinlock
);
481 config
->pe_sel
= val
;
482 spin_unlock(&drvdata
->spinlock
);
485 static DEVICE_ATTR_RW(pe
);
487 static ssize_t
event_show(struct device
*dev
,
488 struct device_attribute
*attr
,
492 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
493 struct etmv4_config
*config
= &drvdata
->config
;
495 val
= config
->eventctrl0
;
496 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
499 static ssize_t
event_store(struct device
*dev
,
500 struct device_attribute
*attr
,
501 const char *buf
, size_t size
)
504 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
505 struct etmv4_config
*config
= &drvdata
->config
;
507 if (kstrtoul(buf
, 16, &val
))
510 spin_lock(&drvdata
->spinlock
);
511 switch (drvdata
->nr_event
) {
513 /* EVENT0, bits[7:0] */
514 config
->eventctrl0
= val
& 0xFF;
517 /* EVENT1, bits[15:8] */
518 config
->eventctrl0
= val
& 0xFFFF;
521 /* EVENT2, bits[23:16] */
522 config
->eventctrl0
= val
& 0xFFFFFF;
525 /* EVENT3, bits[31:24] */
526 config
->eventctrl0
= val
;
531 spin_unlock(&drvdata
->spinlock
);
534 static DEVICE_ATTR_RW(event
);
536 static ssize_t
event_instren_show(struct device
*dev
,
537 struct device_attribute
*attr
,
541 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
542 struct etmv4_config
*config
= &drvdata
->config
;
544 val
= BMVAL(config
->eventctrl1
, 0, 3);
545 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
548 static ssize_t
event_instren_store(struct device
*dev
,
549 struct device_attribute
*attr
,
550 const char *buf
, size_t size
)
553 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
554 struct etmv4_config
*config
= &drvdata
->config
;
556 if (kstrtoul(buf
, 16, &val
))
559 spin_lock(&drvdata
->spinlock
);
560 /* start by clearing all instruction event enable bits */
561 config
->eventctrl1
&= ~(BIT(0) | BIT(1) | BIT(2) | BIT(3));
562 switch (drvdata
->nr_event
) {
564 /* generate Event element for event 1 */
565 config
->eventctrl1
|= val
& BIT(1);
568 /* generate Event element for event 1 and 2 */
569 config
->eventctrl1
|= val
& (BIT(0) | BIT(1));
572 /* generate Event element for event 1, 2 and 3 */
573 config
->eventctrl1
|= val
& (BIT(0) | BIT(1) | BIT(2));
576 /* generate Event element for all 4 events */
577 config
->eventctrl1
|= val
& 0xF;
582 spin_unlock(&drvdata
->spinlock
);
585 static DEVICE_ATTR_RW(event_instren
);
587 static ssize_t
event_ts_show(struct device
*dev
,
588 struct device_attribute
*attr
,
592 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
593 struct etmv4_config
*config
= &drvdata
->config
;
595 val
= config
->ts_ctrl
;
596 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
599 static ssize_t
event_ts_store(struct device
*dev
,
600 struct device_attribute
*attr
,
601 const char *buf
, size_t size
)
604 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
605 struct etmv4_config
*config
= &drvdata
->config
;
607 if (kstrtoul(buf
, 16, &val
))
609 if (!drvdata
->ts_size
)
612 config
->ts_ctrl
= val
& ETMv4_EVENT_MASK
;
615 static DEVICE_ATTR_RW(event_ts
);
617 static ssize_t
syncfreq_show(struct device
*dev
,
618 struct device_attribute
*attr
,
622 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
623 struct etmv4_config
*config
= &drvdata
->config
;
625 val
= config
->syncfreq
;
626 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
629 static ssize_t
syncfreq_store(struct device
*dev
,
630 struct device_attribute
*attr
,
631 const char *buf
, size_t size
)
634 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
635 struct etmv4_config
*config
= &drvdata
->config
;
637 if (kstrtoul(buf
, 16, &val
))
639 if (drvdata
->syncpr
== true)
642 config
->syncfreq
= val
& ETMv4_SYNC_MASK
;
645 static DEVICE_ATTR_RW(syncfreq
);
647 static ssize_t
cyc_threshold_show(struct device
*dev
,
648 struct device_attribute
*attr
,
652 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
653 struct etmv4_config
*config
= &drvdata
->config
;
655 val
= config
->ccctlr
;
656 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
659 static ssize_t
cyc_threshold_store(struct device
*dev
,
660 struct device_attribute
*attr
,
661 const char *buf
, size_t size
)
664 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
665 struct etmv4_config
*config
= &drvdata
->config
;
667 if (kstrtoul(buf
, 16, &val
))
669 if (val
< drvdata
->ccitmin
)
672 config
->ccctlr
= val
& ETM_CYC_THRESHOLD_MASK
;
675 static DEVICE_ATTR_RW(cyc_threshold
);
677 static ssize_t
bb_ctrl_show(struct device
*dev
,
678 struct device_attribute
*attr
,
682 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
683 struct etmv4_config
*config
= &drvdata
->config
;
685 val
= config
->bb_ctrl
;
686 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
689 static ssize_t
bb_ctrl_store(struct device
*dev
,
690 struct device_attribute
*attr
,
691 const char *buf
, size_t size
)
694 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
695 struct etmv4_config
*config
= &drvdata
->config
;
697 if (kstrtoul(buf
, 16, &val
))
699 if (drvdata
->trcbb
== false)
701 if (!drvdata
->nr_addr_cmp
)
704 * Bit[7:0] selects which address range comparator is used for
705 * branch broadcast control.
707 if (BMVAL(val
, 0, 7) > drvdata
->nr_addr_cmp
)
710 config
->bb_ctrl
= val
;
713 static DEVICE_ATTR_RW(bb_ctrl
);
715 static ssize_t
event_vinst_show(struct device
*dev
,
716 struct device_attribute
*attr
,
720 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
721 struct etmv4_config
*config
= &drvdata
->config
;
723 val
= config
->vinst_ctrl
& ETMv4_EVENT_MASK
;
724 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
727 static ssize_t
event_vinst_store(struct device
*dev
,
728 struct device_attribute
*attr
,
729 const char *buf
, size_t size
)
732 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
733 struct etmv4_config
*config
= &drvdata
->config
;
735 if (kstrtoul(buf
, 16, &val
))
738 spin_lock(&drvdata
->spinlock
);
739 val
&= ETMv4_EVENT_MASK
;
740 config
->vinst_ctrl
&= ~ETMv4_EVENT_MASK
;
741 config
->vinst_ctrl
|= val
;
742 spin_unlock(&drvdata
->spinlock
);
745 static DEVICE_ATTR_RW(event_vinst
);
747 static ssize_t
s_exlevel_vinst_show(struct device
*dev
,
748 struct device_attribute
*attr
,
752 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
753 struct etmv4_config
*config
= &drvdata
->config
;
755 val
= BMVAL(config
->vinst_ctrl
, 16, 19);
756 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
759 static ssize_t
s_exlevel_vinst_store(struct device
*dev
,
760 struct device_attribute
*attr
,
761 const char *buf
, size_t size
)
764 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
765 struct etmv4_config
*config
= &drvdata
->config
;
767 if (kstrtoul(buf
, 16, &val
))
770 spin_lock(&drvdata
->spinlock
);
771 /* clear all EXLEVEL_S bits (bit[18] is never implemented) */
772 config
->vinst_ctrl
&= ~(BIT(16) | BIT(17) | BIT(19));
773 /* enable instruction tracing for corresponding exception level */
774 val
&= drvdata
->s_ex_level
;
775 config
->vinst_ctrl
|= (val
<< 16);
776 spin_unlock(&drvdata
->spinlock
);
779 static DEVICE_ATTR_RW(s_exlevel_vinst
);
781 static ssize_t
ns_exlevel_vinst_show(struct device
*dev
,
782 struct device_attribute
*attr
,
786 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
787 struct etmv4_config
*config
= &drvdata
->config
;
789 /* EXLEVEL_NS, bits[23:20] */
790 val
= BMVAL(config
->vinst_ctrl
, 20, 23);
791 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
794 static ssize_t
ns_exlevel_vinst_store(struct device
*dev
,
795 struct device_attribute
*attr
,
796 const char *buf
, size_t size
)
799 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
800 struct etmv4_config
*config
= &drvdata
->config
;
802 if (kstrtoul(buf
, 16, &val
))
805 spin_lock(&drvdata
->spinlock
);
806 /* clear EXLEVEL_NS bits (bit[23] is never implemented */
807 config
->vinst_ctrl
&= ~(BIT(20) | BIT(21) | BIT(22));
808 /* enable instruction tracing for corresponding exception level */
809 val
&= drvdata
->ns_ex_level
;
810 config
->vinst_ctrl
|= (val
<< 20);
811 spin_unlock(&drvdata
->spinlock
);
814 static DEVICE_ATTR_RW(ns_exlevel_vinst
);
816 static ssize_t
addr_idx_show(struct device
*dev
,
817 struct device_attribute
*attr
,
821 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
822 struct etmv4_config
*config
= &drvdata
->config
;
824 val
= config
->addr_idx
;
825 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
828 static ssize_t
addr_idx_store(struct device
*dev
,
829 struct device_attribute
*attr
,
830 const char *buf
, size_t size
)
833 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
834 struct etmv4_config
*config
= &drvdata
->config
;
836 if (kstrtoul(buf
, 16, &val
))
838 if (val
>= drvdata
->nr_addr_cmp
* 2)
842 * Use spinlock to ensure index doesn't change while it gets
843 * dereferenced multiple times within a spinlock block elsewhere.
845 spin_lock(&drvdata
->spinlock
);
846 config
->addr_idx
= val
;
847 spin_unlock(&drvdata
->spinlock
);
850 static DEVICE_ATTR_RW(addr_idx
);
852 static ssize_t
addr_instdatatype_show(struct device
*dev
,
853 struct device_attribute
*attr
,
858 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
859 struct etmv4_config
*config
= &drvdata
->config
;
861 spin_lock(&drvdata
->spinlock
);
862 idx
= config
->addr_idx
;
863 val
= BMVAL(config
->addr_acc
[idx
], 0, 1);
864 len
= scnprintf(buf
, PAGE_SIZE
, "%s\n",
865 val
== ETM_INSTR_ADDR
? "instr" :
866 (val
== ETM_DATA_LOAD_ADDR
? "data_load" :
867 (val
== ETM_DATA_STORE_ADDR
? "data_store" :
868 "data_load_store")));
869 spin_unlock(&drvdata
->spinlock
);
873 static ssize_t
addr_instdatatype_store(struct device
*dev
,
874 struct device_attribute
*attr
,
875 const char *buf
, size_t size
)
879 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
880 struct etmv4_config
*config
= &drvdata
->config
;
882 if (strlen(buf
) >= 20)
884 if (sscanf(buf
, "%s", str
) != 1)
887 spin_lock(&drvdata
->spinlock
);
888 idx
= config
->addr_idx
;
889 if (!strcmp(str
, "instr"))
890 /* TYPE, bits[1:0] */
891 config
->addr_acc
[idx
] &= ~(BIT(0) | BIT(1));
893 spin_unlock(&drvdata
->spinlock
);
896 static DEVICE_ATTR_RW(addr_instdatatype
);
898 static ssize_t
addr_single_show(struct device
*dev
,
899 struct device_attribute
*attr
,
904 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
905 struct etmv4_config
*config
= &drvdata
->config
;
907 idx
= config
->addr_idx
;
908 spin_lock(&drvdata
->spinlock
);
909 if (!(config
->addr_type
[idx
] == ETM_ADDR_TYPE_NONE
||
910 config
->addr_type
[idx
] == ETM_ADDR_TYPE_SINGLE
)) {
911 spin_unlock(&drvdata
->spinlock
);
914 val
= (unsigned long)config
->addr_val
[idx
];
915 spin_unlock(&drvdata
->spinlock
);
916 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
919 static ssize_t
addr_single_store(struct device
*dev
,
920 struct device_attribute
*attr
,
921 const char *buf
, size_t size
)
925 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
926 struct etmv4_config
*config
= &drvdata
->config
;
928 if (kstrtoul(buf
, 16, &val
))
931 spin_lock(&drvdata
->spinlock
);
932 idx
= config
->addr_idx
;
933 if (!(config
->addr_type
[idx
] == ETM_ADDR_TYPE_NONE
||
934 config
->addr_type
[idx
] == ETM_ADDR_TYPE_SINGLE
)) {
935 spin_unlock(&drvdata
->spinlock
);
939 config
->addr_val
[idx
] = (u64
)val
;
940 config
->addr_type
[idx
] = ETM_ADDR_TYPE_SINGLE
;
941 spin_unlock(&drvdata
->spinlock
);
944 static DEVICE_ATTR_RW(addr_single
);
946 static ssize_t
addr_range_show(struct device
*dev
,
947 struct device_attribute
*attr
,
951 unsigned long val1
, val2
;
952 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
953 struct etmv4_config
*config
= &drvdata
->config
;
955 spin_lock(&drvdata
->spinlock
);
956 idx
= config
->addr_idx
;
958 spin_unlock(&drvdata
->spinlock
);
961 if (!((config
->addr_type
[idx
] == ETM_ADDR_TYPE_NONE
&&
962 config
->addr_type
[idx
+ 1] == ETM_ADDR_TYPE_NONE
) ||
963 (config
->addr_type
[idx
] == ETM_ADDR_TYPE_RANGE
&&
964 config
->addr_type
[idx
+ 1] == ETM_ADDR_TYPE_RANGE
))) {
965 spin_unlock(&drvdata
->spinlock
);
969 val1
= (unsigned long)config
->addr_val
[idx
];
970 val2
= (unsigned long)config
->addr_val
[idx
+ 1];
971 spin_unlock(&drvdata
->spinlock
);
972 return scnprintf(buf
, PAGE_SIZE
, "%#lx %#lx\n", val1
, val2
);
975 static ssize_t
addr_range_store(struct device
*dev
,
976 struct device_attribute
*attr
,
977 const char *buf
, size_t size
)
980 unsigned long val1
, val2
;
981 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
982 struct etmv4_config
*config
= &drvdata
->config
;
984 if (sscanf(buf
, "%lx %lx", &val1
, &val2
) != 2)
986 /* lower address comparator cannot have a higher address value */
990 spin_lock(&drvdata
->spinlock
);
991 idx
= config
->addr_idx
;
993 spin_unlock(&drvdata
->spinlock
);
997 if (!((config
->addr_type
[idx
] == ETM_ADDR_TYPE_NONE
&&
998 config
->addr_type
[idx
+ 1] == ETM_ADDR_TYPE_NONE
) ||
999 (config
->addr_type
[idx
] == ETM_ADDR_TYPE_RANGE
&&
1000 config
->addr_type
[idx
+ 1] == ETM_ADDR_TYPE_RANGE
))) {
1001 spin_unlock(&drvdata
->spinlock
);
1005 config
->addr_val
[idx
] = (u64
)val1
;
1006 config
->addr_type
[idx
] = ETM_ADDR_TYPE_RANGE
;
1007 config
->addr_val
[idx
+ 1] = (u64
)val2
;
1008 config
->addr_type
[idx
+ 1] = ETM_ADDR_TYPE_RANGE
;
1010 * Program include or exclude control bits for vinst or vdata
1011 * whenever we change addr comparators to ETM_ADDR_TYPE_RANGE
1013 if (config
->mode
& ETM_MODE_EXCLUDE
)
1014 etm4_set_mode_exclude(drvdata
, true);
1016 etm4_set_mode_exclude(drvdata
, false);
1018 spin_unlock(&drvdata
->spinlock
);
1021 static DEVICE_ATTR_RW(addr_range
);
1023 static ssize_t
addr_start_show(struct device
*dev
,
1024 struct device_attribute
*attr
,
1029 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1030 struct etmv4_config
*config
= &drvdata
->config
;
1032 spin_lock(&drvdata
->spinlock
);
1033 idx
= config
->addr_idx
;
1035 if (!(config
->addr_type
[idx
] == ETM_ADDR_TYPE_NONE
||
1036 config
->addr_type
[idx
] == ETM_ADDR_TYPE_START
)) {
1037 spin_unlock(&drvdata
->spinlock
);
1041 val
= (unsigned long)config
->addr_val
[idx
];
1042 spin_unlock(&drvdata
->spinlock
);
1043 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1046 static ssize_t
addr_start_store(struct device
*dev
,
1047 struct device_attribute
*attr
,
1048 const char *buf
, size_t size
)
1052 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1053 struct etmv4_config
*config
= &drvdata
->config
;
1055 if (kstrtoul(buf
, 16, &val
))
1058 spin_lock(&drvdata
->spinlock
);
1059 idx
= config
->addr_idx
;
1060 if (!drvdata
->nr_addr_cmp
) {
1061 spin_unlock(&drvdata
->spinlock
);
1064 if (!(config
->addr_type
[idx
] == ETM_ADDR_TYPE_NONE
||
1065 config
->addr_type
[idx
] == ETM_ADDR_TYPE_START
)) {
1066 spin_unlock(&drvdata
->spinlock
);
1070 config
->addr_val
[idx
] = (u64
)val
;
1071 config
->addr_type
[idx
] = ETM_ADDR_TYPE_START
;
1072 config
->vissctlr
|= BIT(idx
);
1073 /* SSSTATUS, bit[9] - turn on start/stop logic */
1074 config
->vinst_ctrl
|= BIT(9);
1075 spin_unlock(&drvdata
->spinlock
);
1078 static DEVICE_ATTR_RW(addr_start
);
1080 static ssize_t
addr_stop_show(struct device
*dev
,
1081 struct device_attribute
*attr
,
1086 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1087 struct etmv4_config
*config
= &drvdata
->config
;
1089 spin_lock(&drvdata
->spinlock
);
1090 idx
= config
->addr_idx
;
1092 if (!(config
->addr_type
[idx
] == ETM_ADDR_TYPE_NONE
||
1093 config
->addr_type
[idx
] == ETM_ADDR_TYPE_STOP
)) {
1094 spin_unlock(&drvdata
->spinlock
);
1098 val
= (unsigned long)config
->addr_val
[idx
];
1099 spin_unlock(&drvdata
->spinlock
);
1100 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1103 static ssize_t
addr_stop_store(struct device
*dev
,
1104 struct device_attribute
*attr
,
1105 const char *buf
, size_t size
)
1109 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1110 struct etmv4_config
*config
= &drvdata
->config
;
1112 if (kstrtoul(buf
, 16, &val
))
1115 spin_lock(&drvdata
->spinlock
);
1116 idx
= config
->addr_idx
;
1117 if (!drvdata
->nr_addr_cmp
) {
1118 spin_unlock(&drvdata
->spinlock
);
1121 if (!(config
->addr_type
[idx
] == ETM_ADDR_TYPE_NONE
||
1122 config
->addr_type
[idx
] == ETM_ADDR_TYPE_STOP
)) {
1123 spin_unlock(&drvdata
->spinlock
);
1127 config
->addr_val
[idx
] = (u64
)val
;
1128 config
->addr_type
[idx
] = ETM_ADDR_TYPE_STOP
;
1129 config
->vissctlr
|= BIT(idx
+ 16);
1130 /* SSSTATUS, bit[9] - turn on start/stop logic */
1131 config
->vinst_ctrl
|= BIT(9);
1132 spin_unlock(&drvdata
->spinlock
);
1135 static DEVICE_ATTR_RW(addr_stop
);
1137 static ssize_t
addr_ctxtype_show(struct device
*dev
,
1138 struct device_attribute
*attr
,
1143 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1144 struct etmv4_config
*config
= &drvdata
->config
;
1146 spin_lock(&drvdata
->spinlock
);
1147 idx
= config
->addr_idx
;
1148 /* CONTEXTTYPE, bits[3:2] */
1149 val
= BMVAL(config
->addr_acc
[idx
], 2, 3);
1150 len
= scnprintf(buf
, PAGE_SIZE
, "%s\n", val
== ETM_CTX_NONE
? "none" :
1151 (val
== ETM_CTX_CTXID
? "ctxid" :
1152 (val
== ETM_CTX_VMID
? "vmid" : "all")));
1153 spin_unlock(&drvdata
->spinlock
);
1157 static ssize_t
addr_ctxtype_store(struct device
*dev
,
1158 struct device_attribute
*attr
,
1159 const char *buf
, size_t size
)
1163 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1164 struct etmv4_config
*config
= &drvdata
->config
;
1166 if (strlen(buf
) >= 10)
1168 if (sscanf(buf
, "%s", str
) != 1)
1171 spin_lock(&drvdata
->spinlock
);
1172 idx
= config
->addr_idx
;
1173 if (!strcmp(str
, "none"))
1174 /* start by clearing context type bits */
1175 config
->addr_acc
[idx
] &= ~(BIT(2) | BIT(3));
1176 else if (!strcmp(str
, "ctxid")) {
1177 /* 0b01 The trace unit performs a Context ID */
1178 if (drvdata
->numcidc
) {
1179 config
->addr_acc
[idx
] |= BIT(2);
1180 config
->addr_acc
[idx
] &= ~BIT(3);
1182 } else if (!strcmp(str
, "vmid")) {
1183 /* 0b10 The trace unit performs a VMID */
1184 if (drvdata
->numvmidc
) {
1185 config
->addr_acc
[idx
] &= ~BIT(2);
1186 config
->addr_acc
[idx
] |= BIT(3);
1188 } else if (!strcmp(str
, "all")) {
1190 * 0b11 The trace unit performs a Context ID
1191 * comparison and a VMID
1193 if (drvdata
->numcidc
)
1194 config
->addr_acc
[idx
] |= BIT(2);
1195 if (drvdata
->numvmidc
)
1196 config
->addr_acc
[idx
] |= BIT(3);
1198 spin_unlock(&drvdata
->spinlock
);
1201 static DEVICE_ATTR_RW(addr_ctxtype
);
1203 static ssize_t
addr_context_show(struct device
*dev
,
1204 struct device_attribute
*attr
,
1209 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1210 struct etmv4_config
*config
= &drvdata
->config
;
1212 spin_lock(&drvdata
->spinlock
);
1213 idx
= config
->addr_idx
;
1214 /* context ID comparator bits[6:4] */
1215 val
= BMVAL(config
->addr_acc
[idx
], 4, 6);
1216 spin_unlock(&drvdata
->spinlock
);
1217 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1220 static ssize_t
addr_context_store(struct device
*dev
,
1221 struct device_attribute
*attr
,
1222 const char *buf
, size_t size
)
1226 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1227 struct etmv4_config
*config
= &drvdata
->config
;
1229 if (kstrtoul(buf
, 16, &val
))
1231 if ((drvdata
->numcidc
<= 1) && (drvdata
->numvmidc
<= 1))
1233 if (val
>= (drvdata
->numcidc
>= drvdata
->numvmidc
?
1234 drvdata
->numcidc
: drvdata
->numvmidc
))
1237 spin_lock(&drvdata
->spinlock
);
1238 idx
= config
->addr_idx
;
1239 /* clear context ID comparator bits[6:4] */
1240 config
->addr_acc
[idx
] &= ~(BIT(4) | BIT(5) | BIT(6));
1241 config
->addr_acc
[idx
] |= (val
<< 4);
1242 spin_unlock(&drvdata
->spinlock
);
1245 static DEVICE_ATTR_RW(addr_context
);
1247 static ssize_t
seq_idx_show(struct device
*dev
,
1248 struct device_attribute
*attr
,
1252 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1253 struct etmv4_config
*config
= &drvdata
->config
;
1255 val
= config
->seq_idx
;
1256 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1259 static ssize_t
seq_idx_store(struct device
*dev
,
1260 struct device_attribute
*attr
,
1261 const char *buf
, size_t size
)
1264 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1265 struct etmv4_config
*config
= &drvdata
->config
;
1267 if (kstrtoul(buf
, 16, &val
))
1269 if (val
>= drvdata
->nrseqstate
- 1)
1273 * Use spinlock to ensure index doesn't change while it gets
1274 * dereferenced multiple times within a spinlock block elsewhere.
1276 spin_lock(&drvdata
->spinlock
);
1277 config
->seq_idx
= val
;
1278 spin_unlock(&drvdata
->spinlock
);
1281 static DEVICE_ATTR_RW(seq_idx
);
1283 static ssize_t
seq_state_show(struct device
*dev
,
1284 struct device_attribute
*attr
,
1288 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1289 struct etmv4_config
*config
= &drvdata
->config
;
1291 val
= config
->seq_state
;
1292 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1295 static ssize_t
seq_state_store(struct device
*dev
,
1296 struct device_attribute
*attr
,
1297 const char *buf
, size_t size
)
1300 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1301 struct etmv4_config
*config
= &drvdata
->config
;
1303 if (kstrtoul(buf
, 16, &val
))
1305 if (val
>= drvdata
->nrseqstate
)
1308 config
->seq_state
= val
;
1311 static DEVICE_ATTR_RW(seq_state
);
1313 static ssize_t
seq_event_show(struct device
*dev
,
1314 struct device_attribute
*attr
,
1319 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1320 struct etmv4_config
*config
= &drvdata
->config
;
1322 spin_lock(&drvdata
->spinlock
);
1323 idx
= config
->seq_idx
;
1324 val
= config
->seq_ctrl
[idx
];
1325 spin_unlock(&drvdata
->spinlock
);
1326 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1329 static ssize_t
seq_event_store(struct device
*dev
,
1330 struct device_attribute
*attr
,
1331 const char *buf
, size_t size
)
1335 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1336 struct etmv4_config
*config
= &drvdata
->config
;
1338 if (kstrtoul(buf
, 16, &val
))
1341 spin_lock(&drvdata
->spinlock
);
1342 idx
= config
->seq_idx
;
1343 /* RST, bits[7:0] */
1344 config
->seq_ctrl
[idx
] = val
& 0xFF;
1345 spin_unlock(&drvdata
->spinlock
);
1348 static DEVICE_ATTR_RW(seq_event
);
1350 static ssize_t
seq_reset_event_show(struct device
*dev
,
1351 struct device_attribute
*attr
,
1355 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1356 struct etmv4_config
*config
= &drvdata
->config
;
1358 val
= config
->seq_rst
;
1359 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1362 static ssize_t
seq_reset_event_store(struct device
*dev
,
1363 struct device_attribute
*attr
,
1364 const char *buf
, size_t size
)
1367 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1368 struct etmv4_config
*config
= &drvdata
->config
;
1370 if (kstrtoul(buf
, 16, &val
))
1372 if (!(drvdata
->nrseqstate
))
1375 config
->seq_rst
= val
& ETMv4_EVENT_MASK
;
1378 static DEVICE_ATTR_RW(seq_reset_event
);
1380 static ssize_t
cntr_idx_show(struct device
*dev
,
1381 struct device_attribute
*attr
,
1385 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1386 struct etmv4_config
*config
= &drvdata
->config
;
1388 val
= config
->cntr_idx
;
1389 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1392 static ssize_t
cntr_idx_store(struct device
*dev
,
1393 struct device_attribute
*attr
,
1394 const char *buf
, size_t size
)
1397 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1398 struct etmv4_config
*config
= &drvdata
->config
;
1400 if (kstrtoul(buf
, 16, &val
))
1402 if (val
>= drvdata
->nr_cntr
)
1406 * Use spinlock to ensure index doesn't change while it gets
1407 * dereferenced multiple times within a spinlock block elsewhere.
1409 spin_lock(&drvdata
->spinlock
);
1410 config
->cntr_idx
= val
;
1411 spin_unlock(&drvdata
->spinlock
);
1414 static DEVICE_ATTR_RW(cntr_idx
);
1416 static ssize_t
cntrldvr_show(struct device
*dev
,
1417 struct device_attribute
*attr
,
1422 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1423 struct etmv4_config
*config
= &drvdata
->config
;
1425 spin_lock(&drvdata
->spinlock
);
1426 idx
= config
->cntr_idx
;
1427 val
= config
->cntrldvr
[idx
];
1428 spin_unlock(&drvdata
->spinlock
);
1429 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1432 static ssize_t
cntrldvr_store(struct device
*dev
,
1433 struct device_attribute
*attr
,
1434 const char *buf
, size_t size
)
1438 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1439 struct etmv4_config
*config
= &drvdata
->config
;
1441 if (kstrtoul(buf
, 16, &val
))
1443 if (val
> ETM_CNTR_MAX_VAL
)
1446 spin_lock(&drvdata
->spinlock
);
1447 idx
= config
->cntr_idx
;
1448 config
->cntrldvr
[idx
] = val
;
1449 spin_unlock(&drvdata
->spinlock
);
1452 static DEVICE_ATTR_RW(cntrldvr
);
1454 static ssize_t
cntr_val_show(struct device
*dev
,
1455 struct device_attribute
*attr
,
1460 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1461 struct etmv4_config
*config
= &drvdata
->config
;
1463 spin_lock(&drvdata
->spinlock
);
1464 idx
= config
->cntr_idx
;
1465 val
= config
->cntr_val
[idx
];
1466 spin_unlock(&drvdata
->spinlock
);
1467 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1470 static ssize_t
cntr_val_store(struct device
*dev
,
1471 struct device_attribute
*attr
,
1472 const char *buf
, size_t size
)
1476 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1477 struct etmv4_config
*config
= &drvdata
->config
;
1479 if (kstrtoul(buf
, 16, &val
))
1481 if (val
> ETM_CNTR_MAX_VAL
)
1484 spin_lock(&drvdata
->spinlock
);
1485 idx
= config
->cntr_idx
;
1486 config
->cntr_val
[idx
] = val
;
1487 spin_unlock(&drvdata
->spinlock
);
1490 static DEVICE_ATTR_RW(cntr_val
);
1492 static ssize_t
cntr_ctrl_show(struct device
*dev
,
1493 struct device_attribute
*attr
,
1498 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1499 struct etmv4_config
*config
= &drvdata
->config
;
1501 spin_lock(&drvdata
->spinlock
);
1502 idx
= config
->cntr_idx
;
1503 val
= config
->cntr_ctrl
[idx
];
1504 spin_unlock(&drvdata
->spinlock
);
1505 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1508 static ssize_t
cntr_ctrl_store(struct device
*dev
,
1509 struct device_attribute
*attr
,
1510 const char *buf
, size_t size
)
1514 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1515 struct etmv4_config
*config
= &drvdata
->config
;
1517 if (kstrtoul(buf
, 16, &val
))
1520 spin_lock(&drvdata
->spinlock
);
1521 idx
= config
->cntr_idx
;
1522 config
->cntr_ctrl
[idx
] = val
;
1523 spin_unlock(&drvdata
->spinlock
);
1526 static DEVICE_ATTR_RW(cntr_ctrl
);
1528 static ssize_t
res_idx_show(struct device
*dev
,
1529 struct device_attribute
*attr
,
1533 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1534 struct etmv4_config
*config
= &drvdata
->config
;
1536 val
= config
->res_idx
;
1537 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1540 static ssize_t
res_idx_store(struct device
*dev
,
1541 struct device_attribute
*attr
,
1542 const char *buf
, size_t size
)
1545 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1546 struct etmv4_config
*config
= &drvdata
->config
;
1548 if (kstrtoul(buf
, 16, &val
))
1550 /* Resource selector pair 0 is always implemented and reserved */
1551 if ((val
== 0) || (val
>= drvdata
->nr_resource
))
1555 * Use spinlock to ensure index doesn't change while it gets
1556 * dereferenced multiple times within a spinlock block elsewhere.
1558 spin_lock(&drvdata
->spinlock
);
1559 config
->res_idx
= val
;
1560 spin_unlock(&drvdata
->spinlock
);
1563 static DEVICE_ATTR_RW(res_idx
);
1565 static ssize_t
res_ctrl_show(struct device
*dev
,
1566 struct device_attribute
*attr
,
1571 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1572 struct etmv4_config
*config
= &drvdata
->config
;
1574 spin_lock(&drvdata
->spinlock
);
1575 idx
= config
->res_idx
;
1576 val
= config
->res_ctrl
[idx
];
1577 spin_unlock(&drvdata
->spinlock
);
1578 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1581 static ssize_t
res_ctrl_store(struct device
*dev
,
1582 struct device_attribute
*attr
,
1583 const char *buf
, size_t size
)
1587 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1588 struct etmv4_config
*config
= &drvdata
->config
;
1590 if (kstrtoul(buf
, 16, &val
))
1593 spin_lock(&drvdata
->spinlock
);
1594 idx
= config
->res_idx
;
1595 /* For odd idx pair inversal bit is RES0 */
1597 /* PAIRINV, bit[21] */
1599 config
->res_ctrl
[idx
] = val
;
1600 spin_unlock(&drvdata
->spinlock
);
1603 static DEVICE_ATTR_RW(res_ctrl
);
1605 static ssize_t
ctxid_idx_show(struct device
*dev
,
1606 struct device_attribute
*attr
,
1610 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1611 struct etmv4_config
*config
= &drvdata
->config
;
1613 val
= config
->ctxid_idx
;
1614 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1617 static ssize_t
ctxid_idx_store(struct device
*dev
,
1618 struct device_attribute
*attr
,
1619 const char *buf
, size_t size
)
1622 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1623 struct etmv4_config
*config
= &drvdata
->config
;
1625 if (kstrtoul(buf
, 16, &val
))
1627 if (val
>= drvdata
->numcidc
)
1631 * Use spinlock to ensure index doesn't change while it gets
1632 * dereferenced multiple times within a spinlock block elsewhere.
1634 spin_lock(&drvdata
->spinlock
);
1635 config
->ctxid_idx
= val
;
1636 spin_unlock(&drvdata
->spinlock
);
1639 static DEVICE_ATTR_RW(ctxid_idx
);
1641 static ssize_t
ctxid_pid_show(struct device
*dev
,
1642 struct device_attribute
*attr
,
1647 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1648 struct etmv4_config
*config
= &drvdata
->config
;
1650 spin_lock(&drvdata
->spinlock
);
1651 idx
= config
->ctxid_idx
;
1652 val
= (unsigned long)config
->ctxid_vpid
[idx
];
1653 spin_unlock(&drvdata
->spinlock
);
1654 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1657 static ssize_t
ctxid_pid_store(struct device
*dev
,
1658 struct device_attribute
*attr
,
1659 const char *buf
, size_t size
)
1662 unsigned long vpid
, pid
;
1663 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1664 struct etmv4_config
*config
= &drvdata
->config
;
1667 * only implemented when ctxid tracing is enabled, i.e. at least one
1668 * ctxid comparator is implemented and ctxid is greater than 0 bits
1671 if (!drvdata
->ctxid_size
|| !drvdata
->numcidc
)
1673 if (kstrtoul(buf
, 16, &vpid
))
1676 pid
= coresight_vpid_to_pid(vpid
);
1678 spin_lock(&drvdata
->spinlock
);
1679 idx
= config
->ctxid_idx
;
1680 config
->ctxid_pid
[idx
] = (u64
)pid
;
1681 config
->ctxid_vpid
[idx
] = (u64
)vpid
;
1682 spin_unlock(&drvdata
->spinlock
);
1685 static DEVICE_ATTR_RW(ctxid_pid
);
1687 static ssize_t
ctxid_masks_show(struct device
*dev
,
1688 struct device_attribute
*attr
,
1691 unsigned long val1
, val2
;
1692 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1693 struct etmv4_config
*config
= &drvdata
->config
;
1695 spin_lock(&drvdata
->spinlock
);
1696 val1
= config
->ctxid_mask0
;
1697 val2
= config
->ctxid_mask1
;
1698 spin_unlock(&drvdata
->spinlock
);
1699 return scnprintf(buf
, PAGE_SIZE
, "%#lx %#lx\n", val1
, val2
);
1702 static ssize_t
ctxid_masks_store(struct device
*dev
,
1703 struct device_attribute
*attr
,
1704 const char *buf
, size_t size
)
1707 unsigned long val1
, val2
, mask
;
1708 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1709 struct etmv4_config
*config
= &drvdata
->config
;
1712 * only implemented when ctxid tracing is enabled, i.e. at least one
1713 * ctxid comparator is implemented and ctxid is greater than 0 bits
1716 if (!drvdata
->ctxid_size
|| !drvdata
->numcidc
)
1718 if (sscanf(buf
, "%lx %lx", &val1
, &val2
) != 2)
1721 spin_lock(&drvdata
->spinlock
);
1723 * each byte[0..3] controls mask value applied to ctxid
1726 switch (drvdata
->numcidc
) {
1728 /* COMP0, bits[7:0] */
1729 config
->ctxid_mask0
= val1
& 0xFF;
1732 /* COMP1, bits[15:8] */
1733 config
->ctxid_mask0
= val1
& 0xFFFF;
1736 /* COMP2, bits[23:16] */
1737 config
->ctxid_mask0
= val1
& 0xFFFFFF;
1740 /* COMP3, bits[31:24] */
1741 config
->ctxid_mask0
= val1
;
1744 /* COMP4, bits[7:0] */
1745 config
->ctxid_mask0
= val1
;
1746 config
->ctxid_mask1
= val2
& 0xFF;
1749 /* COMP5, bits[15:8] */
1750 config
->ctxid_mask0
= val1
;
1751 config
->ctxid_mask1
= val2
& 0xFFFF;
1754 /* COMP6, bits[23:16] */
1755 config
->ctxid_mask0
= val1
;
1756 config
->ctxid_mask1
= val2
& 0xFFFFFF;
1759 /* COMP7, bits[31:24] */
1760 config
->ctxid_mask0
= val1
;
1761 config
->ctxid_mask1
= val2
;
1767 * If software sets a mask bit to 1, it must program relevant byte
1768 * of ctxid comparator value 0x0, otherwise behavior is unpredictable.
1769 * For example, if bit[3] of ctxid_mask0 is 1, we must clear bits[31:24]
1770 * of ctxid comparator0 value (corresponding to byte 0) register.
1772 mask
= config
->ctxid_mask0
;
1773 for (i
= 0; i
< drvdata
->numcidc
; i
++) {
1774 /* mask value of corresponding ctxid comparator */
1775 maskbyte
= mask
& ETMv4_EVENT_MASK
;
1777 * each bit corresponds to a byte of respective ctxid comparator
1780 for (j
= 0; j
< 8; j
++) {
1782 config
->ctxid_pid
[i
] &= ~(0xFF << (j
* 8));
1785 /* Select the next ctxid comparator mask value */
1787 /* ctxid comparators[4-7] */
1788 mask
= config
->ctxid_mask1
;
1793 spin_unlock(&drvdata
->spinlock
);
1796 static DEVICE_ATTR_RW(ctxid_masks
);
1798 static ssize_t
vmid_idx_show(struct device
*dev
,
1799 struct device_attribute
*attr
,
1803 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1804 struct etmv4_config
*config
= &drvdata
->config
;
1806 val
= config
->vmid_idx
;
1807 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1810 static ssize_t
vmid_idx_store(struct device
*dev
,
1811 struct device_attribute
*attr
,
1812 const char *buf
, size_t size
)
1815 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1816 struct etmv4_config
*config
= &drvdata
->config
;
1818 if (kstrtoul(buf
, 16, &val
))
1820 if (val
>= drvdata
->numvmidc
)
1824 * Use spinlock to ensure index doesn't change while it gets
1825 * dereferenced multiple times within a spinlock block elsewhere.
1827 spin_lock(&drvdata
->spinlock
);
1828 config
->vmid_idx
= val
;
1829 spin_unlock(&drvdata
->spinlock
);
1832 static DEVICE_ATTR_RW(vmid_idx
);
1834 static ssize_t
vmid_val_show(struct device
*dev
,
1835 struct device_attribute
*attr
,
1839 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1840 struct etmv4_config
*config
= &drvdata
->config
;
1842 val
= (unsigned long)config
->vmid_val
[config
->vmid_idx
];
1843 return scnprintf(buf
, PAGE_SIZE
, "%#lx\n", val
);
1846 static ssize_t
vmid_val_store(struct device
*dev
,
1847 struct device_attribute
*attr
,
1848 const char *buf
, size_t size
)
1851 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1852 struct etmv4_config
*config
= &drvdata
->config
;
1855 * only implemented when vmid tracing is enabled, i.e. at least one
1856 * vmid comparator is implemented and at least 8 bit vmid size
1858 if (!drvdata
->vmid_size
|| !drvdata
->numvmidc
)
1860 if (kstrtoul(buf
, 16, &val
))
1863 spin_lock(&drvdata
->spinlock
);
1864 config
->vmid_val
[config
->vmid_idx
] = (u64
)val
;
1865 spin_unlock(&drvdata
->spinlock
);
1868 static DEVICE_ATTR_RW(vmid_val
);
1870 static ssize_t
vmid_masks_show(struct device
*dev
,
1871 struct device_attribute
*attr
, char *buf
)
1873 unsigned long val1
, val2
;
1874 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1875 struct etmv4_config
*config
= &drvdata
->config
;
1877 spin_lock(&drvdata
->spinlock
);
1878 val1
= config
->vmid_mask0
;
1879 val2
= config
->vmid_mask1
;
1880 spin_unlock(&drvdata
->spinlock
);
1881 return scnprintf(buf
, PAGE_SIZE
, "%#lx %#lx\n", val1
, val2
);
1884 static ssize_t
vmid_masks_store(struct device
*dev
,
1885 struct device_attribute
*attr
,
1886 const char *buf
, size_t size
)
1889 unsigned long val1
, val2
, mask
;
1890 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1891 struct etmv4_config
*config
= &drvdata
->config
;
1894 * only implemented when vmid tracing is enabled, i.e. at least one
1895 * vmid comparator is implemented and at least 8 bit vmid size
1897 if (!drvdata
->vmid_size
|| !drvdata
->numvmidc
)
1899 if (sscanf(buf
, "%lx %lx", &val1
, &val2
) != 2)
1902 spin_lock(&drvdata
->spinlock
);
1905 * each byte[0..3] controls mask value applied to vmid
1908 switch (drvdata
->numvmidc
) {
1910 /* COMP0, bits[7:0] */
1911 config
->vmid_mask0
= val1
& 0xFF;
1914 /* COMP1, bits[15:8] */
1915 config
->vmid_mask0
= val1
& 0xFFFF;
1918 /* COMP2, bits[23:16] */
1919 config
->vmid_mask0
= val1
& 0xFFFFFF;
1922 /* COMP3, bits[31:24] */
1923 config
->vmid_mask0
= val1
;
1926 /* COMP4, bits[7:0] */
1927 config
->vmid_mask0
= val1
;
1928 config
->vmid_mask1
= val2
& 0xFF;
1931 /* COMP5, bits[15:8] */
1932 config
->vmid_mask0
= val1
;
1933 config
->vmid_mask1
= val2
& 0xFFFF;
1936 /* COMP6, bits[23:16] */
1937 config
->vmid_mask0
= val1
;
1938 config
->vmid_mask1
= val2
& 0xFFFFFF;
1941 /* COMP7, bits[31:24] */
1942 config
->vmid_mask0
= val1
;
1943 config
->vmid_mask1
= val2
;
1950 * If software sets a mask bit to 1, it must program relevant byte
1951 * of vmid comparator value 0x0, otherwise behavior is unpredictable.
1952 * For example, if bit[3] of vmid_mask0 is 1, we must clear bits[31:24]
1953 * of vmid comparator0 value (corresponding to byte 0) register.
1955 mask
= config
->vmid_mask0
;
1956 for (i
= 0; i
< drvdata
->numvmidc
; i
++) {
1957 /* mask value of corresponding vmid comparator */
1958 maskbyte
= mask
& ETMv4_EVENT_MASK
;
1960 * each bit corresponds to a byte of respective vmid comparator
1963 for (j
= 0; j
< 8; j
++) {
1965 config
->vmid_val
[i
] &= ~(0xFF << (j
* 8));
1968 /* Select the next vmid comparator mask value */
1970 /* vmid comparators[4-7] */
1971 mask
= config
->vmid_mask1
;
1975 spin_unlock(&drvdata
->spinlock
);
1978 static DEVICE_ATTR_RW(vmid_masks
);
1980 static ssize_t
cpu_show(struct device
*dev
,
1981 struct device_attribute
*attr
, char *buf
)
1984 struct etmv4_drvdata
*drvdata
= dev_get_drvdata(dev
->parent
);
1987 return scnprintf(buf
, PAGE_SIZE
, "%d\n", val
);
1990 static DEVICE_ATTR_RO(cpu
);
1992 static struct attribute
*coresight_etmv4_attrs
[] = {
1993 &dev_attr_nr_pe_cmp
.attr
,
1994 &dev_attr_nr_addr_cmp
.attr
,
1995 &dev_attr_nr_cntr
.attr
,
1996 &dev_attr_nr_ext_inp
.attr
,
1997 &dev_attr_numcidc
.attr
,
1998 &dev_attr_numvmidc
.attr
,
1999 &dev_attr_nrseqstate
.attr
,
2000 &dev_attr_nr_resource
.attr
,
2001 &dev_attr_nr_ss_cmp
.attr
,
2002 &dev_attr_reset
.attr
,
2003 &dev_attr_mode
.attr
,
2005 &dev_attr_event
.attr
,
2006 &dev_attr_event_instren
.attr
,
2007 &dev_attr_event_ts
.attr
,
2008 &dev_attr_syncfreq
.attr
,
2009 &dev_attr_cyc_threshold
.attr
,
2010 &dev_attr_bb_ctrl
.attr
,
2011 &dev_attr_event_vinst
.attr
,
2012 &dev_attr_s_exlevel_vinst
.attr
,
2013 &dev_attr_ns_exlevel_vinst
.attr
,
2014 &dev_attr_addr_idx
.attr
,
2015 &dev_attr_addr_instdatatype
.attr
,
2016 &dev_attr_addr_single
.attr
,
2017 &dev_attr_addr_range
.attr
,
2018 &dev_attr_addr_start
.attr
,
2019 &dev_attr_addr_stop
.attr
,
2020 &dev_attr_addr_ctxtype
.attr
,
2021 &dev_attr_addr_context
.attr
,
2022 &dev_attr_seq_idx
.attr
,
2023 &dev_attr_seq_state
.attr
,
2024 &dev_attr_seq_event
.attr
,
2025 &dev_attr_seq_reset_event
.attr
,
2026 &dev_attr_cntr_idx
.attr
,
2027 &dev_attr_cntrldvr
.attr
,
2028 &dev_attr_cntr_val
.attr
,
2029 &dev_attr_cntr_ctrl
.attr
,
2030 &dev_attr_res_idx
.attr
,
2031 &dev_attr_res_ctrl
.attr
,
2032 &dev_attr_ctxid_idx
.attr
,
2033 &dev_attr_ctxid_pid
.attr
,
2034 &dev_attr_ctxid_masks
.attr
,
2035 &dev_attr_vmid_idx
.attr
,
2036 &dev_attr_vmid_val
.attr
,
2037 &dev_attr_vmid_masks
.attr
,
2042 #define coresight_etm4x_simple_func(name, offset) \
2043 coresight_simple_func(struct etmv4_drvdata, name, offset)
2045 coresight_etm4x_simple_func(trcoslsr
, TRCOSLSR
);
2046 coresight_etm4x_simple_func(trcpdcr
, TRCPDCR
);
2047 coresight_etm4x_simple_func(trcpdsr
, TRCPDSR
);
2048 coresight_etm4x_simple_func(trclsr
, TRCLSR
);
2049 coresight_etm4x_simple_func(trcconfig
, TRCCONFIGR
);
2050 coresight_etm4x_simple_func(trctraceid
, TRCTRACEIDR
);
2051 coresight_etm4x_simple_func(trcauthstatus
, TRCAUTHSTATUS
);
2052 coresight_etm4x_simple_func(trcdevid
, TRCDEVID
);
2053 coresight_etm4x_simple_func(trcdevtype
, TRCDEVTYPE
);
2054 coresight_etm4x_simple_func(trcpidr0
, TRCPIDR0
);
2055 coresight_etm4x_simple_func(trcpidr1
, TRCPIDR1
);
2056 coresight_etm4x_simple_func(trcpidr2
, TRCPIDR2
);
2057 coresight_etm4x_simple_func(trcpidr3
, TRCPIDR3
);
2059 static struct attribute
*coresight_etmv4_mgmt_attrs
[] = {
2060 &dev_attr_trcoslsr
.attr
,
2061 &dev_attr_trcpdcr
.attr
,
2062 &dev_attr_trcpdsr
.attr
,
2063 &dev_attr_trclsr
.attr
,
2064 &dev_attr_trcconfig
.attr
,
2065 &dev_attr_trctraceid
.attr
,
2066 &dev_attr_trcauthstatus
.attr
,
2067 &dev_attr_trcdevid
.attr
,
2068 &dev_attr_trcdevtype
.attr
,
2069 &dev_attr_trcpidr0
.attr
,
2070 &dev_attr_trcpidr1
.attr
,
2071 &dev_attr_trcpidr2
.attr
,
2072 &dev_attr_trcpidr3
.attr
,
2076 coresight_etm4x_simple_func(trcidr0
, TRCIDR0
);
2077 coresight_etm4x_simple_func(trcidr1
, TRCIDR1
);
2078 coresight_etm4x_simple_func(trcidr2
, TRCIDR2
);
2079 coresight_etm4x_simple_func(trcidr3
, TRCIDR3
);
2080 coresight_etm4x_simple_func(trcidr4
, TRCIDR4
);
2081 coresight_etm4x_simple_func(trcidr5
, TRCIDR5
);
2082 /* trcidr[6,7] are reserved */
2083 coresight_etm4x_simple_func(trcidr8
, TRCIDR8
);
2084 coresight_etm4x_simple_func(trcidr9
, TRCIDR9
);
2085 coresight_etm4x_simple_func(trcidr10
, TRCIDR10
);
2086 coresight_etm4x_simple_func(trcidr11
, TRCIDR11
);
2087 coresight_etm4x_simple_func(trcidr12
, TRCIDR12
);
2088 coresight_etm4x_simple_func(trcidr13
, TRCIDR13
);
2090 static struct attribute
*coresight_etmv4_trcidr_attrs
[] = {
2091 &dev_attr_trcidr0
.attr
,
2092 &dev_attr_trcidr1
.attr
,
2093 &dev_attr_trcidr2
.attr
,
2094 &dev_attr_trcidr3
.attr
,
2095 &dev_attr_trcidr4
.attr
,
2096 &dev_attr_trcidr5
.attr
,
2097 /* trcidr[6,7] are reserved */
2098 &dev_attr_trcidr8
.attr
,
2099 &dev_attr_trcidr9
.attr
,
2100 &dev_attr_trcidr10
.attr
,
2101 &dev_attr_trcidr11
.attr
,
2102 &dev_attr_trcidr12
.attr
,
2103 &dev_attr_trcidr13
.attr
,
2107 static const struct attribute_group coresight_etmv4_group
= {
2108 .attrs
= coresight_etmv4_attrs
,
2111 static const struct attribute_group coresight_etmv4_mgmt_group
= {
2112 .attrs
= coresight_etmv4_mgmt_attrs
,
2116 static const struct attribute_group coresight_etmv4_trcidr_group
= {
2117 .attrs
= coresight_etmv4_trcidr_attrs
,
2121 const struct attribute_group
*coresight_etmv4_groups
[] = {
2122 &coresight_etmv4_group
,
2123 &coresight_etmv4_mgmt_group
,
2124 &coresight_etmv4_trcidr_group
,