2 * \file trc_pkt_types_etmv3.h
5 * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved.
9 * Redistribution and use in source and binary forms, with or without modification,
10 * are permitted provided that the following conditions are met:
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
19 * 3. Neither the name of the copyright holder nor the names of its contributors
20 * may be used to endorse or promote products derived from this software without
21 * specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #ifndef ARM_TRC_ETM3_PKT_TYPES_ETMV3_H_INCLUDED
36 #define ARM_TRC_ETM3_PKT_TYPES_ETMV3_H_INCLUDED
38 #include "opencsd/trc_pkt_types.h"
40 /** @addtogroup trc_pkts
43 /** @name ETMv3 Packet Types
46 typedef enum _ocsd_etmv3_pkt_type
49 // markers for unknown packets
50 ETM3_PKT_NOERROR, //!< no error in packet - supplimentary data.
51 ETM3_PKT_NOTSYNC, //!< no sync found yet
52 ETM3_PKT_INCOMPLETE_EOT, //!< flushing incomplete/empty packet at end of trace.
54 // markers for valid packets
55 ETM3_PKT_BRANCH_ADDRESS,
59 ETM3_PKT_I_SYNC_CYCLE,
64 ETM3_PKT_OOO_ADDR_PLC,
66 ETM3_PKT_DATA_SUPPRESSED,
67 ETM3_PKT_VAL_NOT_TRACED,
71 ETM3_PKT_EXCEPTION_ENTRY,
72 ETM3_PKT_EXCEPTION_EXIT,
75 // internal processing types
76 ETM3_PKT_BRANCH_OR_BYPASS_EOT,
79 ETM3_PKT_BAD_SEQUENCE, //!< invalid sequence for packet type
80 ETM3_PKT_BAD_TRACEMODE, //!< invalid packet type for this trace mode.
81 ETM3_PKT_RESERVED //!< packet type reserved.
83 } ocsd_etmv3_pkt_type;
85 typedef struct _ocsd_etmv3_excep {
86 ocsd_armv7_exception type; /**< exception type. */
87 uint16_t number; /**< exception as number */
89 uint32_t present:1; /**< exception present in packet */
90 uint32_t cancel:1; /**< exception cancels prev instruction traced. */
92 uint32_t cm_resume:4; /**< M class resume code */
93 uint32_t cm_irq_n:9; /**< M class IRQ n */
97 typedef struct _etmv3_context_t {
99 uint32_t curr_alt_isa:1; /**< current Alt ISA flag for Tee / T32 (used if not in present packet) */
100 uint32_t curr_NS:1; /**< current NS flag (used if not in present packet) */
101 uint32_t curr_Hyp:1; /**< current Hyp flag (used if not in present packet) */
102 uint32_t updated:1; /**< context updated */
103 uint32_t updated_c:1; /**< updated CtxtID */
104 uint32_t updated_v:1; /**< updated VMID */
106 uint32_t ctxtID; /**< Context ID */
107 uint8_t VMID; /**< VMID */
111 typedef struct _etmv3_data_t {
113 uint32_t value; /**< Data value */
114 ocsd_pkt_vaddr addr; /**< current data address */
117 uint32_t ooo_tag:2; /**< Out of order data tag. */
118 uint32_t be:1; /**< data transfers big-endian */
119 uint32_t update_be:1; /**< updated Be flag */
120 uint32_t update_addr:1; /**< updated address */
121 uint32_t update_dval:1; /**< updated data value */
125 typedef struct _etmv3_isync_t {
126 ocsd_iSync_reason reason;
128 uint32_t has_cycle_count:1; /**< updated cycle count */
129 uint32_t has_LSipAddress:1; /**< main address is load-store instuction, data address is overlapping instruction @ start of trace */
130 uint32_t no_address:1; /**< data only ISync */
134 typedef struct _ocsd_etmv3_pkt
136 ocsd_etmv3_pkt_type type; /**< Primary packet type. */
138 ocsd_isa curr_isa; /**< current ISA */
139 ocsd_isa prev_isa; /**< ISA in previous packet */
141 etmv3_context_t context; /**< current context */
142 ocsd_pkt_vaddr addr; /**< current Addr */
144 etmv3_isync_t isync_info;
146 ocsd_etmv3_excep exception;
148 ocsd_pkt_atom atom; /**< atom elements - non zerom number indicates valid atom count */
149 uint8_t p_hdr_fmt; /**< if atom elements, associated phdr format */
150 uint32_t cycle_count; /**< cycle count associated with this packet (ETMv3 has counts in atom packets and as individual packets */
152 uint64_t timestamp; /**< current timestamp value */
153 uint8_t ts_update_bits; /**< bits of ts updated this packet (if TS packet) */
155 etmv3_data_t data; /**< data transfer values */
157 ocsd_etmv3_pkt_type err_type; /**< Basic packet type if primary type indicates error or incomplete. (header type) */
161 typedef struct _ocsd_etmv3_cfg
163 uint32_t reg_idr; /**< ID register */
164 uint32_t reg_ctrl; /**< Control Register */
165 uint32_t reg_ccer; /**< CCER register */
166 uint32_t reg_trc_id; /**< Trace Stream ID register */
167 ocsd_arch_version_t arch_ver; /**< Architecture version */
168 ocsd_core_profile_t core_prof; /**< Core Profile */
172 #define DATA_ADDR_EXPECTED_FLAG 0x20 /**< Bit set for data trace headers if data address packets follow */
176 #endif // ARM_TRC_ETM3_PKT_TYPES_ETMV3_H_INCLUDED
178 /* End of File trc_pkt_types_etmv3.h */