OpenCSD - CoreSight Trace Decode Library  1.0.0
trc_pkt_types_etmv4.h
Go to the documentation of this file.
1 /*
2  * \file trc_pkt_types_etmv4.h
3  * \brief OpenCSD : ETMv4 / ETE packet info
4  *
5  * \copyright Copyright (c) 2015,2019 ARM Limited. All Rights Reserved.
6  */
7 
8 
9 /*
10  * Redistribution and use in source and binary forms, with or without modification,
11  * are permitted provided that the following conditions are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * 3. Neither the name of the copyright holder nor the names of its contributors
21  * may be used to endorse or promote products derived from this software without
22  * specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27  * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
28  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef ARM_TRC_PKT_TYPES_ETMV4_H_INCLUDED
37 #define ARM_TRC_PKT_TYPES_ETMV4_H_INCLUDED
38 
39 #include "opencsd/trc_pkt_types.h"
40 
49 {
50 /* state of decode markers */
55 /* markers for unknown/bad packets */
61 /* I stream packet types. */
62  /* extension header. */
65  /* sync */
67  // timestamp
71  // Exceptions
75  /* unused encoding 0x08 b00001000 */
80  /* cycle count packets */
85  // data synchronisation markers
89  // speculation
97  /* conditional instruction tracing - (reserved encodings ETE) */
101  /* unused encoding 0x47 b01000111 */
103  /* unused encodings 0x4B,0x4F b01001011, b01001111 */
105  /* unused encodings 0x60-0x67 b01100xxx */
110  // event trace
114  /* address and context */
118  /* unused encoding 0x84 b10000100 */
121  /* unused encoding 0x87 b10000111 */
123  /* unused encodings 0x89-0x8F b10001001 to b10001111 */
125  /* unused encodings 0x93-0x94 b10010011 to b10010010 */
128  /* unused encodings 0x97 b10010111 to b10011001 0x99 */
131  /* unused encoding 0x9C b10011100 */
134  /* unused encoding 0x9F b10011111 */
135 
136  /* Q packets */
137  ETM4_PKT_I_Q = 0xA0,
139  /* ETE source address packets, unused ETMv4 */
147  /* unused encodings 0xBA-0xBF b10111010 - b10111111 */
148 
149  /* Atom packets */
157  // extension packets - follow 0x00 header
161 
162  // ETE extended types
163  ETE_PKT_I_PE_RESET = 0x400, // base type is exception packet.
164  ETE_PKT_I_TRANS_FAIL = 0x401, // base type is exception packet.
165 
167 
168 typedef union _etmv4_trace_info_t {
169  uint32_t val;
170  struct {
171  uint32_t cc_enabled:1;
172  uint32_t cond_enabled:3;
173  uint32_t p0_load:1;
174  uint32_t p0_store:1;
175  uint32_t in_trans_state:1;
176  } bits;
178 
179 typedef struct _etmv4_context_t {
180  struct {
181  uint32_t EL:2;
182  uint32_t SF:1;
183  uint32_t NS:1;
184  uint32_t updated:1;
185  uint32_t updated_c:1;
186  uint32_t updated_v:1;
187  };
188  uint32_t ctxtID;
189  uint32_t VMID;
191 
193 typedef struct _etmv4_addr_val_t {
195  uint8_t isa;
197 
198 typedef struct _ocsd_etmv4_i_pkt
199 {
202  //** intra-packet data - valid across packets.
203 
205  uint8_t v_addr_ISA;
206 
208 
209  struct {
210  uint64_t timestamp;
211  uint8_t bits_changed;
212  } ts;
213 
214  uint32_t cc_threshold;
215 
216  // single packet data - only valid for specific packet types on packet instance.
218  uint32_t cycle_count;
219 
220  uint32_t curr_spec_depth;
221  uint32_t p0_key;
222 
223  uint32_t commit_elements; //<! commit elements indicated by this packet - valid dependent on the packet type.
224  uint32_t cancel_elements; //<! cancel elements indicated by this packet - valid dependent on the packet type.
225 
227 
228  struct {
229  uint32_t exceptionType:10;
230  uint32_t addr_interp:2;
231  uint32_t m_fault_pending:1;
232  uint32_t m_type:1;
234 
235 
237  uint8_t dsm_val;
238  uint8_t event_val;
239 
240  struct {
241  uint32_t cond_c_key;
242  uint8_t num_c_elem;
243  struct {
244  uint32_t cond_key_set:1;
245  uint32_t f3_final_elem:1;
246  uint32_t f2_cond_incr:1;
247  };
249 
250  struct {
251  uint32_t cond_r_key_0;
252  uint32_t cond_r_key_1;
253  struct {
254  uint32_t res_0:4;
255  uint32_t res_1:4;
256  uint32_t ci_0:1;
257  uint32_t ci_1:1;
258  uint32_t key_res_0_set:1;
259  uint32_t key_res_1_set:1;
260  uint32_t f2_key_incr:2;
261  uint32_t f2f4_token:2;
262  uint32_t f3_tokens:12;
263  };
265 
266  struct {
267  uint32_t q_count;
268  struct {
269  uint32_t addr_present:1;
270  uint32_t addr_match:1;
271  uint32_t count_present:1;
272  uint32_t q_type:4;
273  };
274  } Q_pkt;
275 
277  union {
278  uint32_t val;
279  struct {
280  uint32_t context_valid:1;
281  uint32_t ts_valid:1;
282  uint32_t spec_depth_valid:1;
283  uint32_t p0_key_valid:1;
284  uint32_t cond_c_key_valid:1;
285  uint32_t cond_r_key_valid:1;
286  uint32_t trace_info_valid:1;
287  uint32_t cc_thresh_valid:1;
288  uint32_t cc_valid:1;
289  uint32_t commit_elem_valid:1;
290  } bits;
292 
293  // original header type when packet type changed to error on decode error.
295  uint8_t err_hdr_val;
296 
297  // protocol version - validity of ETE specific fields 0xMm == v Major.minor
299 
301 
302 
303 // D stream packets
305 {
306 // markers for unknown/bad packets
314 
315  // data sync markers
316  ETM4_PKT_DNUM_DS_MKR = 0x111, // ext packet, b0001xxx1
317  // extension header
319 
321  // event trace
323  // timestamp
325  // P1 Data address
333  // P2 Data value
340  // suppression
342  // synchronisation- extension packets - follow 0x00 header
344 
345  // extension packets - follow 0x00 header
348  ETM4_PKT_D_OVERFLOW = 0x105
349 
351 
352 
353 typedef struct _ocsd_etmv4_d_pkt
354 {
356 
358 
359  uint64_t pkt_val;
362 
364 
365 typedef struct _ocsd_etmv4_cfg
366 {
367  uint32_t reg_idr0;
368  uint32_t reg_idr1;
369  uint32_t reg_idr2;
370  uint32_t reg_idr8;
371  uint32_t reg_idr9;
372  uint32_t reg_idr10;
373  uint32_t reg_idr11;
374  uint32_t reg_idr12;
375  uint32_t reg_idr13;
376  uint32_t reg_configr;
377  uint32_t reg_traceidr;
381 
382 #define ETE_ARCH_VERSION 0x5
383 
384 #define ETE_OPFLG_PKTDEC_SRCADDR_N_ATOMS 0x00010000
388 #endif // ARM_TRC_PKT_TYPES_ETMV4_H_INCLUDED
389 
390 /* End of File trc_pkt_types_etmv4.h */
391 
enum _ocsd_core_profile ocsd_core_profile_t
enum _ocsd_arch_version ocsd_arch_version_t
uint64_t ocsd_vaddr_t
_ocsd_etmv4_i_pkt_type
_ocsd_etmv4_d_pkt_type
struct _etmv4_addr_val_t etmv4_addr_val_t
struct _ocsd_etmv4_i_pkt ocsd_etmv4_i_pkt
struct _ocsd_etmv4_d_pkt ocsd_etmv4_d_pkt
enum _ocsd_etmv4_i_pkt_type ocsd_etmv4_i_pkt_type
struct _ocsd_etmv4_cfg ocsd_etmv4_cfg
enum _ocsd_etmv4_d_pkt_type ocsd_etmv4_d_pkt_type
struct _etmv4_context_t etmv4_context_t
union _etmv4_trace_info_t etmv4_trace_info_t
@ ETM4_PKT_I_CANCEL_F1
@ ETM4_PKT_I_ADDR_CTX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_PKT_I_TIMESTAMP
@ ETM4_PKT_I_COND_FLUSH
@ ETM4_PKT_I_FUNC_RET
@ ETM4_PKT_I_IGNORE
@ ETE_PKT_I_TRANS_COMMIT
@ ETM4_PKT_I_EXCEPT_RTN
@ ETE_PKT_I_TRANS_FAIL
@ ETM4_PKT_I_COND_RES_F2
@ ETM4_PKT_I_ADDR_S_IS0
@ ETM4_PKT_I_COND_I_F1
@ ETM4_PKT_I_NO_ERR_TYPE
@ ETM4_PKT_I_ADDR_L_64IS1
@ ETM4_PKT_I_ADDR_L_32IS0
@ ETM4_PKT_I_ATOM_F4
@ ETM4_PKT_I_ADDR_CTXT_L_64IS0
@ ETM4_PKT_I_ATOM_F5
@ ETM4_PKT_I_NUM_DS_MKR
@ ETM4_PKT_I_NOTSYNC
@ ETM4_PKT_I_CANCEL_F1_MISPRED
@ ETE_PKT_I_SRC_ADDR_S_IS1
@ ETM4_PKT_I_Q
@ ETM4_PKT_I_ADDR_S_IS1
@ ETE_PKT_I_SRC_ADDR_L_64IS0
@ ETM4_PKT_I_CCNT_F2
@ ETM4_PKT_D_BAD_SEQUENCE
invalid sequence for packet type
@ ETM4_PKT_DADDR_P1_F7
b11110101
@ ETM4_PKT_D_NOTSYNC
no sync found yet
@ ETM4_PKT_DVAL_P2_F2
b00110xxx
@ ETM4_PKT_DADDR_P1_F2
b10xxxxxx
@ ETM4_PKT_D_NO_HEADER
waiting for a header byte
@ ETM4_PKT_DSUPPRESSION
b00000011
@ ETM4_PKT_D_NO_ERR_TYPE
error packet has no header based type. Use with unknown/res packet types.
@ ETM4_PKT_DVAL_P2_F5
b00011xxx
@ ETM4_PKT_D_ASYNC
b00000000
@ ETM4_PKT_DADDR_P1_F4
b0110xxxx
@ ETM4_PKT_DADDR_P1_F3
b000101xx
@ ETM4_PKT_DTRACE_INFO
b00000001
@ ETM4_PKT_DADDR_P1_F6
b1111011x
@ ETM4_PKT_DVAL_P2_F4
b000100xx
@ ETM4_PKT_DVAL_P2_F1
b0010xxxx
@ ETM4_PKT_D_BAD_TRACEMODE
invalid packet type for this trace mode.
@ ETM4_PKT_DTIMESTAMP
b00000010
@ ETM4_PKT_D_OVERFLOW
b00000101
@ ETM4_PKT_DEVENT
b00000100
@ ETM4_PKT_DADDR_P1_F1
b0111xxxx
@ ETM4_PKT_DUNNUM_DS_MKR
b00000001
@ ETM4_PKT_DADDR_P1_F5
b11111xxx
@ ETM4_PKT_D_RESERVED
packet type reserved.
@ ETM4_PKT_D_DISCARD
b00000011
@ ETM4_PKT_DNUM_DS_MKR
@ ETM4_PKT_D_EXTENSION
b00000000
@ ETM4_PKT_D_INCOMPLETE_EOT
flushing incomplete packet at end of trace.
@ ETM4_PKT_DVAL_P2_F6
b00111xxx
@ ETM4_PKT_DVAL_P2_F3
b010xxxxx
ocsd_vaddr_t val
Address value.
uint8_t isa
instruction set.
uint32_t SF
sixty four bit
uint32_t VMID
current VMID
uint32_t updated_v
updated VMID
uint32_t updated_c
updated CtxtID
uint32_t ctxtID
Current ctxtID.
uint32_t updated
updated this context packet (otherwise same as last time)
uint32_t NS
none secure
uint32_t EL
exception level.
ocsd_core_profile_t core_prof
ocsd_arch_version_t arch_ver
ocsd_etmv4_d_pkt_type err_type
ocsd_etmv4_d_pkt_type type
struct _ocsd_etmv4_i_pkt::@17::@24 bits
uint8_t dsm_val
Data Sync Marker number, or unnumbered atom count - packet type determines.
struct _ocsd_etmv4_i_pkt::@13 exception_info
ocsd_etmv4_i_pkt_type type
struct _ocsd_etmv4_i_pkt::@16 Q_pkt
uint32_t p0_key
current P0 key value for data packet synchronisation
etmv4_trace_info_t trace_info
trace info structure - programmed configuration of trace capture.
ocsd_pkt_vaddr v_addr
most recently broadcast address packet
uint32_t addr_interp
address value interpretation
uint8_t bits_changed
bits updated in this timestamp packet.
struct _ocsd_etmv4_i_pkt::@14 cond_instr
ocsd_etmv4_i_pkt_type err_type
uint32_t m_fault_pending
M class fault pending.
uint32_t curr_spec_depth
current speculation depth
uint8_t v_addr_ISA
ISA for the address packet. (0 = IS0 / 1 = IS1)
struct _ocsd_etmv4_i_pkt::@12 ts
uint32_t cc_threshold
cycle count threshold - from trace info.
struct _ocsd_etmv4_i_pkt::@15 cond_result
uint32_t cycle_count
cycle count
ocsd_pkt_atom atom
atom elements - number of atoms indicates validity of packet
etmv4_context_t context
current context for PE
uint8_t event_val
Event value on event packet.
uint8_t addr_exact_match_idx
address match index in this packet.
uint32_t exceptionType
exception number
uint64_t timestamp
current timestamp value
union _ocsd_etmv4_i_pkt::@17 pkt_valid
valid bits for packet elements (addresses have their own valid bits).
uint32_t m_type
1 if M class exception.
OpenCSD: Common "C" types for trace packets.
uint32_t cond_enabled
conditional trace enabled type.
uint32_t cc_enabled
1 if cycle count enabled
uint32_t in_trans_state
1 if starting trace when in a transactional state (ETE trace).
uint32_t val
trace info full value.
uint32_t p0_load
1 if tracing with P0 load elements (for data trace)
uint32_t p0_store
1 if tracing with P0 store elements (for data trace)
struct _etmv4_trace_info_t::@9 bits
bitfields for trace info value.