AM62Ax MCU+ SDK  11.01.00
safety_checkers_tifs.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
33 
34 
58 #ifndef SAFETY_CHECKERS_TIFS_H_
59 #define SAFETY_CHECKERS_TIFS_H_
60 
61 /* ========================================================================== */
62 /* Include Files */
63 /* ========================================================================== */
64 
65 /* None */
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
78 /* ========================================================================== */
79 /* Macros & Typedefs */
80 /* ========================================================================== */
81 
82 #define SAFETY_CHECKERS_TIFS_FWL_OPEN 0x902CU
83 #define SAFETY_CHECKERS_TIFS_FWL_CLOSE 0x902DU
84 
85 #define SAFETY_CHECKERS_TIFS_FWL_BASE 0x45000000U
86 #define SAFETY_CHECKERS_TIFS_CONTROL_REG 0x0U
87 #define SAFETY_CHECKERS_TIFS_PRIV_ID0 0x4U
88 #define SAFETY_CHECKERS_TIFS_PRIV_ID1 0x8U
89 #define SAFETY_CHECKERS_TIFS_PRIV_ID2 0xCU
90 #define SAFETY_CHECKERS_TIFS_START_ADDRL 0x10U
91 #define SAFETY_CHECKERS_TIFS_START_ADDRH 0x14U
92 #define SAFETY_CHECKERS_TIFS_END_ADDRL 0x18U
93 #define SAFETY_CHECKERS_TIFS_END_ADDRH 0x1CU
94 #define SAFETY_CHECKERS_TIFS_MAX_REGIONS 36U
95 
96 #define SAFETY_CHECKERS_TIFS_ISC_BASE 0x45800000U
97 #define SAFETY_CHECKERS_TIFS_CC_ISC_BASE 0x45828000U
98 #define SAFETY_CHECKERS_TIFS_ISC_CONTROL0_REG 0x0U
99 #define SAFETY_CHECKERS_TIFS_ISC_CONTROL1_REG 0x4U
100 #define SAFETY_CHECKERS_TIFS_ISC_PRIVID_REG 0x0U
101 #define SAFETY_CHECKERS_TIFS_ISC_PRIVID_LOCK_REG 0x4U
102 #define SAFETY_CHECKERS_TIFS_ISC_CBASS_MAX_REGIONS 32U
103 #define SAFETY_CHECKERS_TIFS_ISC_CCPRIV_MAX_REGION 255U
104 #define SAFETY_CHECKERS_TIFS_ISC_RA_MAX_ID 1024U
105 
106 
116 /* ========================================================================== */
117 /* Structure Declarations */
118 /* ========================================================================== */
119 
126 typedef struct
127 {
128  uint32_t controlReg; /* Region Control Register */
129  uint32_t privId0; /* Region Priv-ID 0 slot permission */
130  uint32_t privId1; /* Region Priv-ID 1 slot permission */
131  uint32_t privId2; /* Region Priv-ID 2 slot permission */
132  uint32_t startAddrLow; /* Region Start address Low */
133  uint32_t startAddrHigh; /* Region Start address High */
134  uint32_t endAddrLow; /* Region End address Low */
135  uint32_t endAddrHigh; /* Region End address High */
137 
144 typedef struct
145 {
146  uint32_t fwlId; /* Firewall id */
147  uint32_t numRegions; /* Number of regions stored in the firewall config for an id */
148  uint32_t maxNumRegions; /* Maximum number of regions present in an id */
149  SafetyCheckers_TifsFwlRegList fwlCfgPerRegion[SAFETY_CHECKERS_TIFS_MAX_REGIONS]; /* Firewall registers for a given region */
151 
158 typedef struct
159 {
160  uint32_t controlReg0; /* Region Control Register 0 */
161  uint32_t controlReg1; /* Region Control Register 1 */
162  uint32_t startAddrLow; /* Region Start address Low */
163  uint32_t startAddrHigh; /* Region Start address High */
164  uint32_t endAddrLow; /* Region End address Low */
165  uint32_t endAddrHigh; /* Region End address High */
167 
168 #if defined(SOC_J784S4) || defined(SOC_J721S2 )|| defined(SOC_J742S2)
169 
175 typedef struct {
176  uint32_t privId; /* Region contains privid to set */
177  uint32_t lock; /* Region contains lock privid setting */
178 }SafetyCheckers_TifsIscCcRegList;
179 #endif
180 
181 #if defined(SOC_J7200) || defined(SOC_J721E ) || defined(SOC_J721S2) || defined(SOC_J784S4) || defined(SOC_J742S2)
182 
188 typedef struct {
189  uint32_t controlReg1; /* Control Region 1 */
190  uint32_t controlReg2; /* Control Region 2 */
191 }SafetyCheckers_TifsIscRaRegList;
192 #endif
193 
200 typedef struct
201 {
202  uint32_t iscId; /* ISC id */
203  uint32_t numRegions; /* Number of regions stored in the ISC config for an id */
204  uint32_t maxNumRegions; /* Maximum number of regions present in an id */
205  SafetyCheckers_TifsIscCbassRegList iscCfgPerRegionCbass[SAFETY_CHECKERS_TIFS_ISC_CBASS_MAX_REGIONS]; /* ISC registers for a given region */
206  uint32_t rcr;
208 
209 #if defined(SOC_J784S4) || defined(SOC_J721S2 )|| defined(SOC_J742S2)
210 
216 typedef struct
217 {
218  uint32_t iscIdOffset; /* ISC id offset */
219  uint32_t numRegions; /* Number of regions stored in the ISC config for an id */
220  uint32_t maxNumRegions; /* Maximum number of regions present in an id */
221  SafetyCheckers_TifsIscCcRegList iscCfgPerRegionCc[SAFETY_CHECKERS_TIFS_ISC_CCPRIV_MAX_REGION]; /* ISC registers for a given region */
222 } SafetyCheckers_TifsIscCcConfig;
223 #endif
224 
225 #if defined(SOC_J7200) || defined(SOC_J721E ) || defined(SOC_J721S2) || defined(SOC_J784S4) || defined(SOC_J742S2)
226 
232 typedef struct
233 {
234  uint32_t iscId; /* ISC id */
235  uint32_t numRegions; /* Number of regions stored in the ISC config for an id */
236  uint32_t maxNumRegions; /* Maximum number of regions present in an id */
237  SafetyCheckers_TifsIscRaRegList iscCfgPerRegionRa[SAFETY_CHECKERS_TIFS_ISC_RA_MAX_ID]; /* ISC registers for a given region */
238 } SafetyCheckers_TifsIscRaConfig;
239 #endif
240 
250 /* ========================================================================== */
251 /* Function Declarations */
252 /* ========================================================================== */
253 
261 
275 
289 
290 #if defined(SOC_J784S4) || defined(SOC_J721S2 )|| defined(SOC_J742S2)
291 
303 int32_t SafetyCheckers_tifsGetIscCcCfg(SafetyCheckers_TifsIscCcConfig *iscConfig, uint32_t size);
304 #endif
305 
306 #if defined(SOC_J7200) || defined(SOC_J721E ) || defined(SOC_J721S2) || defined(SOC_J784S4) || defined(SOC_J742S2)
307 
319 int32_t SafetyCheckers_tifsGetIscRaCfg(SafetyCheckers_TifsIscRaConfig *iscConfig, uint32_t size);
320 #endif
321 
335 
349 
350 #if defined(SOC_J784S4) || defined(SOC_J721S2 )|| defined(SOC_J742S2)
351 
363 int32_t SafetyCheckers_tifsVerifyIscCcCfg(const SafetyCheckers_TifsIscCcConfig *iscConfig, uint32_t size);
364 #endif
365 
366 #if defined(SOC_J7200) || defined(SOC_J721E ) || defined(SOC_J721S2) || defined(SOC_J784S4) || defined(SOC_J742S2)
367 
379 int32_t SafetyCheckers_tifsVerifyIscRaCfg(const SafetyCheckers_TifsIscRaConfig *iscConfig, uint32_t size);
380 #endif
381 
390 
391 #ifdef __cplusplus
392 }
393 #endif
394 
395 #endif /* #ifndef SAFETY_CHECKERS_TIFS_H_ */
396 
SAFETY_CHECKERS_TIFS_ISC_CBASS_MAX_REGIONS
#define SAFETY_CHECKERS_TIFS_ISC_CBASS_MAX_REGIONS
Definition: safety_checkers_tifs.h:102
SafetyCheckers_tifsGetFwlCfg
int32_t SafetyCheckers_tifsGetFwlCfg(SafetyCheckers_TifsFwlConfig *fwlConfig, uint32_t size)
API uses the pointer to firewall configuration fwlConfig as input and updates fwlConfig with the regi...
SafetyCheckers_TifsFwlConfig::maxNumRegions
uint32_t maxNumRegions
Definition: safety_checkers_tifs.h:148
SafetyCheckers_TifsFwlConfig::numRegions
uint32_t numRegions
Definition: safety_checkers_tifs.h:147
size
uint16_t size
Definition: tisci_boardcfg.h:1
SafetyCheckers_tifsVerifyFwlCfg
int32_t SafetyCheckers_tifsVerifyFwlCfg(const SafetyCheckers_TifsFwlConfig *fwlConfig, uint32_t size)
API compares the fwlConfig (golden reference) with runtime firewall register values and return succes...
SafetyCheckers_TifsIscCbassRegList::endAddrLow
uint32_t endAddrLow
Definition: safety_checkers_tifs.h:164
SafetyCheckers_TifsFwlRegList::privId2
uint32_t privId2
Definition: safety_checkers_tifs.h:131
SafetyCheckers_TifsIscCbassConfig::numRegions
uint32_t numRegions
Definition: safety_checkers_tifs.h:203
SafetyCheckers_tifsReqFwlOpen
int32_t SafetyCheckers_tifsReqFwlOpen(void)
API to request TIFS to open firewall.
SafetyCheckers_TifsFwlRegList::privId0
uint32_t privId0
Definition: safety_checkers_tifs.h:129
SAFETY_CHECKERS_TIFS_ISC_CCPRIV_MAX_REGION
#define SAFETY_CHECKERS_TIFS_ISC_CCPRIV_MAX_REGION
Definition: safety_checkers_tifs.h:103
SafetyCheckers_TifsIscCbassConfig::rcr
uint32_t rcr
Definition: safety_checkers_tifs.h:206
SAFETY_CHECKERS_TIFS_MAX_REGIONS
#define SAFETY_CHECKERS_TIFS_MAX_REGIONS
Definition: safety_checkers_tifs.h:94
SafetyCheckers_TifsIscCbassRegList::startAddrHigh
uint32_t startAddrHigh
Definition: safety_checkers_tifs.h:163
SafetyCheckers_tifsReqFwlClose
int32_t SafetyCheckers_tifsReqFwlClose(void)
API to request TIFS to close firewall.
SafetyCheckers_TifsIscCbassRegList::controlReg1
uint32_t controlReg1
Definition: safety_checkers_tifs.h:161
SafetyCheckers_TifsIscCbassConfig::maxNumRegions
uint32_t maxNumRegions
Definition: safety_checkers_tifs.h:204
SafetyCheckers_TifsIscCbassRegList
Structure for CBASS ISC configuration registers for a given ISC region.
Definition: safety_checkers_tifs.h:159
SafetyCheckers_tifsGetIscCbassCfg
int32_t SafetyCheckers_tifsGetIscCbassCfg(SafetyCheckers_TifsIscCbassConfig *iscConfig, uint32_t size)
API uses the pointer to cbass isc configuration iscConfig as input and updates iscConfig with the reg...
SafetyCheckers_TifsIscCbassConfig
Structure for CBASS ISC configuration register info for a given ISC id.
Definition: safety_checkers_tifs.h:201
SafetyCheckers_TifsFwlRegList::privId1
uint32_t privId1
Definition: safety_checkers_tifs.h:130
SafetyCheckers_TifsFwlConfig
Structure for firewall configuration register info for a given firewall id.
Definition: safety_checkers_tifs.h:145
SafetyCheckers_TifsFwlRegList::startAddrLow
uint32_t startAddrLow
Definition: safety_checkers_tifs.h:132
SafetyCheckers_TifsIscCbassRegList::startAddrLow
uint32_t startAddrLow
Definition: safety_checkers_tifs.h:162
SAFETY_CHECKERS_TIFS_ISC_RA_MAX_ID
#define SAFETY_CHECKERS_TIFS_ISC_RA_MAX_ID
Definition: safety_checkers_tifs.h:104
SafetyCheckers_TifsFwlRegList::endAddrHigh
uint32_t endAddrHigh
Definition: safety_checkers_tifs.h:135
SafetyCheckers_TifsIscCbassRegList::endAddrHigh
uint32_t endAddrHigh
Definition: safety_checkers_tifs.h:165
SafetyCheckers_TifsFwlRegList::startAddrHigh
uint32_t startAddrHigh
Definition: safety_checkers_tifs.h:133
SafetyCheckers_TifsIscCbassConfig::iscId
uint32_t iscId
Definition: safety_checkers_tifs.h:202
SafetyCheckers_TifsFwlRegList::endAddrLow
uint32_t endAddrLow
Definition: safety_checkers_tifs.h:134
SafetyCheckers_TifsFwlConfig::fwlId
uint32_t fwlId
Definition: safety_checkers_tifs.h:146
SafetyCheckers_tifsVerifyIscCbassCfg
int32_t SafetyCheckers_tifsVerifyIscCbassCfg(const SafetyCheckers_TifsIscCbassConfig *iscConfig, uint32_t size)
API compares the cbass iscConfig (golden reference) with runtime isc register values and return succe...
SafetyCheckers_TifsFwlRegList
Structure for firewall configuration registers for a given firewall region.
Definition: safety_checkers_tifs.h:127
SafetyCheckers_TifsIscCbassRegList::controlReg0
uint32_t controlReg0
Definition: safety_checkers_tifs.h:160
SafetyCheckers_TifsFwlRegList::controlReg
uint32_t controlReg
Definition: safety_checkers_tifs.h:128