diff --git a/packages/ti/boot/sbl/soc/k3/sbl_sci_client.c b/packages/ti/boot/sbl/soc/k3/sbl_sci_client.c
index 49f948552af567e802c1e65a0fd49052498636fe..8d2410b54d9cc408c545a0b4c8d4a78fe14f9494 100755 (executable)
#include <sbl_err_trap.h>
#include <sbl_sci_client.h>
-#if defined(SBL_ENABLE_HLOS_BOOT)
-#if defined(SOC_J721E)
+#if defined(SBL_ENABLE_HLOS_BOOT) && defined(SOC_AM65XX)
const uint32_t gSciclient_boardCfgLow_hlos_rm[(SCICLIENT_BOARDCFG_RM_LINUX_SIZE_IN_BYTES+3U)/4U]
__attribute__(( aligned(128), section(".boardcfg_data") ))
= SCICLIENT_BOARDCFG_RM_LINUX;
#endif
-#endif
#ifdef __cplusplus
#pragma DATA_SECTION(".firmware")
#error "SYSFW too large...update SBL_SYSFW_MAX_SIZE"
#endif
+#if (!defined(SBL_SKIP_BRD_CFG_PM)) || (!defined(SBL_SKIP_BRD_CFG_RM))
+static int32_t Sciclient_setBoardConfigHeader ();
+#endif
#if defined(SOC_AM65XX) || defined(SOC_J721E) || defined(SOC_J7200)
/* Firewall ID for MCU_FSS0_S0 */
#define MCU_FSS0_S0_FWID (1036)
#define MCU_FSS0_S0_FW_REGIONS (8)
+
+#if defined (SOC_J721E) || defined (SOC_J7200)
+/** \brief Aligned address at which the X509 header is placed. */
+#define SCISERVER_COMMON_X509_HEADER_ADDR (0x41cffb00U)
+
+/** \brief Aligned address at which the Board Config header is placed. */
+#define SCISERVER_BOARDCONFIG_HEADER_ADDR (0x41c80000U)
+
+/** \brief Aligned address at which the Board Config is placed. */
+#define SCISERVER_BOARDCONFIG_DATA_ADDR (0x41c80040U)
+
+#endif
#endif
uint32_t SBL_IsAuthReq(void)
return retVal;
}
+#ifndef SBL_SKIP_SYSFW_INIT
+Sciclient_BoardCfgPrms_t sblBoardCfgPrms = {0};
+Sciclient_BoardCfgPrms_t sblBoardCfgPmPrms = {0};
+Sciclient_BoardCfgPrms_t sblBoardCfgRmPrms = {0};
+#ifndef SBL_SKIP_BRD_CFG_SEC
+Sciclient_BoardCfgPrms_t sblBoardCfgSecPrms = {0};
+#endif
+#endif
+
+#ifndef SBL_SKIP_BRD_CFG_RM
+uint16_t gCertLength = 0;
+#endif
+static uint16_t boardcfgRmFindCertSize(uint32_t *msg_recv)
+{
+ uint16_t cert_len = 0;
+ uint8_t *cert_len_ptr = (uint8_t *)&cert_len;
+ uint8_t *x509_cert_ptr;
+
+ x509_cert_ptr = (uint8_t *)msg_recv;
+
+
+ if (*x509_cert_ptr != 0x30)
+ {
+ /* The data does not contain a certificate - return */
+ return 0;
+ }
+
+ cert_len = *(x509_cert_ptr + 1);
+
+ /* If you need more than 2 bytes to store the cert length */
+ /* it means that the cert length is greater than 64 Kbytes */
+ /* and we do not support it */
+ if ((cert_len > 0x80) &&
+ (cert_len != 0x82))
+ {
+ return 0;
+ }
+
+ if (cert_len == 0x82)
+ {
+ *cert_len_ptr = *(x509_cert_ptr + 3);
+ *(cert_len_ptr + 1) = *(x509_cert_ptr + 2);
+
+ /* add current offset from start of x509 cert */
+ cert_len += 3;
+ }
+ else
+ {
+ /* add current offset from start of x509 cert */
+ /* if cert len was obtained from 2nd byte i.e. */
+ /* cert size is 127 bytes or less */
+ cert_len += 1;
+ }
+
+ /* cert_len now contains the offset of the last byte */
+ /* of the cert from the ccert_start. To get the size */
+ /* of certificate, add 1 */
+
+ return cert_len + 1;
+}
+
void SBL_SciClientInit(void)
{
int32_t status = CSL_EFAIL;
#ifndef SBL_SKIP_SYSFW_INIT
/* SYSFW board configurations */
Sciclient_DefaultBoardCfgInfo_t boardCfgInfo;
- Sciclient_BoardCfgPrms_t sblBoardCfgPrms;
- Sciclient_BoardCfgPrms_t sblBoardCfgPmPrms;
- Sciclient_BoardCfgPrms_t sblBoardCfgRmPrms;
-#ifndef SBL_SKIP_BRD_CFG_SEC
- Sciclient_BoardCfgPrms_t sblBoardCfgSecPrms;
-#endif
- Sciclient_ConfigPrms_t config =
- {
- SCICLIENT_SERVICE_OPERATION_MODE_POLLED,
- NULL,
- 1,
- 0,
- TRUE
- };
+ Sciclient_ConfigPrms_t config;
+ Sciclient_configPrmsInit(&config);
+ config.opModeFlag = SCICLIENT_SERVICE_OPERATION_MODE_POLLED;
+ config.pBoardCfgPrms = NULL;
+ config.isSecureMode = 0; /* default board cfg is for non-secure mode */
+ config.c66xRatRegion = 0;
+ config.skipLocalBoardCfgProcess = TRUE;
#endif
SBL_ADD_PROFILE_POINT;
status = SBL_ReadSysfwImage(&sysfw_ptr, SBL_SYSFW_MAX_SIZE);
if (status != CSL_PASS)
{
+#if defined(SOC_J721E) || defined(SOC_J7200)
+ SBL_log(SBL_LOG_ERR,"TIFS read...FAILED \n");
+#else
SBL_log(SBL_LOG_ERR,"SYSFW read...FAILED \n");
+#endif
SblErrLoop(__FILE__, __LINE__);
}
status = Sciclient_getDefaultBoardCfgInfo(&boardCfgInfo);
-#if defined(SBL_ENABLE_HLOS_BOOT)
-#if defined(SOC_J721E)
+#if defined(SBL_ENABLE_HLOS_BOOT) && defined(SOC_AM65XX)
/* Replace default Sciclient boardCfgLowRm with alternate version for HLOS boot */
boardCfgInfo.boardCfgLowRm = &gSciclient_boardCfgLow_hlos_rm[0U];
boardCfgInfo.boardCfgLowRmSize = SCICLIENT_BOARDCFG_RM_LINUX_SIZE_IN_BYTES;
-#endif
#endif
if (status != CSL_PASS)
{
- SBL_log(SBL_LOG_ERR,"SYSFW get default board config...FAILED \n");
+ SBL_log(SBL_LOG_ERR,"Sciclient get default board config...FAILED \n");
SblErrLoop(__FILE__, __LINE__);
}
status = Sciclient_loadFirmware((const uint32_t *) sysfw_ptr);
if (status != CSL_PASS)
{
+#if defined(SOC_J721E) || defined(SOC_J7200)
+ SBL_log(SBL_LOG_ERR,"TIFS load...FAILED \n");
+#else
SBL_log(SBL_LOG_ERR,"SYSFW load...FAILED \n");
+#endif
SblErrLoop(__FILE__, __LINE__);
}
status = Sciclient_init(&config);
if (status != CSL_PASS)
{
- SBL_log(SBL_LOG_ERR,"SYSFW init ...FAILED \n");
+ SBL_log(SBL_LOG_ERR,"Sciclient init ...FAILED \n");
SblErrLoop(__FILE__, __LINE__);
}
status = Sciclient_boardCfg(&sblBoardCfgPrms);
if (status != CSL_PASS)
{
- SBL_log(SBL_LOG_ERR,"SYSFW board config ...FAILED \n");
+ SBL_log(SBL_LOG_ERR,"Sciclient board config ...FAILED \n");
SblErrLoop(__FILE__, __LINE__);
}
#endif
status = Sciclient_boardCfgPm(&sblBoardCfgPmPrms);
if (status != CSL_PASS)
{
- SBL_log(SBL_LOG_ERR,"SYSFW board config pm...FAILED \n")
+ SBL_log(SBL_LOG_ERR,"Sciclient board config pm...FAILED \n")
SblErrLoop(__FILE__, __LINE__);
}
}
#endif
-#ifndef SBL_SKIP_BRD_CFG_RM
- SBL_ADD_PROFILE_POINT;
- sblBoardCfgRmPrms.boardConfigLow = (uint32_t)boardCfgInfo.boardCfgLowRm;
- sblBoardCfgRmPrms.boardConfigHigh = 0;
- sblBoardCfgRmPrms.boardConfigSize = boardCfgInfo.boardCfgLowRmSize;
- sblBoardCfgRmPrms.devGrp = SBL_DEVGRP;
- status = Sciclient_boardCfgRm(&sblBoardCfgRmPrms);
- if (status != CSL_PASS)
- {
- SBL_log(SBL_LOG_ERR,"SYSFW board config rm...FAILED \n");
- SblErrLoop(__FILE__, __LINE__);
- }
-#endif
-
#ifndef SBL_SKIP_BRD_CFG_SEC
SBL_ADD_PROFILE_POINT;
sblBoardCfgSecPrms.boardConfigLow = (uint32_t)boardCfgInfo.boardCfgLowSec;
status = Sciclient_boardCfgSec(&sblBoardCfgSecPrms);
if (status != CSL_PASS)
{
- SBL_log(SBL_LOG_ERR,"SYSFW board config sec...FAILED \n");
+ SBL_log(SBL_LOG_ERR,"Sciclient board config sec...FAILED \n");
SblErrLoop(__FILE__, __LINE__);
}
#if defined(SOC_AM65XX) || defined(SOC_J721E) || defined(SOC_J7200)
#endif
#endif
- /* Get SYSFW version */
+#ifndef SBL_SKIP_BRD_CFG_RM
+ SBL_ADD_PROFILE_POINT;
+ sblBoardCfgRmPrms.boardConfigLow = (uint32_t)boardCfgInfo.boardCfgLowRm;
+ sblBoardCfgRmPrms.boardConfigHigh = 0;
+ sblBoardCfgRmPrms.boardConfigSize = boardCfgInfo.boardCfgLowRmSize;
+ sblBoardCfgRmPrms.devGrp = SBL_DEVGRP;
+ gCertLength = boardcfgRmFindCertSize((uint32_t*)boardCfgInfo.boardCfgLowRm);
+ status = Sciclient_boardCfgRm(&sblBoardCfgRmPrms);
+ if (status != CSL_PASS)
+ {
+ SBL_log(SBL_LOG_ERR,"Sciclient board config rm...FAILED \n");
+ SblErrLoop(__FILE__, __LINE__);
+ }
+#endif
+
+ /* Get SYSFW/TIFS version */
SBL_ADD_PROFILE_POINT;
if (SBL_LOG_LEVEL > SBL_LOG_ERR)
if (respPrm.flags == (uint32_t)TISCI_MSG_FLAG_ACK)
{
SBL_ADD_PROFILE_POINT;
+#if defined(SOC_J721E) || defined(SOC_J7200)
+ SBL_log(SBL_LOG_MIN,"TIFS ver: %s\n", (char *) response.str);
+#else
SBL_log(SBL_LOG_MIN,"SYSFW ver: %s\n", (char *) response.str);
+#endif
}
else
{
+#if defined(SOC_J721E) || defined(SOC_J7200)
+ SBL_log(SBL_LOG_ERR,"TIFS Get Version failed \n");
+#else
SBL_log(SBL_LOG_ERR,"SYSFW Get Version failed \n");
+#endif
SblErrLoop(__FILE__, __LINE__);
}
}
}
+
+#if (!defined(SBL_SKIP_BRD_CFG_PM)) || (!defined(SBL_SKIP_BRD_CFG_RM))
+ status = Sciclient_setBoardConfigHeader();
+ if (CSL_PASS == status)
+ {
+ SBL_log(SBL_LOG_MAX,"Sciclient_setBoardConfigHeader... PASSED\n");
+ }
+ else
+ {
+ SBL_log(SBL_LOG_ERR,"Sciclient_setBoardConfigHeader... FAILED\n");
+ SblErrLoop(__FILE__, __LINE__);
+ }
+#endif
+
+
#if !defined(SBL_SKIP_MCU_RESET)
/* RTI seems to be turned on by ROM. Turning it off so that Power domain can transition */
Sciclient_pmSetModuleState(SBL_DEV_ID_RTI0, TISCI_MSG_VALUE_DEVICE_SW_STATE_AUTO_OFF, TISCI_MSG_FLAG_AOP, SCICLIENT_SERVICE_WAIT_FOREVER);
SBL_ADD_PROFILE_POINT;
}
+
+#if (!defined(SBL_SKIP_BRD_CFG_PM)) || (!defined(SBL_SKIP_BRD_CFG_RM))
+static int32_t Sciclient_setBoardConfigHeader ()
+{
+ int32_t status = CSL_PASS;
+#if defined (SOC_J7200) || defined (SOC_J721E)
+ //uint32_t alignedOffset = ((SCICLIENT_BOARDCFG_PM_SIZE_IN_BYTES + 128U)/128U)*128U;
+ uint32_t alignedOffset = SCICLIENT_BOARDCFG_PM_SIZE_IN_BYTES;
+ Sciclient_BoardCfgPrms_t boardCfgPrms_pm =
+ {
+ .boardConfigLow = (uint32_t)SCISERVER_BOARDCONFIG_DATA_ADDR,
+ .boardConfigHigh = 0,
+ .boardConfigSize = (uint16_t)SCICLIENT_BOARDCFG_PM_SIZE_IN_BYTES,
+ .devGrp = DEVGRP_ALL
+ };
+ Sciclient_BoardCfgPrms_t boardCfgPrms_rm =
+ {
+ .boardConfigLow =
+ (uint32_t) SCISERVER_BOARDCONFIG_DATA_ADDR + alignedOffset,
+ .boardConfigHigh = 0,
+ .boardConfigSize = (uint16_t)SCICLIENT_BOARDCFG_RM_SIZE_IN_BYTES - gCertLength,
+ .devGrp = DEVGRP_ALL
+ };
+ status = Sciclient_boardCfgPrepHeader (
+ (uint8_t *) SCISERVER_COMMON_X509_HEADER_ADDR,
+ (uint8_t *) SCISERVER_BOARDCONFIG_HEADER_ADDR,
+ &boardCfgPrms_pm, &boardCfgPrms_rm);
+ if (CSL_PASS == status)
+ {
+ SBL_log(SBL_LOG_MAX,"SCISERVER Board Configuration header population... ");
+ SBL_log(SBL_LOG_MAX,"PASSED\n");
+ }
+ else
+ {
+ SBL_log(SBL_LOG_MIN,"SCISERVER Board Configuration header population... ");
+ SBL_log(SBL_LOG_MIN,"FAILED\n");
+ }
+ memcpy((void *)boardCfgPrms_pm.boardConfigLow, (void *) sblBoardCfgPmPrms.boardConfigLow, SCICLIENT_BOARDCFG_PM_SIZE_IN_BYTES);
+ memcpy((void *)boardCfgPrms_rm.boardConfigLow, (void *) sblBoardCfgRmPrms.boardConfigLow, SCICLIENT_BOARDCFG_RM_SIZE_IN_BYTES - gCertLength);
+#endif
+ return status;
+}
+#endif