1*46e6e290SRuslan Bukin /*
2*46e6e290SRuslan Bukin * \file trc_cmp_cfg_ete.cpp
3*46e6e290SRuslan Bukin * \brief OpenCSD : ETE config class
4*46e6e290SRuslan Bukin *
5*46e6e290SRuslan Bukin * \copyright Copyright (c) 2019, ARM Limited. All Rights Reserved.
6*46e6e290SRuslan Bukin */
7*46e6e290SRuslan Bukin
8*46e6e290SRuslan Bukin /*
9*46e6e290SRuslan Bukin * Redistribution and use in source and binary forms, with or without modification,
10*46e6e290SRuslan Bukin * are permitted provided that the following conditions are met:
11*46e6e290SRuslan Bukin *
12*46e6e290SRuslan Bukin * 1. Redistributions of source code must retain the above copyright notice,
13*46e6e290SRuslan Bukin * this list of conditions and the following disclaimer.
14*46e6e290SRuslan Bukin *
15*46e6e290SRuslan Bukin * 2. Redistributions in binary form must reproduce the above copyright notice,
16*46e6e290SRuslan Bukin * this list of conditions and the following disclaimer in the documentation
17*46e6e290SRuslan Bukin * and/or other materials provided with the distribution.
18*46e6e290SRuslan Bukin *
19*46e6e290SRuslan Bukin * 3. Neither the name of the copyright holder nor the names of its contributors
20*46e6e290SRuslan Bukin * may be used to endorse or promote products derived from this software without
21*46e6e290SRuslan Bukin * specific prior written permission.
22*46e6e290SRuslan Bukin *
23*46e6e290SRuslan Bukin * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
24*46e6e290SRuslan Bukin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25*46e6e290SRuslan Bukin * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26*46e6e290SRuslan Bukin * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27*46e6e290SRuslan Bukin * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28*46e6e290SRuslan Bukin * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29*46e6e290SRuslan Bukin * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30*46e6e290SRuslan Bukin * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31*46e6e290SRuslan Bukin * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32*46e6e290SRuslan Bukin * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33*46e6e290SRuslan Bukin */
34*46e6e290SRuslan Bukin
35*46e6e290SRuslan Bukin #include "opencsd/ete/trc_cmp_cfg_ete.h"
36*46e6e290SRuslan Bukin
ETEConfig()37*46e6e290SRuslan Bukin ETEConfig::ETEConfig() : EtmV4Config()
38*46e6e290SRuslan Bukin {
39*46e6e290SRuslan Bukin m_ete_cfg.reg_idr0 = 0x28000EA1;
40*46e6e290SRuslan Bukin m_ete_cfg.reg_idr1 = 0x4100FFF3;
41*46e6e290SRuslan Bukin m_ete_cfg.reg_idr2 = 0x00000488;
42*46e6e290SRuslan Bukin m_ete_cfg.reg_idr8 = 0;
43*46e6e290SRuslan Bukin m_ete_cfg.reg_configr = 0xC1;
44*46e6e290SRuslan Bukin m_ete_cfg.reg_traceidr = 0;
45*46e6e290SRuslan Bukin m_ete_cfg.arch_ver = ARCH_AA64;
46*46e6e290SRuslan Bukin m_ete_cfg.core_prof = profile_CortexA;
47*46e6e290SRuslan Bukin m_ete_cfg.reg_devarch = 0x47705A13;
48*46e6e290SRuslan Bukin copyV4();
49*46e6e290SRuslan Bukin }
50*46e6e290SRuslan Bukin
ETEConfig(const ocsd_ete_cfg * cfg_regs)51*46e6e290SRuslan Bukin ETEConfig::ETEConfig(const ocsd_ete_cfg *cfg_regs) : EtmV4Config()
52*46e6e290SRuslan Bukin {
53*46e6e290SRuslan Bukin m_ete_cfg = *cfg_regs;
54*46e6e290SRuslan Bukin copyV4();
55*46e6e290SRuslan Bukin }
56*46e6e290SRuslan Bukin
~ETEConfig()57*46e6e290SRuslan Bukin ETEConfig::~ETEConfig()
58*46e6e290SRuslan Bukin {
59*46e6e290SRuslan Bukin
60*46e6e290SRuslan Bukin }
61*46e6e290SRuslan Bukin
62*46e6e290SRuslan Bukin //! copy assignment operator for base structure into class.
operator =(const ocsd_ete_cfg * p_cfg)63*46e6e290SRuslan Bukin ETEConfig & ETEConfig::operator=(const ocsd_ete_cfg *p_cfg)
64*46e6e290SRuslan Bukin {
65*46e6e290SRuslan Bukin m_ete_cfg = *p_cfg;
66*46e6e290SRuslan Bukin copyV4();
67*46e6e290SRuslan Bukin return *this;
68*46e6e290SRuslan Bukin }
69*46e6e290SRuslan Bukin
70*46e6e290SRuslan Bukin //! cast operator returning struct const reference
71*46e6e290SRuslan Bukin //operator const ocsd_ete_cfg &() const { return m_ete_cfg; };
72*46e6e290SRuslan Bukin //! cast operator returning struct const pointer
73*46e6e290SRuslan Bukin //operator const ocsd_ete_cfg *() const { return &m_ete_cfg; };
74*46e6e290SRuslan Bukin
75*46e6e290SRuslan Bukin // ete superset of etmv4 - move info to underlying structure.
copyV4()76*46e6e290SRuslan Bukin void ETEConfig::copyV4()
77*46e6e290SRuslan Bukin {
78*46e6e290SRuslan Bukin // copy over 1:1 regs
79*46e6e290SRuslan Bukin m_cfg.reg_idr0 = m_ete_cfg.reg_idr0;
80*46e6e290SRuslan Bukin m_cfg.reg_idr1 = m_ete_cfg.reg_idr1;
81*46e6e290SRuslan Bukin m_cfg.reg_idr2 = m_ete_cfg.reg_idr2;
82*46e6e290SRuslan Bukin m_cfg.reg_idr8 = m_ete_cfg.reg_idr8;
83*46e6e290SRuslan Bukin m_cfg.reg_idr9 = 0;
84*46e6e290SRuslan Bukin m_cfg.reg_idr10 = 0;
85*46e6e290SRuslan Bukin m_cfg.reg_idr11 = 0;
86*46e6e290SRuslan Bukin m_cfg.reg_idr12 = 0;
87*46e6e290SRuslan Bukin m_cfg.reg_idr13 = 0;
88*46e6e290SRuslan Bukin m_cfg.reg_configr = m_ete_cfg.reg_configr;
89*46e6e290SRuslan Bukin m_cfg.reg_traceidr = m_ete_cfg.reg_traceidr;
90*46e6e290SRuslan Bukin m_cfg.core_prof = m_ete_cfg.core_prof;
91*46e6e290SRuslan Bukin m_cfg.arch_ver = m_ete_cfg.arch_ver;
92*46e6e290SRuslan Bukin
93*46e6e290SRuslan Bukin // override major / minor version as part of devarch
94*46e6e290SRuslan Bukin m_MajVer = (uint8_t)((m_ete_cfg.reg_devarch & 0xF000) >> 12);
95*46e6e290SRuslan Bukin m_MinVer = (uint8_t)((m_ete_cfg.reg_devarch & 0xF0000) >> 16);
96*46e6e290SRuslan Bukin }
97*46e6e290SRuslan Bukin
98*46e6e290SRuslan Bukin /* End of File trc_cmp_cfg_ete.cpp */
99