aboutsummaryrefslogtreecommitdiff
path: root/decoder/include/common
diff options
context:
space:
mode:
Diffstat (limited to 'decoder/include/common')
-rw-r--r--decoder/include/common/ocsd_dcd_mngr.h49
-rw-r--r--decoder/include/common/ocsd_dcd_tree.h29
-rw-r--r--decoder/include/common/ocsd_error.h11
-rw-r--r--decoder/include/common/trc_core_arch_map.h29
-rw-r--r--decoder/include/common/trc_frame_deformatter.h7
-rw-r--r--decoder/include/common/trc_gen_elem.h14
-rw-r--r--decoder/include/common/trc_pkt_decode_base.h9
-rw-r--r--decoder/include/common/trc_pkt_proc_base.h48
8 files changed, 161 insertions, 35 deletions
diff --git a/decoder/include/common/ocsd_dcd_mngr.h b/decoder/include/common/ocsd_dcd_mngr.h
index 3342eacb24ca..34c4ef1dc1c4 100644
--- a/decoder/include/common/ocsd_dcd_mngr.h
+++ b/decoder/include/common/ocsd_dcd_mngr.h
@@ -80,16 +80,16 @@ public:
private:
- ocsd_trace_protocol_t m_builtInProtocol; //!< Protocol ID if built in type.
+ const ocsd_trace_protocol_t m_builtInProtocol; //!< Protocol ID if built in type.
};
template <class P, class Pt, class Pc>
-DecoderMngrBase<P,Pt,Pc>::DecoderMngrBase(const std::string &decoderTypeName, ocsd_trace_protocol_t builtInProtocol)
+ DecoderMngrBase<P,Pt,Pc>::DecoderMngrBase(const std::string &decoderTypeName, ocsd_trace_protocol_t builtInProtocol) :
+ m_builtInProtocol(builtInProtocol)
{
OcsdLibDcdRegister *pDcdReg = OcsdLibDcdRegister::getDecoderRegister();
if(pDcdReg)
pDcdReg->registerDecoderTypeByName(decoderTypeName,this);
- m_builtInProtocol = builtInProtocol;
}
template <class P, class Pt, class Pc>
@@ -362,6 +362,49 @@ public:
}
};
+/* full decode - extended config object - base + derived. */
+template< class P, // Packet class.
+ class Pt, // Packet enum type ID.
+ class Pc, // Processor config base class.
+ class PcEx, // Processor config derived class
+ class PcSt, // Processor config struct type
+ class PktProc, // Packet processor class.
+ class PktDcd> // Packet decoder class.
+ class DecodeMngrFullDcdExCfg : public DecoderMngrBase<P, Pt, Pc>
+{
+public:
+ DecodeMngrFullDcdExCfg(const std::string &name, ocsd_trace_protocol_t builtInProtocol)
+ : DecoderMngrBase<P, Pt, Pc>(name, builtInProtocol) {};
+
+ virtual ~DecodeMngrFullDcdExCfg() {};
+
+ virtual TraceComponent *createPktProc(const bool useInstID, const int instID)
+ {
+ TraceComponent *pComp;
+ if (useInstID)
+ pComp = new (std::nothrow) PktProc(instID);
+ else
+ pComp = new (std::nothrow) PktProc();
+ return pComp;
+ }
+
+ virtual TraceComponent *createPktDecode(const bool useInstID, const int instID)
+ {
+ TraceComponent *pComp;
+ if (useInstID)
+ pComp = new (std::nothrow)PktDcd(instID);
+ else
+ pComp = new (std::nothrow)PktDcd();
+ return pComp;
+ }
+
+ virtual CSConfig *createConfig(const void *pDataStruct)
+ {
+ return new (std::nothrow) PcEx((PcSt *)pDataStruct);
+ }
+};
+
+
/****************************************************************************************************/
/* Packet processor only, templated base for creating decoder objects */
/****************************************************************************************************/
diff --git a/decoder/include/common/ocsd_dcd_tree.h b/decoder/include/common/ocsd_dcd_tree.h
index e4e74f2bc659..b1c3dc601cab 100644
--- a/decoder/include/common/ocsd_dcd_tree.h
+++ b/decoder/include/common/ocsd_dcd_tree.h
@@ -168,6 +168,30 @@ public:
*/
ocsd_err_t removeDecoder(const uint8_t CSID);
+ /*!
+ * Get the stats block for the channel indicated.
+ * Caller must check p_stats_block->version to esure that the block
+ * is filled in a compatible manner.
+ *
+ * @param CSID : Configured CoreSight trace ID for the decoder.
+ * @param p_stats_block: block pointer to set to reference the stats block.
+ *
+ * @return ocsd_err_t : Library error code - OCSD_OK if valid block pointer returned,
+ * OCSD_ERR_NOTINIT if decoder does not support stats counting.
+ */
+ ocsd_err_t getDecoderStats(const uint8_t CSID, ocsd_decode_stats_t **p_stats_block);
+
+ /*!
+ * Reset the stats block for the chosens decode channel.
+ * stats block is reset independently of the decoder reset to allow counts across
+ * multiple decode runs.
+ *
+ * @param handle : Handle to decode tree.
+ * @param CSID : Configured CoreSight trace ID for the decoder.
+ *
+ * @return ocsd_err_t : Library error code - OCSD_OK if successful.
+ */
+ ocsd_err_t resetDecoderStats(const uint8_t CSID);
/* get decoder elements currently in use */
@@ -387,7 +411,7 @@ private:
void destroyMemAccMapper();
ocsd_err_t initCallbackMemAcc(const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address,
const ocsd_mem_space_acc_t mem_space, void *p_cb_func, bool IDfn, const void *p_context);
-
+ TrcPktProcI *getPktProcI(const uint8_t CSID);
ocsd_dcd_tree_src_t m_dcd_tree_type;
@@ -417,6 +441,9 @@ private:
/**! default instruction decoder */
static TrcIDecode s_instruction_decoder;
+
+ /**! demux stats block */
+ ocsd_demux_stats_t m_demux_stats;
};
/** @}*/
diff --git a/decoder/include/common/ocsd_error.h b/decoder/include/common/ocsd_error.h
index e547f4878033..7c6ed3af141f 100644
--- a/decoder/include/common/ocsd_error.h
+++ b/decoder/include/common/ocsd_error.h
@@ -108,6 +108,17 @@ inline ocsdError& ocsdError::operator=(const ocsdError &err)
return (*this = &err);
}
+/* class to get data path response values as strings */
+class ocsdDataRespStr
+{
+public:
+ ocsdDataRespStr(ocsd_datapath_resp_t type) { m_type = type; }
+ ~ocsdDataRespStr() {};
+
+ const char* getStr();
+private:
+ ocsd_datapath_resp_t m_type;
+};
/** @}*/
diff --git a/decoder/include/common/trc_core_arch_map.h b/decoder/include/common/trc_core_arch_map.h
index b72b4b411fa4..aa976c39f908 100644
--- a/decoder/include/common/trc_core_arch_map.h
+++ b/decoder/include/common/trc_core_arch_map.h
@@ -53,7 +53,8 @@
*
* Valid architecture profile names are:-
* - ARMv7-A, ARMv7-R, ARMv7-M;
- * - ARMv8-A, ARMv8.3A, ARMv8-R, ARMv8-M;
+ * - ARMv8-A, ARMv8.x-A, ARMv8-R, ARMv8-M;
+ * - ARM-AA64, ARM-aa64
*
*/
class CoreArchProfileMap
@@ -65,36 +66,12 @@ public:
ocsd_arch_profile_t getArchProfile(const std::string &coreName);
private:
+ ocsd_arch_profile_t getPatternMatchCoreName(const std::string &coreName);
std::map<std::string, ocsd_arch_profile_t> core_profiles;
std::map<std::string, ocsd_arch_profile_t> arch_profiles;
};
-inline ocsd_arch_profile_t CoreArchProfileMap::getArchProfile(const std::string &coreName)
-{
- ocsd_arch_profile_t ap = { ARCH_UNKNOWN, profile_Unknown };
- bool bFound = false;
-
- std::map<std::string, ocsd_arch_profile_t>::const_iterator it;
-
- /* match against the core name map. */
- it = core_profiles.find(coreName);
- if (it != core_profiles.end())
- {
- ap = it->second;
- bFound = true;
- }
-
- /* scan architecture profiles on no core name match */
- if (!bFound)
- {
- it = arch_profiles.find(coreName);
- if (it != arch_profiles.end())
- ap = it->second;
- }
- return ap;
-}
-
#endif // ARM_TRC_CORE_ARCH_MAP_H_INCLUDED
/* End of File trc_core_arch_map.h */
diff --git a/decoder/include/common/trc_frame_deformatter.h b/decoder/include/common/trc_frame_deformatter.h
index e4297a41e8fd..cb2960fcdd07 100644
--- a/decoder/include/common/trc_frame_deformatter.h
+++ b/decoder/include/common/trc_frame_deformatter.h
@@ -73,6 +73,9 @@ public:
componentAttachPt<ITraceErrorLog> *getErrLogAttachPt();
+ /* init decoder implementation object */
+ ocsd_err_t Init();
+
/* configuration - set operational mode for incoming stream (has FSYNCS etc) */
ocsd_err_t Configure(uint32_t cfg_flags);
const uint32_t getConfigFlags() const;
@@ -85,9 +88,13 @@ public:
ocsd_datapath_resp_t Reset(); /* reset the decode to the start state, drop partial data - propogate to attached components */
ocsd_datapath_resp_t Flush(); /* flush existing data if possible, retain state - propogate to attached components */
+ /* demux stats */
+ void SetDemuxStatsBlock(ocsd_demux_stats_t *pStatsBlock);
+
private:
TraceFmtDcdImpl *m_pDecoder;
int m_instNum;
+
};
/** @}*/
diff --git a/decoder/include/common/trc_gen_elem.h b/decoder/include/common/trc_gen_elem.h
index 5d8983a8c274..405abfef8341 100644
--- a/decoder/include/common/trc_gen_elem.h
+++ b/decoder/include/common/trc_gen_elem.h
@@ -69,19 +69,22 @@ public:
void setExcepMarker() { excep_data_marker = 1; };
void setExceptionNum(uint32_t excepNum) { exception_number = excepNum; };
-
-
void setTraceOnReason(const trace_on_reason_t reason);
void setUnSyncEOTReason(const unsync_info_t reason);
+ void setTransactionType(const trace_memtrans_t trans) { mem_trans = trans; };
void setAddrRange(const ocsd_vaddr_t st_addr, const ocsd_vaddr_t en_addr, const int num_instr = 1);
void setLastInstrInfo(const bool exec, const ocsd_instr_type last_i_type, const ocsd_instr_subtype last_i_subtype, const uint8_t size);
- void setAddrStart(const ocsd_vaddr_t st_addr) { this->st_addr = st_addr; };
+ void setAddrStart(const ocsd_vaddr_t st_addr) { this->st_addr = st_addr; };
void setLastInstrCond(const int is_cond) { this->last_instr_cond = is_cond; };
void setSWTInfo(const ocsd_swt_info_t swt_info) { sw_trace_info = swt_info; };
void setExtendedDataPtr(const void *data_ptr);
+ void setITEInfo(const trace_sw_ite_t sw_instrumentation) { sw_ite = sw_instrumentation; };
+
+ void setSyncMarker(const trace_marker_payload_t &marker);
+
// stringize the element
virtual void toString(std::string &str) const;
@@ -208,6 +211,11 @@ inline void OcsdTraceElement::setExtendedDataPtr(const void *data_ptr)
ptr_extended_data = data_ptr;
}
+inline void OcsdTraceElement::setSyncMarker(const trace_marker_payload_t &marker)
+{
+ sync_marker = marker;
+}
+
// set persistent data between output packets.
inline void OcsdTraceElement::copyPersistentData(const OcsdTraceElement &src)
{
diff --git a/decoder/include/common/trc_pkt_decode_base.h b/decoder/include/common/trc_pkt_decode_base.h
index da702068f372..24ea2b05a6f9 100644
--- a/decoder/include/common/trc_pkt_decode_base.h
+++ b/decoder/include/common/trc_pkt_decode_base.h
@@ -96,6 +96,7 @@ protected:
/* target access */
ocsd_err_t accessMemory(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, uint32_t *num_bytes, uint8_t *p_buffer);
+ ocsd_err_t invalidateMemAccCache();
/* instruction decode */
ocsd_err_t instrDecode(ocsd_instr_info *instr_info);
@@ -180,6 +181,14 @@ inline ocsd_err_t TrcPktDecodeI::accessMemory(const ocsd_vaddr_t address, const
return OCSD_ERR_DCD_INTERFACE_UNUSED;
}
+inline ocsd_err_t TrcPktDecodeI::invalidateMemAccCache()
+{
+ if (!m_uses_memaccess)
+ return OCSD_ERR_DCD_INTERFACE_UNUSED;
+ m_mem_access.first()->InvalidateMemAccCache(getCoreSightTraceID());
+ return OCSD_OK;
+}
+
/**********************************************************************/
template <class P, class Pc>
class TrcPktDecodeBase : public TrcPktDecodeI, public IPktDataIn<P>
diff --git a/decoder/include/common/trc_pkt_proc_base.h b/decoder/include/common/trc_pkt_proc_base.h
index 3098a3d0c0ea..8ed7d83b2d5a 100644
--- a/decoder/include/common/trc_pkt_proc_base.h
+++ b/decoder/include/common/trc_pkt_proc_base.h
@@ -43,6 +43,7 @@
#include "trc_component.h"
#include "comp_attach_pt_t.h"
+#include "opencsd/ocsd_if_version.h"
/** @defgroup ocsd_pkt_proc OpenCSD Library : Packet Processors.
@brief Classes providing Protocol Packet Processing capability.
@@ -76,6 +77,8 @@ public:
const uint8_t *pDataBlock,
uint32_t *numBytesProcessed) = 0;
+ virtual ocsd_err_t getStatsBlock(ocsd_decode_stats_t **pp_stats) = 0;
+ virtual void resetStats() = 0;
protected:
/* implementation packet processing interface */
@@ -155,6 +158,10 @@ public:
//!< Get the configuration for the decoder.
virtual const Pc *getProtocolConfig() const { return m_config; };
+/* stats block access - derived class must init stats for the block to be returned. */
+ virtual ocsd_err_t getStatsBlock(ocsd_decode_stats_t **pp_stats);
+ virtual void resetStats(); /* reset the counts - operates separately from decoder reset. */
+
protected:
/* data output functions */
@@ -183,6 +190,14 @@ protected:
const bool checkInit(); // return true if init (configured and at least one output sink attached), false otherwise.
+ /* stats block updates - called by derived protocol specific decoder */
+ void statsAddTotalCount(const uint64_t count) { m_stats.channel_total += count; };
+ void statsAddUnsyncCount(const uint64_t count) { m_stats.channel_unsynced += count; };
+ void statsAddBadSeqCount(const uint32_t count) { m_stats.bad_sequence_errs += count; };
+ void statsAddBadHdrCount(const uint32_t count) { m_stats.bad_header_errs += count; };
+ void statsInit() { m_stats_init = true; }; /* mark stats as in use */
+
+
private:
/* decode control */
ocsd_datapath_resp_t Reset(const ocsd_trc_index_t index);
@@ -195,20 +210,29 @@ private:
componentAttachPt<ITrcPktIndexer<Pt>> m_pkt_indexer_i;
bool m_b_is_init;
+
+ /* decode statistics block */
+ ocsd_decode_stats_t m_stats;
+ bool m_stats_init; /*< true if the specific decoder is using the stats */
+
};
template<class P,class Pt, class Pc> TrcPktProcBase<P, Pt, Pc>::TrcPktProcBase(const char *component_name) :
TrcPktProcI(component_name),
m_config(0),
- m_b_is_init(false)
+ m_b_is_init(false),
+ m_stats_init(false)
{
+ resetStats();
}
template<class P,class Pt, class Pc> TrcPktProcBase<P, Pt, Pc>::TrcPktProcBase(const char *component_name, int instIDNum) :
TrcPktProcI(component_name, instIDNum),
m_config(0),
- m_b_is_init(false)
+ m_b_is_init(false),
+ m_stats_init(false)
{
+ resetStats();
}
template<class P,class Pt, class Pc> TrcPktProcBase<P, Pt, Pc>::~TrcPktProcBase()
@@ -405,6 +429,26 @@ template<class P,class Pt, class Pc> const bool TrcPktProcBase<P, Pt, Pc>::check
return m_b_is_init;
}
+template<class P,class Pt, class Pc> ocsd_err_t TrcPktProcBase<P, Pt, Pc>::getStatsBlock(ocsd_decode_stats_t **pp_stats)
+{
+
+ *pp_stats = &m_stats;
+ return m_stats_init ? OCSD_OK : OCSD_ERR_NOT_INIT;
+}
+
+template<class P,class Pt, class Pc> void TrcPktProcBase<P, Pt, Pc>::resetStats()
+{
+ m_stats.version = OCSD_VER_NUM;
+ m_stats.revision = OCSD_STATS_REVISION;
+ m_stats.channel_total = 0;
+ m_stats.channel_unsynced = 0;
+ m_stats.bad_header_errs = 0;
+ m_stats.bad_sequence_errs = 0;
+ m_stats.demux.frame_bytes = 0;
+ m_stats.demux.no_id_bytes = 0;
+ m_stats.demux.valid_id_bytes = 0;
+}
+
/** @}*/
#endif // ARM_TRC_PKT_PROC_BASE_H_INCLUDED