xref: /freebsd/contrib/opencsd/decoder/source/ete/trc_cmp_cfg_ete.cpp (revision 46e6e290975f19ea62d03f90ac3e523af4dae557)
1 /*
2 * \file       trc_cmp_cfg_ete.cpp
3 * \brief      OpenCSD : ETE config class
4 *
5 * \copyright  Copyright (c) 2019, ARM Limited. All Rights Reserved.
6 */
7 
8 /*
9 * Redistribution and use in source and binary forms, with or without modification,
10 * are permitted provided that the following conditions are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
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.
18 *
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.
22 *
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.
33 */
34 
35 #include "opencsd/ete/trc_cmp_cfg_ete.h"
36 
ETEConfig()37 ETEConfig::ETEConfig() : EtmV4Config()
38 {
39     m_ete_cfg.reg_idr0 = 0x28000EA1;
40     m_ete_cfg.reg_idr1 = 0x4100FFF3;
41     m_ete_cfg.reg_idr2 = 0x00000488;
42     m_ete_cfg.reg_idr8 = 0;
43     m_ete_cfg.reg_configr = 0xC1;
44     m_ete_cfg.reg_traceidr = 0;
45     m_ete_cfg.arch_ver = ARCH_AA64;
46     m_ete_cfg.core_prof = profile_CortexA;
47     m_ete_cfg.reg_devarch = 0x47705A13;
48     copyV4();
49 }
50 
ETEConfig(const ocsd_ete_cfg * cfg_regs)51 ETEConfig::ETEConfig(const ocsd_ete_cfg *cfg_regs) : EtmV4Config()
52 {
53     m_ete_cfg = *cfg_regs;
54     copyV4();
55 }
56 
~ETEConfig()57 ETEConfig::~ETEConfig()
58 {
59 
60 }
61 
62 //! copy assignment operator for base structure into class.
operator =(const ocsd_ete_cfg * p_cfg)63 ETEConfig & ETEConfig::operator=(const ocsd_ete_cfg *p_cfg)
64 {
65     m_ete_cfg = *p_cfg;
66     copyV4();
67     return *this;
68 }
69 
70 //! cast operator returning struct const reference
71 //operator const ocsd_ete_cfg &() const { return m_ete_cfg; };
72 //! cast operator returning struct const pointer
73 //operator const ocsd_ete_cfg *() const { return &m_ete_cfg; };
74 
75 // ete superset of etmv4 - move info to underlying structure.
copyV4()76 void ETEConfig::copyV4()
77 {
78     // copy over 1:1 regs
79     m_cfg.reg_idr0 = m_ete_cfg.reg_idr0;
80     m_cfg.reg_idr1 = m_ete_cfg.reg_idr1;
81     m_cfg.reg_idr2 = m_ete_cfg.reg_idr2;
82     m_cfg.reg_idr8 = m_ete_cfg.reg_idr8;
83     m_cfg.reg_idr9 = 0;
84     m_cfg.reg_idr10 = 0;
85     m_cfg.reg_idr11 = 0;
86     m_cfg.reg_idr12 = 0;
87     m_cfg.reg_idr13 = 0;
88     m_cfg.reg_configr = m_ete_cfg.reg_configr;
89     m_cfg.reg_traceidr = m_ete_cfg.reg_traceidr;
90     m_cfg.core_prof = m_ete_cfg.core_prof;
91     m_cfg.arch_ver = m_ete_cfg.arch_ver;
92 
93     // override major / minor version as part of devarch
94     m_MajVer = (uint8_t)((m_ete_cfg.reg_devarch & 0xF000) >> 12);
95     m_MinVer = (uint8_t)((m_ete_cfg.reg_devarch & 0xF0000) >> 16);
96 }
97 
98 /* End of File trc_cmp_cfg_ete.cpp */
99