AM62x MCU+ SDK  09.02.00
SAFETY_APP

The Safety Checkers (SC) Library provides productized APIs for ensuring the safety of TIFS, RM and PM modules.

Features Supported

The example demonstrates the usage of RM, PM and TIFS safety checker APIs.

  • PM Safety Checker can be used to validate PSC/PLL configurations
  • RM Safety Checkers can be used to validate RM module configurations
  • TIFS Safety Checker can be used to verify the firewall configuration

Each of these configurations can be validated using the Golden Reference.

SysConfig Features

  • None

Features NOT Supported

  • None

Important Usage Guidelines

Steps to update board configuration for TIFS Safety Checkers:

  • Add below lines to the file " ${mcu_plus_sdk}/source/drivers/sciclient/sciclient_default_boardcfg/{board}/sciclient_defaultBoardcfg_security.c"
/* SA2UL RM config */
.sa2ul_auth_cfg = {
.subhdr = {
.size = 0,
},
.auth_resource_owner = 0,
.enable_saul_psil_global_config_writes = 0x5A,
.safety_host_present = 0x5A,
.safety_host = host_id
},
Note
host_id = 0x24 for r5f
  • Use the following commands to build the Boardcfg changes For GP and HS-FS
    cd ${mcu_plus_sdk}/tools/sysfw/boardcfg/
    make SOC={board}
    cd ${mcu_plus_sdk}
    make scrub SOC={board}
    make all SOC={board}
    For HS-SE
    cd ${mcu_plus_sdk}/tools/sysfw/boardcfg/
    make SOC={board} DEVICE_TYPE=HS
    cd ${mcu_plus_sdk}
    make scrub SOC={board} DEVICE_TYPE=HS
    make all SOC={board} DEVICE_TYPE=HS

Example Usage

The following shows an example of Safety Checkers API usage

Include the below file to access the APIs

#include <safety_checkers_common.h>
#include "tifs_checkers_fwl_config.h"

Get PM Checkers Register Configuration

Get RM Checkers Register Configuration

SafetyCheckers_rmGetRegCfg(rmRegisterData, SAFETY_CHECKERS_RM_REG_BLOB_SIZE);

Request TIFS firewall open

Get TIFS Checkers Register Configuration

SafetyCheckers_tifsGetFwlCfg(pFwlConfig, gSafetyCheckersTifsCfgSize);

Place holder to verify and save configurations as Golden Reference

Verify the run time register configuration against the golden reference for each of the checkers.

numIter = 10;
while(numIter > 0)
{
status = SemaphoreP_pend(&gBinarySem, SystemP_WAIT_FOREVER);
if(status == SAFETY_CHECKERS_SOK)
{
if (status == SAFETY_CHECKERS_REG_DATA_MISMATCH)
{
SAFETY_CHECKERS_log("\n PSC Register Mismatch with Golden Reference\r\n");
}
if (status == SAFETY_CHECKERS_REG_DATA_MISMATCH)
{
SAFETY_CHECKERS_log("\n PLL Register Mismatch with Golden Reference\r\n");
}
if (status == SAFETY_CHECKERS_FAIL)
{
SAFETY_CHECKERS_log("\n PM register lock failed\r\n");
}
status = SafetyCheckers_rmVerifyRegCfg(rmRegisterData, SAFETY_CHECKERS_RM_REG_BLOB_SIZE);
if (status == SAFETY_CHECKERS_REG_DATA_MISMATCH)
{
SAFETY_CHECKERS_log("\n RM Register Mismatch with Golden Reference\r\n");
}
status = SafetyCheckers_tifsVerifyFwlCfg(pFwlConfig, gSafetyCheckersTifsCfgSize);
if (status == SAFETY_CHECKERS_REG_DATA_MISMATCH)
{
SAFETY_CHECKERS_log("\n Firewall Register Mismatch with Golden Reference\r\n");
}
numIter--;
}
}

Request the TIFS to close firewall

API

TISCI_BOARDCFG_SA2UL_CFG_MAGIC_NUM_RSVD
#define TISCI_BOARDCFG_SA2UL_CFG_MAGIC_NUM_RSVD
Definition: tisci_boardcfg_macros.h:91
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_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...
safety_checkers_tifs.h
This file contains TIFS safety checker library interfaces and related data structures.
SafetyCheckers_tifsReqFwlOpen
int32_t SafetyCheckers_tifsReqFwlOpen(void)
API to request TIFS to open firewall.
SystemP_WAIT_FOREVER
#define SystemP_WAIT_FOREVER
Value to use when needing a timeout of infinity or wait forver until resource is available.
Definition: SystemP.h:83
SafetyCheckers_rmGetRegCfg
int32_t SafetyCheckers_rmGetRegCfg(uintptr_t *rmRegCfg, uint32_t size)
API to get the register value for all the RM control modules E.g. When the RM register configuration ...
SAFETY_CHECKERS_PM_PLL_REGDUMP_SIZE
#define SAFETY_CHECKERS_PM_PLL_REGDUMP_SIZE
Total register dump size for PLL. This has been calculated by iterating through each element in Safet...
Definition: safety_checkers_soc.h:112
safety_checkers_pm.h
This file contains PM safety checkers library interfaces and related data structures.
SafetyCheckers_tifsReqFwlClose
int32_t SafetyCheckers_tifsReqFwlClose(void)
API to request TIFS to close firewall.
SafetyCheckers_pmGetPscRegCfg
int32_t SafetyCheckers_pmGetPscRegCfg(uintptr_t *pscRegCfg, uint32_t size)
API to get register configuration for PSC module. E.g. When the PSC register config is requested,...
SAFETY_CHECKERS_PM_PSC_REGDUMP_SIZE
#define SAFETY_CHECKERS_PM_PSC_REGDUMP_SIZE
Total register dump size for PSC. This has been calculated by the addition of PD STAT and MD STAT reg...
Definition: safety_checkers_soc.h:99
SafetyCheckers_rmVerifyRegCfg
int32_t SafetyCheckers_rmVerifyRegCfg(const uintptr_t *rmRegCfg, uint32_t size)
API to read back and compare the RM control module registers data E.g. When the RM verify register ...
SafetyCheckers_pmRegisterLock
int32_t SafetyCheckers_pmRegisterLock(void)
API to lock the PLL control module registers. E.g. When the PLL register lock is requested,...
SafetyCheckers_pmVerifyPscRegCfg
int32_t SafetyCheckers_pmVerifyPscRegCfg(const uintptr_t *pscRegCfg, uint32_t size)
API to read back and compares the current register configuration for PSC module. E....
host_id
uint8_t host_id
Definition: tisci_boardcfg.h:0
SafetyCheckers_pmGetPllRegCfg
int32_t SafetyCheckers_pmGetPllRegCfg(uintptr_t *pllRegCfg, uint32_t size)
API to get register configuration for PLL module. E.g. When the PLL register config is requested,...
SemaphoreP_pend
int32_t SemaphoreP_pend(SemaphoreP_Object *obj, uint32_t timeToWaitInTicks)
Pend on a semaphore object or lock a mutex.