PDK API Guide for J721E
sciclient_priv.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018-2022 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 
46 #ifndef SCICLIENT_PRIV_H_
47 #define SCICLIENT_PRIV_H_
48 
49 /* ========================================================================== */
50 /* Include Files */
51 /* ========================================================================== */
52 
53 #include <stdint.h>
54 #include <ti/csl/hw_types.h>
55 #include <ti/csl/csl_sec_proxy.h>
56 #include <ti/osal/osal.h>
57 #include <ti/osal/SemaphoreP.h>
58 #include <ti/osal/CacheP.h>
59 #include <ti/osal/RegisterIntr.h>
60 
63 #include <ti/drv/sciclient/soc/sciclient_soc_priv.h>
64 
65 #if defined (SOC_AM65XX)
66 #include <ti/drv/sciclient/soc/V0/sciclient_defaultBoardcfg.h>
67 #endif
68 
69 #if defined (SOC_J721E)
71 #endif
72 
73 #if defined (SOC_J7200)
74 #include <ti/drv/sciclient/soc/V2/sciclient_defaultBoardcfg.h>
75 #endif
76 
77 #if defined (SOC_AM64X)
78 #include <ti/drv/sciclient/soc/V3/sciclient_defaultBoardcfg.h>
79 #endif
80 
81 #if defined (SOC_J721S2)
82 #include <ti/drv/sciclient/soc/V4/sciclient_defaultBoardcfg.h>
83 #endif
84 
85 #if defined (SOC_J784S4)
86 #include <ti/drv/sciclient/soc/V6/sciclient_defaultBoardcfg.h>
87 #endif
88 
89 #ifdef __cplusplus
90 extern "C" {
91 #endif
92 
93 /* ========================================================================== */
94 /* Macros & Typedefs */
95 /* ========================================================================== */
96 
101 #define SCICLIENT_MAX_QUEUE_SIZE (7U)
102 
103 /* Current context is SECURE */
104 #define SCICLIENT_SECURE_CONTEXT (0U)
105 
106 /* Current context is NON-SECURE */
107 #define SCICLIENT_NON_SECURE_CONTEXT (1U)
108 
109 /* ========================================================================== */
110 /* Structure Declarations */
111 /* ========================================================================== */
112 
116 typedef struct
117 {
118  uint32_t context;
121  uint32_t hostId;
123 #if !defined (SOC_AM64X)
126 #endif
130 #if !defined (SOC_AM64X)
135 #endif
136  uint32_t respThreadId;
139 #if !defined (SOC_AM64X)
142 #endif
143  uint32_t respIntrNum;
145 #if defined (BUILD_C7X)
146  uint32_t c7xEvtIn;
148 #endif
150 
154 typedef struct
155 {
164  uint32_t currSeqId;
168  HwiP_Handle respIntr[2];
170  uint32_t opModeFlag;
174  uint8_t initCount;
179  uint32_t isSecureMode;
183 #if defined(BUILD_MCU1_0) && (defined(SOC_J721E) || defined(SOC_J7200) || defined(SOC_J721S2) || defined (SOC_J784S4))
184  uint32_t pmBoardConfigComplete;
186  uint32_t rmBoardConfigComplete;
188 #endif
189 #if defined(_TMS320C6X)
190  uint32_t c66xRatRegion;
192 #endif
194 
195 
204 /* @} */
205 
206 /* ========================================================================== */
207 /* Function Declarations */
208 /* ========================================================================== */
209 
220 int32_t Sciclient_boardCfg(const Sciclient_BoardCfgPrms_t * pInPrms);
221 
234 uint32_t Sciclient_getCurrentContext(uint16_t messageType);
235 
243 #ifdef QNX_OS
244 uintptr_t Sciclient_threadStatusReg(uint32_t thread);
245 #else
246 uint32_t Sciclient_threadStatusReg(uint32_t thread);
247 #endif
248 
257 uint32_t Sciclient_readThread32(uint32_t thread, uint8_t idx);
258 
266 uint32_t Sciclient_readThreadCount(uint32_t thread);
267 
276 int32_t Sciclient_verifyThread(uint32_t thread);
277 
286 int32_t Sciclient_waitThread(uint32_t thread, uint32_t timeout);
287 
301 void Sciclient_sendMessage(uint32_t thread,
302  const uint8_t *pSecHeader,
303  const uint8_t secHeaderSizeWords,
304  const uint8_t *pHeader,
305  const uint8_t *pPayload,
306  uint32_t payloadSize,
307  const uint32_t maxMsgSizeBytes);
308 
317 int32_t Sciclient_contextIdFromIntrNum(uint32_t intrNum);
318 
327 void Sciclient_flush(uint32_t thread, uint32_t maxMsgSizeBytes);
328 
329 
363 int32_t Sciclient_serviceSecureProxy(const Sciclient_ReqPrm_t *pReqPrm,
364  Sciclient_RespPrm_t *pRespPrm);
365 
377 int32_t Sciclient_serviceGetThreadIds (const Sciclient_ReqPrm_t *pReqPrm,
378  uint32_t *contextId,
379  uint32_t *txThread,
380  uint32_t *rxThread);
381 
394  uint8_t *localSeqId,
395  uint32_t contextId,
396  struct tisci_header **header);
397 
398 int32_t Sciclient_ProcessRmMessage(void *tx_msg);
399 int32_t Sciclient_ProcessPmMessage(const uint32_t reqFlags, void *tx_msg);
400 
401 #ifdef __cplusplus
402 }
403 #endif
404 
405 #endif /* #ifndef SCICLIENT_PRIV_H_*/
406 
407 /* @} */
uint16_t thread
Definition: tisci_rm_psil.h:157
uint32_t respThreadId
Definition: sciclient_priv.h:136
OS Abstraction Layer header.
Interrupt register routines.
const Sciclient_MapStruct_t gSciclientMap[SCICLIENT_CONTEXT_MAX_NUM]
Definition: sciclient_fmwSecureProxyMap.c:69
int32_t Sciclient_serviceSecureProxy(const Sciclient_ReqPrm_t *pReqPrm, Sciclient_RespPrm_t *pRespPrm)
This API allows communicating with the System firmware which can be called to perform various functio...
Output parameters for Sciclient_service function.
Definition: sciclient.h:491
This file contains prototypes for APIs contained as a part of SCICLIENT as well as the structures of ...
Cache Handling routines for the RTOS Porting Interface.
int32_t Sciclient_ProcessPmMessage(const uint32_t reqFlags, void *tx_msg)
HwiP_Handle notificationIntr
Definition: sciclient_priv.h:166
uint32_t Sciclient_readThreadCount(uint32_t thread)
Read the current thread count.
#define SCICLIENT_CONTEXT_MAX_NUM
Definition: sciclient_fmwMsgParams.h:139
uint32_t respIntrNum
Definition: sciclient_priv.h:143
uint32_t currSeqId
Definition: sciclient_priv.h:164
void * SemaphoreP_Handle
Opaque client reference to an instance of a SemaphoreP.
Definition: SemaphoreP.h:112
int32_t Sciclient_verifyThread(uint32_t thread)
Validate thread has no errors and has space to accept the next message.
void * HwiP_Handle
Opaque client reference to an instance of a HwiP.
Definition: HwiP.h:81
int32_t Sciclient_boardCfg(const Sciclient_BoardCfgPrms_t *pInPrms)
API to send the board configuration messsage to the firmware . Valid(not NULL) pointer to Sciclient_B...
uint32_t reqHighPrioThreadId
Definition: sciclient_priv.h:124
int32_t Sciclient_ProcessRmMessage(void *tx_msg)
uint8_t initCount
Definition: sciclient_priv.h:174
uint32_t opModeFlag
Definition: sciclient_priv.h:170
uint32_t Sciclient_threadStatusReg(uint32_t thread)
Gives the address for status register for a particular thread.
uint32_t isSecureMode
Definition: sciclient_priv.h:179
uint32_t notificationThreadId
Definition: sciclient_priv.h:140
Map structure used by Sciclient_init function.
Definition: sciclient_priv.h:116
Semaphore module for the RTOS Porting Interface.
#define SCICLIENT_MAX_QUEUE_SIZE
Maximum number of messages waiting to be read. Cannot be greater than 256.
Definition: sciclient_priv.h:101
This file contains the declaration of the messaging format to talk to ROM.
Handle for Sciclient_service function.
Definition: sciclient_priv.h:154
uint32_t reqLowPrioThreadId
Definition: sciclient_priv.h:127
int32_t Sciclient_servicePrepareHeader(const Sciclient_ReqPrm_t *pReqPrm, uint8_t *localSeqId, uint32_t contextId, struct tisci_header **header)
Sciclient_servicePrepareHeader Prepares the Message Header.
int32_t Sciclient_waitThread(uint32_t thread, uint32_t timeout)
Check if there are credits to write to the thread.
uint32_t hostId
Definition: sciclient_priv.h:121
int32_t SemaphoreP_Status
Status codes for SemaphoreP APIs.
Definition: SemaphoreP.h:84
Parameters for Sciclient_boardCfg Pointer to this is passed to Sciclient_boardCfg.
Definition: sciclient_boardcfg.h:58
uint32_t notificationRespThreadId
Definition: sciclient_priv.h:131
void Sciclient_sendMessage(uint32_t thread, const uint8_t *pSecHeader, const uint8_t secHeaderSizeWords, const uint8_t *pHeader, const uint8_t *pPayload, uint32_t payloadSize, const uint32_t maxMsgSizeBytes)
API to send the message to the thread.
uint32_t context
Definition: sciclient_priv.h:118
int32_t Sciclient_contextIdFromIntrNum(uint32_t intrNum)
This utility function would find the proxy map context id for 'gSciclientMap' corresponding to a part...
uint32_t Sciclient_getCurrentContext(uint16_t messageType)
API to identify which mode the CPU is operating in. This utility function would read CPU related regi...
Input parameters for Sciclient_service function.
Definition: sciclient.h:467
File defining tisci_local_rm_boardcfg for boardCfg RM .
int32_t Sciclient_serviceGetThreadIds(const Sciclient_ReqPrm_t *pReqPrm, uint32_t *contextId, uint32_t *txThread, uint32_t *rxThread)
Sciclient_serviceGetThreadIds Gets the threads used for message.
void Sciclient_flush(uint32_t thread, uint32_t maxMsgSizeBytes)
API to flush/remove all outstanding messages on a thread .
Header that prefixes all TISCI messages.
Definition: tisci_protocol.h:89
uint32_t Sciclient_readThread32(uint32_t thread, uint8_t idx)
Read a 32 bit word from the thread.
uint8_t header
Definition: icssg_priv.h:115