PSDK QNX API Guide
sciclient.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2020, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the 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 "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
151 /* @} */
152 
211 #ifndef SCICLIENT_H_
212 #define SCICLIENT_H_
213 
214 /* ========================================================================== */
215 /* Include Files */
216 /* ========================================================================== */
217 
218 #include <stdint.h>
219 #include <stddef.h>
220 
221 /* Windows Visual Studio build doesn't __attribute__ indentifier, so forcing it be to dummy for getting build working */
222 #ifdef _MSC_VER
223  #ifndef __attribute__
224  #define __attribute__()
225  #endif
226 #endif
227 
228 /* TISCI Include */
229 #define TISCI_BIT(n) (1UL << (n))
230 
235 typedef uint8_t domgrp_t;
236 
237 #ifndef SYSFW_DEVGRPS_H
242 typedef uint8_t devgrp_t;
243 
244 /* External definitions */
245 
250 #define DEVGRP_ALL (0x00U)
251 
253 #define DEVGRP_00 ((0x01U) << 0U)
255 #define DEVGRP_01 ((0x01U) << 1U)
257 #define DEVGRP_02 ((0x01U) << 2U)
259 #define DEVGRP_03 ((0x01U) << 3U)
261 #define DEVGRP_04 ((0x01U) << 4U)
263 #define DEVGRP_05 ((0x01U) << 5U)
265 #define DEVGRP_06 ((0x01U) << 6U)
266 
270 #define DEVGRP_DMSC ((0x01U) << 7U)
272 #define DEVGRP_DMSC_ALL (0xFFU)
273 
274 #endif
275 
277 #if defined(SOC_J721E) || defined(SOC_J7200)
278 #define SCICLIENT_COMMON_X509_HEADER_ADDR (0x41cffb00)
279 #elif defined(SOC_J721S2) || defined(SOC_J784S4)
280 #define SCICLIENT_COMMON_X509_HEADER_ADDR (0x41cfdb00)
281 #else
282 #define SCICLIENT_COMMON_X509_HEADER_ADDR (0x41cffb00)
283 #endif
284 
285 #define SCISERVER_COMMON_X509_HEADER_ADDR \
286  SCICLIENT_COMMON_X509_HEADER_ADDR
287 
292 #define MAX_NUM_DEVGRPS (8U)
293 
294 #include <ti/drv/sciclient/soc/sysfw/include/tisci/tisci_protocol.h>
295 #include <ti/drv/sciclient/soc/sysfw/include/tisci/tisci_boardcfg_macros.h>
296 #include <ti/drv/sciclient/soc/sysfw/include/tisci/tisci_boardcfg.h>
297 #include <ti/drv/sciclient/soc/sysfw/include/tisci/tisci_boardcfg_rm.h>
298 #include <ti/drv/sciclient/soc/sysfw/include/tisci/tisci_core.h>
299 #if defined (SOC_AM65XX)
300 #include <ti/drv/sciclient/soc/sysfw/include/am65x/tisci_resasg_types.h>
301 #include <ti/drv/sciclient/soc/sysfw/include/am65x/tisci_hosts.h>
302 #include <ti/drv/sciclient/soc/sysfw/include/am65x/tisci_sec_proxy.h>
303 #include <ti/drv/sciclient/soc/sysfw/include/am65x/tisci_boardcfg_constraints.h>
304 #include <ti/drv/sciclient/soc/sysfw/include/am65x/tisci_clocks.h>
305 #include <ti/drv/sciclient/soc/sysfw/include/am65x_sr2/tisci_clocks.h>
306 #endif
307 #if defined (SOC_J721E)
308 #include <ti/drv/sciclient/soc/sysfw/include/j721e/tisci_resasg_types.h>
309 #include <ti/drv/sciclient/soc/sysfw/include/j721e/tisci_hosts.h>
310 #include <ti/drv/sciclient/soc/sysfw/include/j721e/tisci_sec_proxy.h>
311 #include <ti/drv/sciclient/soc/sysfw/include/j721e/tisci_boardcfg_constraints.h>
312 #endif
313 #if defined (SOC_J7200)
314 #include <ti/drv/sciclient/soc/sysfw/include/j7200/tisci_resasg_types.h>
315 #include <ti/drv/sciclient/soc/sysfw/include/j7200/tisci_hosts.h>
316 #include <ti/drv/sciclient/soc/sysfw/include/j7200/tisci_sec_proxy.h>
317 #include <ti/drv/sciclient/soc/sysfw/include/j7200/tisci_boardcfg_constraints.h>
318 #endif
319 #if defined (SOC_AM64X)
320 #include <ti/drv/sciclient/soc/sysfw/include/am64x/tisci_resasg_types.h>
321 #include <ti/drv/sciclient/soc/sysfw/include/am64x/tisci_hosts.h>
322 #include <ti/drv/sciclient/soc/sysfw/include/am64x/tisci_sec_proxy.h>
323 #include <ti/drv/sciclient/soc/sysfw/include/am64x/tisci_boardcfg_constraints.h>
324 #endif
325 #if defined (SOC_J721S2)
326 #include <ti/drv/sciclient/soc/sysfw/include/j721s2/tisci_resasg_types.h>
327 #include <ti/drv/sciclient/soc/sysfw/include/j721s2/tisci_hosts.h>
328 #include <ti/drv/sciclient/soc/sysfw/include/j721s2/tisci_sec_proxy.h>
329 #include <ti/drv/sciclient/soc/sysfw/include/j721s2/tisci_boardcfg_constraints.h>
330 
331 /* Translate "DM2TIFS" to "DM2DMSC" related macros for existing sources */
332 #define TISCI_HOST_ID_DMSC2DM TISCI_HOST_ID_TIFS2DM
333 
334 #define TISCI_SEC_PROXY_DM2DMSC_WRITE_NOTIFY_RESP_THREAD_ID \
335  TISCI_SEC_PROXY_DM2TIFS_WRITE_NOTIFY_RESP_THREAD_ID
336 #define TISCI_SEC_PROXY_DM2DMSC_READ_RESPONSE_THREAD_ID \
337  TISCI_SEC_PROXY_DM2TIFS_READ_RESPONSE_THREAD_ID
338 #endif
339 #if defined (SOC_J784S4)
340 #include <ti/drv/sciclient/soc/sysfw/include/j784s4/tisci_resasg_types.h>
341 #include <ti/drv/sciclient/soc/sysfw/include/j784s4/tisci_hosts.h>
342 #include <ti/drv/sciclient/soc/sysfw/include/j784s4/tisci_sec_proxy.h>
343 #include <ti/drv/sciclient/soc/sysfw/include/j784s4/tisci_boardcfg_constraints.h>
344 
345 /* Translate "DM2TIFS" to "DM2DMSC" related macros for existing sources */
346 #define TISCI_HOST_ID_DMSC2DM TISCI_HOST_ID_TIFS2DM
347 
348 #define TISCI_SEC_PROXY_DM2DMSC_WRITE_NOTIFY_RESP_THREAD_ID \
349  TISCI_SEC_PROXY_DM2TIFS_WRITE_NOTIFY_RESP_THREAD_ID
350 #define TISCI_SEC_PROXY_DM2DMSC_READ_RESPONSE_THREAD_ID \
351  TISCI_SEC_PROXY_DM2TIFS_READ_RESPONSE_THREAD_ID
352 #endif
353 
354 #include <ti/drv/sciclient/soc/sysfw/include/tisci/security/tisci_sec_macros.h>
355 #include <ti/drv/sciclient/soc/sysfw/include/tisci/security/tisci_dkek.h>
356 #include <ti/drv/sciclient/soc/sysfw/include/tisci/security/tisci_ext_otp.h>
357 #include <ti/drv/sciclient/soc/sysfw/include/tisci/security/tisci_firewall.h>
358 #include <ti/drv/sciclient/soc/sysfw/include/tisci/security/tisci_keystore.h>
359 #include <ti/drv/sciclient/soc/sysfw/include/tisci/security/tisci_procboot.h>
360 #include <ti/drv/sciclient/soc/sysfw/include/tisci/security/tisci_sa2ul_rm.h>
361 #include <ti/drv/sciclient/soc/sysfw/include/tisci/security/tisci_sec_handover.h>
362 #include <ti/drv/sciclient/soc/sysfw/include/tisci/security/tisci_secure_jtag.h>
363 #include <ti/drv/sciclient/soc/sysfw/include/tisci/security/tisci_soc_uid.h>
364 #include <ti/drv/sciclient/soc/sysfw/include/tisci/security/tisci_keywriter.h>
365 #include <ti/drv/sciclient/soc/sysfw/include/tisci/security/tisci_dkek.h>
366 #include <ti/drv/sciclient/soc/sysfw/include/tisci/lpm/tisci_lpm.h>
367 #include <ti/drv/sciclient/soc/sysfw/include/tisci/pm/tisci_pm_clock.h>
368 #include <ti/drv/sciclient/soc/sysfw/include/tisci/pm/tisci_pm_device.h>
369 #include <ti/drv/sciclient/soc/sysfw/include/tisci/pm/tisci_pm_core.h>
370 #include <ti/drv/sciclient/soc/sysfw/include/tisci/rm/tisci_rm_ra.h>
371 #include <ti/drv/sciclient/soc/sysfw/include/tisci/rm/tisci_rm_irq.h>
372 #include <ti/drv/sciclient/soc/sysfw/include/tisci/rm/tisci_rm_udmap.h>
373 #include <ti/drv/sciclient/soc/sysfw/include/tisci/rm/tisci_rm_psil.h>
374 #include <ti/drv/sciclient/soc/sysfw/include/tisci/rm/tisci_rm_shared.h>
375 #include <ti/drv/sciclient/soc/sysfw/include/tisci/rm/tisci_rm_core.h>
376 #include <ti/drv/sciclient/soc/sysfw/include/tisci/rm/tisci_rm_proxy.h>
377 #include <ti/drv/sciclient/soc/sciclient_soc_priv.h>
378 #include <ti/drv/sciclient/include/sciclient_soc.h>
385 #include <ti/drv/sciclient/include/sciclient_boardcfg.h>
387 
388 #ifdef __cplusplus
389 extern "C" {
390 #endif
391 
392 /* ========================================================================== */
393 /* Macros & Typedefs */
394 /* ========================================================================== */
395 
408 #define SCICLIENT_SERVICE_OPERATION_MODE_POLLED (0U)
409 #define SCICLIENT_SERVICE_OPERATION_MODE_INTERRUPT (1U)
410 /* @} */
411 
421 #define SCICLIENT_SERVICE_WAIT_FOREVER (0xFFFFFFFFU)
422 #define SCICLIENT_SERVICE_NO_WAIT (0x0U)
423 /* @} */
424 
426 #define SCICLIENT_FT_PASS (0xA5A5U)
428 #define SCICLIENT_FT_FAIL (0x5A5AU)
429 
430 
431 /* ========================================================================== */
432 /* Structure Declarations */
433 /* ========================================================================== */
434 
439 typedef struct
440 {
441  uint32_t opModeFlag;
445  Sciclient_BoardCfgPrms_t * pBoardCfgPrms;
449  uint32_t isSecureMode;
453  uint32_t c66xRatRegion;
458  Sciclient_BoardCfgPrms_t inPmPrms;
460  Sciclient_BoardCfgPrms_t inRmPrms;
463 
467 typedef struct
468 {
469  uint16_t messageType;
471  uint32_t flags;
475  const uint8_t *pReqPayload;
477  uint32_t reqPayloadSize;
479  uint32_t timeout;
482  uint8_t forwardStatus;
487 
491 typedef struct
492 {
493  uint32_t flags;
495  uint8_t *pRespPayload;
501  uint32_t respPayloadSize;
504 
508 typedef struct
509 {
510  const uint32_t *boardCfgLow;
512  const uint32_t *boardCfgLowRm;
514  const uint32_t *boardCfgLowSec;
516  const uint32_t *boardCfgLowPm;
518  uint32_t boardCfgLowSize;
527 
528 /* ========================================================================== */
529 /* Function Declarations */
530 /* ========================================================================== */
531 
543 int32_t Sciclient_loadFirmware(const uint32_t *pSciclient_firmware);
544 
559 
580 int32_t Sciclient_init(const Sciclient_ConfigPrms_t *pCfgPrms);
581 
615 int32_t Sciclient_service(const Sciclient_ReqPrm_t *pReqPrm,
616  Sciclient_RespPrm_t *pRespPrm);
617 
618 #ifdef QNX_OS
652 int32_t Sciclient_service_rsmgr(const Sciclient_ReqPrm_t *pReqPrm,
653  Sciclient_RespPrm_t *pRespPrm);
654 #endif
655 
668 int32_t Sciclient_deinit(void);
669 
675 int32_t Sciclient_abiCheck(void);
676 
683 
684 /*
685  * Structure Init functions
686  *
687  * Requirement: DOX_REQ_TAG(PDK-2936)
688  */
696 
704 void Sciclient_TisciMsgSetAckResp(struct tisci_header *hdr);
705 
713 void Sciclient_TisciMsgSetNakResp(struct tisci_header *hdr);
714 
734  uint8_t * pCommonHeader, uint8_t * pBoardCfgHeader,
735  const Sciclient_BoardCfgPrms_t * pInPmPrms,
736  const Sciclient_BoardCfgPrms_t * pInRmPrms);
737 
750  uint8_t * pCommonHeader,
751  Sciclient_BoardCfgPrms_t * pInPmPrms,
752  Sciclient_BoardCfgPrms_t * pInRmPrms);
753 
759 
766 int32_t Sciclient_enterSleep(uint32_t *msg_recv);
767 
773 
774 /* ========================================================================== */
775 /* Static Function Definitions */
776 /* ========================================================================== */
777 
778 #ifdef __cplusplus
779 }
780 #endif
781 
782 #endif /* #ifndef SCICLIENT_H_ */
783 
784 /* @} */
785 
821 /* @} */
822 
int32_t Sciclient_deinit(void)
De-initialization of sciclient. This de-initialization is specific to the application....
int32_t Sciclient_init(const Sciclient_ConfigPrms_t *pCfgPrms)
This API is called once for registering interrupts and creating semaphore handles to be able to talk ...
uint8_t devgrp_t
Defines the sysfw DEVGRP type. This is meant to be used in code or data structures that require disti...
Definition: sciclient.h:242
int32_t Sciclient_bootNotification(void)
This API is called in place of Sciclient_loadFirmware for the Combined ROM boot image,...
int32_t Sciclient_pmicShutdown(void)
Sciclient PMIC shutdown function.
int32_t Sciclient_abiCheck(void)
int32_t Sciclient_configPrmsInit(Sciclient_ConfigPrms_t *pCfgPrms)
Sciclient_ConfigPrms_t structure init function.
int32_t Sciclient_prepareSleep(void)
Sciclient Prepare Sleep Function.
uint8_t domgrp_t
Defines the sysfw DOMGRP type. This is meant to be used in code or data structures that require disti...
Definition: sciclient.h:235
int32_t Sciclient_service(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...
void Sciclient_TisciMsgSetAckResp(struct tisci_header *hdr)
Send the Response in Ack. Used only with Sciserver or Sciclient Direct.
int32_t Sciclient_boardCfgParseHeader(uint8_t *pCommonHeader, Sciclient_BoardCfgPrms_t *pInPmPrms, Sciclient_BoardCfgPrms_t *pInRmPrms)
Parse the header left behind by the SBL in the SCISERVER. This is used in the SCISERVER App to read t...
void Sciclient_TisciMsgSetNakResp(struct tisci_header *hdr)
Send the Response in NAK. Used only with Sciserver or Sciclient Direct.
int32_t Sciclient_enterSleep(uint32_t *msg_recv)
Sciclient Enter Sleep Function.
int32_t Sciclient_loadFirmware(const uint32_t *pSciclient_firmware)
Loads the DMSC firmware. This is typically called by SBL. Load firmware does not require calling the ...
int32_t Sciclient_boardCfgPrepHeader(uint8_t *pCommonHeader, uint8_t *pBoardCfgHeader, const Sciclient_BoardCfgPrms_t *pInPmPrms, const Sciclient_BoardCfgPrms_t *pInRmPrms)
Prepare the header for the board configuration. This API is typically only used by SBL where it will ...
int32_t Sciclient_getDefaultBoardCfgInfo(Sciclient_DefaultBoardCfgInfo_t *pBoardCfgInfo)
API to get the default board config info.
uint32_t flags
Definition: sciclient.h:471
uint32_t respPayloadSize
Definition: sciclient.h:501
uint32_t c66xRatRegion
Definition: sciclient.h:453
Sciclient_BoardCfgPrms_t * pBoardCfgPrms
Definition: sciclient.h:445
uint8_t skipLocalBoardCfgProcess
Definition: sciclient.h:455
uint32_t boardCfgLowRmSize
Definition: sciclient.h:520
const uint8_t * pReqPayload
Definition: sciclient.h:475
uint32_t opModeFlag
Definition: sciclient.h:441
Sciclient_BoardCfgPrms_t inPmPrms
Definition: sciclient.h:458
uint16_t messageType
Definition: sciclient.h:469
uint8_t forwardStatus
Definition: sciclient.h:482
uint32_t boardCfgLowSecSize
Definition: sciclient.h:522
uint32_t boardCfgLowSize
Definition: sciclient.h:518
const uint32_t * boardCfgLowSec
Definition: sciclient.h:514
uint32_t reqPayloadSize
Definition: sciclient.h:477
uint32_t boardCfgLowPmSize
Definition: sciclient.h:524
uint32_t timeout
Definition: sciclient.h:479
Sciclient_BoardCfgPrms_t inRmPrms
Definition: sciclient.h:460
uint8_t * pRespPayload
Definition: sciclient.h:495
const uint32_t * boardCfgLowPm
Definition: sciclient.h:516
const uint32_t * boardCfgLowRm
Definition: sciclient.h:512
uint32_t flags
Definition: sciclient.h:493
const uint32_t * boardCfgLow
Definition: sciclient.h:510
uint32_t isSecureMode
Definition: sciclient.h:449
This file contains the definition of all the message IDs, message formats to be able to interact with...
This file contains the definition of all the message IDs, message formats to be able to interact with...
This file contains the definition of all the shim layer functions which request DMSC for generic serv...
This file contains the definition of all the message IDs, message formats to be able to interact with...
This file contains the definition of all the message IDs, message formats to be able to interact with...
This file contains the definition of all the message IDs, message formats to be able to interact with...
This file contains the definition of all the message IDs, message formats to be able to interact with...
Initialization parameters for sciclient. Pointer to this is passed to Sciclient_init.
Definition: sciclient.h:440
Input parameters for Sciclient_service function.
Definition: sciclient.h:509
Input parameters for Sciclient_service function.
Definition: sciclient.h:468
Output parameters for Sciclient_service function.
Definition: sciclient.h:492