Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / perf / util / cs-etm-decoder / cs-etm-decoder.h
blob12c782fa6db285852f9f901735aa1f0e55b955e8
1 /*
2 * SPDX-License-Identifier: GPL-2.0
4 * Copyright(C) 2015-2018 Linaro Limited.
6 * Author: Tor Jeremiassen <tor@ti.com>
7 * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
8 */
10 #ifndef INCLUDE__CS_ETM_DECODER_H__
11 #define INCLUDE__CS_ETM_DECODER_H__
13 #include <linux/types.h>
14 #include <opencsd/ocsd_if_types.h>
15 #include <stdio.h>
17 struct cs_etm_decoder;
18 struct cs_etm_packet;
19 struct cs_etm_packet_queue;
21 struct cs_etm_queue;
23 typedef u32 (*cs_etm_mem_cb_type)(struct cs_etm_queue *, u8, u64, size_t, u8 *,
24 const ocsd_mem_space_acc_t);
26 struct cs_etmv3_trace_params {
27 u32 reg_ctrl;
28 u32 reg_trc_id;
29 u32 reg_ccer;
30 u32 reg_idr;
33 struct cs_etmv4_trace_params {
34 u32 reg_idr0;
35 u32 reg_idr1;
36 u32 reg_idr2;
37 u32 reg_idr8;
38 u32 reg_configr;
39 u32 reg_traceidr;
42 struct cs_ete_trace_params {
43 u32 reg_idr0;
44 u32 reg_idr1;
45 u32 reg_idr2;
46 u32 reg_idr8;
47 u32 reg_configr;
48 u32 reg_traceidr;
49 u32 reg_devarch;
52 struct cs_etm_trace_params {
53 int protocol;
54 union {
55 struct cs_etmv3_trace_params etmv3;
56 struct cs_etmv4_trace_params etmv4;
57 struct cs_ete_trace_params ete;
61 struct cs_etm_decoder_params {
62 int operation;
63 void (*packet_printer)(const char *msg, void *data);
64 cs_etm_mem_cb_type mem_acc_cb;
65 bool formatted;
66 bool fsyncs;
67 bool hsyncs;
68 bool frame_aligned;
69 void *data;
73 * The following enums are indexed starting with 1 to align with the
74 * open source coresight trace decoder library.
76 enum {
77 CS_ETM_PROTO_ETMV3 = 1,
78 CS_ETM_PROTO_ETMV4i,
79 CS_ETM_PROTO_ETMV4d,
80 CS_ETM_PROTO_PTM,
81 CS_ETM_PROTO_ETE
84 enum cs_etm_decoder_operation {
85 CS_ETM_OPERATION_PRINT = 1,
86 CS_ETM_OPERATION_DECODE,
87 CS_ETM_OPERATION_MAX,
90 int cs_etm_decoder__process_data_block(struct cs_etm_decoder *decoder,
91 u64 indx, const u8 *buf,
92 size_t len, size_t *consumed);
94 struct cs_etm_decoder *
95 cs_etm_decoder__new(int num_cpu,
96 struct cs_etm_decoder_params *d_params,
97 struct cs_etm_trace_params t_params[]);
99 void cs_etm_decoder__free(struct cs_etm_decoder *decoder);
101 int cs_etm_decoder__add_mem_access_cb(struct cs_etm_decoder *decoder,
102 u64 start, u64 end,
103 cs_etm_mem_cb_type cb_func);
105 int cs_etm_decoder__get_packet(struct cs_etm_packet_queue *packet_queue,
106 struct cs_etm_packet *packet);
108 int cs_etm_decoder__reset(struct cs_etm_decoder *decoder);
109 const char *cs_etm_decoder__get_name(struct cs_etm_decoder *decoder);
111 #endif /* INCLUDE__CS_ETM_DECODER_H__ */