xilloader
Vitis Drivers API Documentation
XilLoader Server APIs

Macros

#define XLOADER_IMAGE_INFO_TBL_MAX_NUM
 Maximum number of image info tables in the available buffer. More...
 
#define XLOADER_RSA_PSS_MSB_PADDING_MASK   (u8)(0x80U)
 RSA PSS MSB padding mask. More...
 
#define XLOADER_RSA_EM_MSB_INDEX   (0x0U)
 RSA EM MSB Index. More...
 
#define XLOADER_PUF_SHUT_GLB_VAR_FLTR_EN_SHIFT   (31U)
 Shift for Global Variation Filter in PUF shutter value. More...
 
#define XLOADER_AES_RESET_VAL   (0x1U)
 AES Reset value. More...
 
#define XLOADER_AES_RESET_REG   (0xF11E0010U)
 AES Reset register address. More...
 
#define XLOADER_ECDSA_RSA_RESET_REG   (0xF1200040U)
 ECDSA RSA Reset register address. More...
 
#define XLOADER_ECDSA_RSA_RESET_VAL   (0x1U)
 ECDSA RSA Reset value. More...
 
#define XLOADER_GET_PRTN_HASH_INDEX(PdiPtr)
 Get partition hash index depending on full/partial PDI. More...
 
#define CFRAME_BCAST_REG_TESTMODE_OFFSET   (0x120U)
 Test mode offset. More...
 
#define CFRAME_BCAST_REG_TESTMODE_CRAM_SELF_CHECK_MASK   (0x100U)
 CRAM self check mask. More...
 
#define CFRAME_BCAST_REG_FAR_OFFSET   (0x10U)
 CFrame address register offset. More...
 
#define CFRAME_BCAST_REG_FAR_BLOCKTYPE_SHIFT   (20U)
 CFrame address register block type shift. More...
 
#define CFRAME_MAX_BLOCK_TYPE_COUNT   (0x3U)
 CFrame maximum block type count. More...
 
#define XPLMI_ZERO   (0x0U)
 Zero. More...
 
#define CFRAME_CRC_POLL_TIMEOUT   (0xFFFFU)
 CRC poll time out. More...
 
#define XLOADER_CFRAME_DATACLEAR_CHECK_CMD_ID   (0xCU)
 Data clear check command Id. More...
 
#define PMC_GLOBAL_PMC_ERR2_STATUS_CFI_SHIFT   (16U)
 CFI Non-Correctable Error shift. More...
 
#define XLOADER_SBI_DELAY_IN_MICROSEC   (5000U)
 Flag indicates SBI delay in micro second. More...
 
#define XLOADER_LOG_LEVEL_MASK   (0xF0U)
 Flag indicates Log level mask. More...
 
#define XLOADER_SBI_CTRL_INTERFACE_AXI_SLAVE   (0x8U)
 SBI PCIE PDI load. More...
 
#define XLOADER_SUCCESS_NOT_PRTN_OWNER   (0x100U)
 Indicates that PLM is not the partition owner. More...
 
#define XLOADER_BOOT_COPY_OPTIMIZATION_ENABLED   (0U)
 Indicates Boot Device Copy Optimization is Enabled. More...
 
#define XLOADER_SHA3_RESET_REG   (0xF1210004U)
 SHA3 Reset register address. More...
 
#define XLOADER_SHA3_RESET_VAL   (0x1U)
 SHA3 Reset value. More...
 
#define XLOADER_TCM_0   (0U)
 TCM 0. More...
 
#define XLOADER_TCM_1   (1U)
 TCM 1. More...
 
#define XLOADER_RPU_GLBL_CNTL   (0xFF9A0000U)
 RPU global control. More...
 
#define XLOADER_TCMCOMB_MASK   (0x40U)
 TCM combine mask. More...
 
#define XLOADER_TCMCOMB_SHIFT   (6U)
 TCM combine shift. More...
 
#define PLM_VP1802_POR_SETTLE_TIME   (25000U)
 Flag indicates POR settle time for VP1802. More...
 
#define XLOADER_IMAGE_INFO_VERSION   (1U)
 Image version information. More...
 
#define XLOADER_IMAGE_INFO_LCVERSION   (1U)
 Image lowest compatible version information. More...
 
#define XLOADER_PDI_LIST_VERSION   (1U)
 PDI version list. More...
 
#define XLOADER_PDI_LIST_LCVERSION   (1U)
 PDI lowest compatible version list. More...
 
#define XLOADER_ATF_HANDOFF_PARAMS_VERSION   (1U)
 ATF handoff parameters version. More...
 
#define XLOADER_ATF_HANDOFF_PARAMS_LCVERSION   (1U)
 ATF handoff parameters lowest compatible version. More...
 
#define XLOADER_BOOTPDI_INFO_PARAMS_VERSION   (2U)
 BootPDI info version. More...
 
#define XLOADER_BOOTPDI_INFO_PARAMS_LCVERSION   (2U)
 BootPDI info lowest compatible version. More...
 
#define XLOADER_CMD_GET_DDR_DEVICE_ID   (0U)
 DDR device id. More...
 
#define XLOADER_DDR_CRYPTO_MAIN_OFFSET   (0X40000U)
 DDR crypto block offset from ub. More...
 
#define XLOADER_DDR_PERF_MON_CNT0_OFFSET   (0X868U)
 Counter 0 offset. More...
 
#define XLOADER_DDR_PERF_MON_CNT1_OFFSET   (0X86CU)
 Counter 1 offset. More...
 
#define XLOADER_DDR_PERF_MON_CNT2_OFFSET   (0X870U)
 Counter 2 offset. More...
 
#define XLOADER_DDR_PERF_MON_CNT3_OFFSET   (0X874U)
 Counter 3 offset. More...
 
#define XLOADER_CMD_CONFIG_JTAG_STATE_FLAG_INDEX   (0U)
 Index in the Payload of ConfigureJtagState command where JTAG state flag is present. More...
 
#define XLOADER_CMD_CONFIG_JTAG_STATE_FLAG_MASK   (0x03U)
 Mask for JTAG state flag. More...
 
#define XLOADER_CONFIG_JTAG_STATE_FLAG_ENABLE   (0x03U)
 Value of JTAG state flag if enabled. More...
 
#define XLOADER_CONFIG_JTAG_STATE_FLAG_DISABLE   (0x00U)
 Value of JTAG state flag if disabled. More...
 
#define XLOADER_PCR_MEASUREMENT_INDEX_MASK   (0xFFFF0000U)
 Mask for PCR Measurement index. More...
 
#define XLOADER_EFUSE_OBFUS_KEY   (0xA5C3C5A7U)
 eFuse obfuscated key More...
 
#define XLOADER_BBRAM_OBFUS_KEY   (0x3A5C3C57U)
 BBRAM obfuscated key. More...
 
#define XLOADER_BH_OBFUS_KEY   (0xA35C7CA5U)
 Boot header obfuscated key. More...
 
#define XLOADER_INVALID_OBFUS_KEY   (0xFFFFFFFFU)
 Invalid obfuscated key. More...
 
#define XLOADER_IMAGE_INFO_VERSION   (1U)
 Image version information. More...
 
#define XLOADER_IMAGE_INFO_LCVERSION   (1U)
 Image lowest compatible version information. More...
 
#define XLOADER_PDI_LIST_VERSION   (1U)
 PDI version list. More...
 
#define XLOADER_PDI_LIST_LCVERSION   (1U)
 PDI lowest compatible version list. More...
 
#define XLOADER_ATF_HANDOFF_PARAMS_VERSION   (1U)
 ATF handoff parameters version. More...
 
#define XLOADER_ATF_HANDOFF_PARAMS_LCVERSION   (1U)
 ATF handoff parameters lowest compatible version. More...
 
#define XLOADER_BOOTPDI_INFO_PARAMS_VERSION   (2U)
 BootPDI info version. More...
 
#define XLOADER_BOOTPDI_INFO_PARAMS_LCVERSION   (2U)
 BootPDI info lowest compatible version. More...
 
#define XLOADER_CMD_GET_DDR_DEVICE_ID   (0U)
 DDR device id. More...
 
#define XLOADER_DDR_CRYPTO_MAIN_OFFSET   (0X40000U)
 DDR crypto block offset from ub. More...
 
#define XLOADER_DDR_PERF_MON_CNT0_OFFSET   (0X868U)
 Counter 0 offset. More...
 
#define XLOADER_DDR_PERF_MON_CNT1_OFFSET   (0X86CU)
 Counter 1 offset. More...
 
#define XLOADER_DDR_PERF_MON_CNT2_OFFSET   (0X870U)
 Counter 2 offset. More...
 
#define XLOADER_DDR_PERF_MON_CNT3_OFFSET   (0X874U)
 Counter 3 offset. More...
 
#define XLOADER_CMD_CONFIG_JTAG_STATE_FLAG_INDEX   (0U)
 Index in the Payload of ConfigureJtagState command where JTAG state flag is present. More...
 
#define XLOADER_CMD_CONFIG_JTAG_STATE_FLAG_MASK   (0x03U)
 Mask for JTAG state flag. More...
 
#define XLOADER_CONFIG_JTAG_STATE_FLAG_ENABLE   (0x03U)
 Value of JTAG state flag if enabled. More...
 
#define XLOADER_CONFIG_JTAG_STATE_FLAG_DISABLE   (0x00U)
 Value of JTAG state flag if disabled. More...
 
#define XLOADER_EFUSE_ROM_RSVD_CACHE_ADDRESS   (0xF1250090U)
 ROM Reserved eFuse cache offset. More...
 
#define XLOADER_EFUSE_ROM_RSVD_AUTH_KEYS_TO_HASH_MASK   (0x00000200U)
 AUTH_KEYS_TO_HASH eFuse bit mask. More...
 
#define XLOADER_EFUSE_ROM_RSVD_AUTH_KEYS_TO_HASH_SHIFT   (9U)
 AUTH_KEYS_TO_HASH eFuse bit shift. More...
 
#define XLOADER_PCR_MEASUREMENT_INDEX_MASK   (0xFFFF0000U)
 Mask for PCR Measurement index. More...
 
#define XLOADER_EFUSE_OBFUS_KEY   (0xA5C3C5A7U)
 eFuse obfuscated key More...
 
#define XLOADER_BBRAM_OBFUS_KEY   (0x3A5C3C57U)
 BBRAM obfuscated key. More...
 
#define XLOADER_BH_OBFUS_KEY   (0xA35C7CA5U)
 Boot header obfuscated key. More...
 

Functions

int XLoader_SecureAuthInit (XLoader_SecureParams *SecurePtr, const XilPdi_PrtnHdr *PrtnHdr)
 This function initializes authentication parameters of XLoader_SecureParams's instance. More...
 
int XLoader_SecureEncInit (XLoader_SecureParams *SecurePtr, const XilPdi_PrtnHdr *PrtnHdr)
 This function initializes encryption parameters of XLoader_SecureParams's instance. More...
 
int XLoader_SecureValidations (const XLoader_SecureParams *SecurePtr)
 This function checks if authentication/encryption is compulsory. More...
 
int XLoader_ReadAndVerifySecureHdrs (XLoader_SecureParams *SecurePtr, XilPdi_MetaHdr *MetaHdr)
 This function authenticates and/or decrypts the image headers and partition headers and copies the contents to the corresponding structures. More...
 
int XLoader_IsPpkValid (XLoader_PpkSel PpkSelect, const u8 *PpkHash)
 The function reads PPK invalid bits. More...
 
int XLoader_RsaPssSignVerify (u8 *MsgHash, XSecure_Rsa *RsaInstPtr, u8 *Signature, u32 KeySize)
 This function encrypts the RSA signature provided and performs required PSS operations to extract salt and calculates M prime hash and compares with hash obtained from EM. More...
 
int XLoader_AddAuthJtagToScheduler (void)
 This function adds periodic checks of the status of Auth JTAG interrupt status to the scheduler. More...
 
int XLoader_CheckAuthJtagIntStatus (void *Arg)
 This function checks the status of Auth JTAG interrupt status and it disables the Jtag as per the timeout set by user. More...
 
int XLoader_EnableJtag (volatile u32 CfgState)
 This function enables the Jtag. More...
 
int XLoader_DisableJtag (void)
 This function disables the Jtag. More...
 
int XLoader_AuthEncClear (void)
 This function is called to clear secure critical data related to authentication and encryption in case of exceptions. More...
 
void XLoader_ClearKatOnPPDI (XilPdi *PdiPtr, u32 PlmKatMask)
 This function updates the KAT status. More...
 
int XLoader_ClearAesKey (u32 *DecKeySrc)
 This function clears the AES keys when RedKeyClear is set in PMC RAM. More...
 
int XLoader_ProcessAuthEncPrtn (XLoader_SecureParams *SecurePtr, u64 DestAddr, u32 BlockSize, u8 Last)
 This function performs authentication and decryption of the partition. More...
 
int XLoader_CheckSecureState (u32 RegVal, u32 Var, u32 ExpectedValue)
 This function checks if the secure state of boot matches the expected value or not. More...
 
int XLoader_ImgHdrTblAuth (XLoader_SecureParams *SecurePtr)
 This function authenticates the image header table. More...
 
int XLoader_DataAuth (XLoader_SecureParams *SecurePtr, u8 *Hash, u8 *Signature)
 This function authenticates the data with SPK. More...
 
int XLoader_CframeInit (void)
 This function initializes the Cframe driver. More...
 
void XLoader_CframeErrorHandler (u32 ImageId)
 This function is used to check the CFU ISR and PMC_ERR1 and PMC_ERR2 status registers to check for any errors in PL and call corresponding error recovery functions if needed. More...
 
int XLoader_CframeDataClearCheck (XPlmi_Cmd *Cmd)
 This function is used to check if the Cframe data is cleared or not using CRC method. More...
 
int XLoader_CfiSelectiveRead (XPlmi_Cmd *Cmd)
 This function provides CFI SELECTIVE READ command execution. More...
 
int XLoader_DdrInit (u32 DeviceFlags)
 This function is used to initialize for DDR init. More...
 
int XLoader_DdrCopy (u64 SrcAddr, u64 DestAddr, u32 Length, u32 FlagsVal)
 This function is used to copy the data from DDR to destination address. More...
 
int XLoader_DdrRelease (void)
 This function releases control of DDR. More...
 
int XLoader_IntrInit (void)
 This function initializes the loader instance and registers loader commands with PLM. More...
 
int XLoader_LoadImagePrtns (XilPdi *PdiPtr)
 This function loads the partition. More...
 
int XLoader_PrtnCopy (const XilPdi *PdiPtr, const XLoader_DeviceCopy *DeviceCopy, void *SecureParamsPtr)
 This function copies partition data to respective target memories. More...
 
int XLoader_SecureInit (XLoader_SecureParams *SecurePtr, XilPdi *PdiPtr, u32 PrtnNum)
 This function initializes XLoader_SecureParams's instance. More...
 
int XLoader_SecureCopy (XLoader_SecureParams *SecurePtr, u64 DestAddr, u32 Size)
 This function loads secure non-cdo partitions. More...
 
int XLoader_SecureClear (void)
 This function is called to clear secure critical data in case of exceptions. More...
 
int XLoader_VerifyHashNUpdateNext (XLoader_SecureParams *SecurePtr, u64 DataAddr, u32 Size, u8 Last)
 This function calculates hash and compares with expected hash. More...
 
int XLoader_SecureChunkCopy (XLoader_SecureParams *SecurePtr, u64 SrcAddr, u8 Last, u32 BlockSize, u32 TotalSize)
 This function copies the data from SrcAddr to chunk memory during processing of secure partitions. More...
 
int XLoader_CheckNonZeroPpk (void)
 This function checks if PPK is programmed. More...
 
u32 XLoader_GetAHWRoT (const u32 *AHWRoTPtr)
 This function returns the state of authenticated boot. More...
 
u32 XLoader_GetSHWRoT (const u32 *SHWRoTPtr)
 This function returns the state of encrypted boot. More...
 
int XLoader_SetSecureState (void)
 This function reads the value of PPK efuse bits, DEC only efuse bits and fields in bootheader and accordingly sets the Secure State of boot. More...
 
XLoader_SecureTempParams * XLoader_GetTempParams (void)
 This function returns the pointer to XLoader_SecureTempParams. More...
 
u32 XLoader_GetKekSrc (void)
 This function updates KEK red key availability status from boot header. More...
 
int XLoader_AesObfusKeySelect (u32 PdiKeySrc, u32 DecKeyMask, void *KeySrcPtr)
 This function provides Obfuscated Aes Key source. More...
 
int XLoader_RsaKat (void)
 This function runs the KAT for RSA. More...
 
int XLoader_MaskGenFunc (XSecure_Sha3 *Sha3InstancePtr, u8 *Out, u32 OutLen, u8 *Input)
 Mask generation function with SHA3. More...
 
int XLoader_IsAdditionalPpkValid (const u8 *PpkHash)
 This function verifies whether the additional PPK is valid. More...
 
int XLoader_AdditionalPpkSelect (XLoader_PpkSel PpkSelect, u32 *InvalidMask, u32 *PpkOffset)
 This function checks for the additional PPK select and returns the PPK invalid mask and PPK efuse cache start offset if PPK is valid. More...
 
int XLoader_CheckSecureStateAuth (volatile u32 *AHWRoT)
 This function checks Secure State for Authentication. More...
 
int XLoader_AddDeviceStateChangeToScheduler (void)
 This function adds periodic checks of the device status change during secure boot. More...
 
int XLoader_CheckDeviceStateChange (void *Arg)
 This function checks the JTAG device state change. More...
 
int XLoader_MaskGenFunc (XSecure_Sha *ShaInstancePtr, u8 *Out, u32 OutLen, u8 *Input)
 Mask generation function with SHA3. More...
 
int XLoader_UpdateCfgLimitCount (u32 UpdateFlag)
 This function updates the configuration limiter count if Configuration limiter feature is enabled in case of secure boot. More...
 

Variables

u32 XLoader_AuthJtagStatus::JtagTimeOut
 Timeout value set by user. More...
 
u8 XLoader_AuthJtagStatus::JtagTimerEnabled
 Enable JTAG timer. More...
 
volatile u8 XLoader_AuthJtagStatus::AuthFailCounter
 Counter for failed attempts to authenticate JTAG. More...
 
volatile u8 XLoader_AuthJtagStatus::AuthFailCounterTmp
 For temporal redundancy. More...
 
int XLoader_Init (void)
 This function initializes the loader instance and registers loader commands with PLM. More...
 
int XLoader_PdiInit (XilPdi *PdiPtr, PdiSrc_t PdiSource, u64 PdiAddr)
 This function initializes the PDI instance with required details and read the meta header. More...
 
int XLoader_LoadPdi (XilPdi *PdiPtr, PdiSrc_t PdiSrc, u64 PdiAddr)
 This function provides loading PDI. More...
 
XLoader_ImageInfo * XLoader_GetImageInfoEntry (u32 ImgID)
 This function returns the ImageInfoEntry by checking if an entry exists for that particular ImgId in the ImgInfoTbl. More...
 
int XLoader_LoadImageInfoTbl (u64 DestAddr, u32 MaxSize, u32 *NumEntries)
 This function loads the ImageInfo table to the given memory address. More...
 
int XLoader_LoadImage (XilPdi *PdiPtr)
 This function is used load a image in PDI. More...
 
int XLoader_RestartImage (u32 ImageId, u32 *FuncID)
 This function is used to restart the image in PDI. More...
 
int XLoader_IdCodeCheck (const XilPdi_ImgHdrTbl *ImgHdrTbl)
 This function performs the checks of IDCODE and EXTENDED IDCODE. More...
 
int XLoader_ReadImageStoreCfg (void)
 This function is used to read the Image Store DDR Memory Addr. More...
 
int XLoader_IsPdiAddrLookup (u32 PdiId, u64 *PdiAddr)
 This function is used to read the Address based-on PDI Id from Image Store. More...
 
void Xloader_SaveBootPdiInfo (XilPdi *BootPdiPtr)
 This function is used to save the BootPDI info. More...
 
XilPdi * XLoader_GetPdiInstance (void)
 This function provides PdiInstance pointer. More...
 
int XLoader_InitPdiInstanceForExtractMHAndOptData (XPlmi_Cmd *Cmd, XilPdi *PdiPtr, u64 SrcAddr, u64 DestAddr, u32 DestSize)
 This function initializes PDI Instance pointer for extracting Metaheader and OptionalData. More...
 
int XLoader_ClearATFHandoffParams (XilPdi *PdiPtr)
 This function clears ATF Handoff parameters in case of multi-partitions in APU subsystem. More...
 
int XLoader_GetImageAndPrtnInfo (XilPdi *PdiPtr, u32 ImageId)
 This function provides Image number and partition number of a given ImgId in the PDI instance. More...
 
XLoader_ImageInfoTbl * XLoader_GetImageInfoTbl (void)
 This function provides ImageInfoTbl pointer. More...
 
XLoader_ImageStore * XLoader_GetPdiList (void)
 This function provides pointer to PdiList. More...
 
XilPdi_ATFHandoffParams * XLoader_GetATFHandoffParamsAddr (void)
 This function returns the ATFHandoffParams structure address to the caller. More...
 
XilBootPdiInfo * XLoader_GetBootPdiInfo (void)
 This function provides pointer to BootPDI Info. More...
 
int XLoader_StartImage (XilPdi *PdiPtr)
 This function is used to start the subsystems in the PDI. More...
 
int XLoader_MeasureNLoad (XilPdi *PdiPtr)
 This function measures the partion hashes. More...
 
int XLoader_DataMeasurement (XLoader_ImageMeasureInfo *ImageInfo)
 This function measures the data by calculating SHA3 hash. More...
 
void XLoader_SetATFHandoffParameters (const XilPdi_PrtnHdr *PrtnHdr)
 This function sets the handoff parameters to the ARM Trusted Firmware(ATF). More...
 
void XLoader_SetJtagTapToReset (void)
 This function is used to run MJTAG solution workaround in which JTAG Tap state will be set to reset. More...
 
int XLoader_GetSDPdiSrcNAddr (u32 SecBootMode, XilPdi *PdiPtr, u32 *PdiSrc, u64 *PdiAddr)
 This function is used to get PdiSrc and PdiAddr for Secondary SD boot modes. More...
 
int XLoader_ProcessElf (XilPdi *PdiPtr, const XilPdi_PrtnHdr *PrtnHdr, XLoader_PrtnParams *PrtnParams, XLoader_SecureParams *SecureParams)
 This function copies the elf partitions to specified destinations. More...
 
int XLoader_UpdateHandoffParam (XilPdi *PdiPtr)
 This function is used to update the handoff parameters. More...
 
u8 XLoader_SkipMJtagWorkAround (XilPdi *PdiPtr)
 This function checks if MJTAG workaround partition needs to be skipped. More...
 
int XLoader_ProcessDeferredError (void)
 This function checks if MJTAG workaround is required. More...
 
void XLoader_PerformInternalPOR (void)
 This function check conditions and perform internal POR for VP1802 and VP1502 device if required. More...
 
int Xloader_SsitEoPdiSync (XilPdi *PdiPtr)
 This function will sync the PDI load status with master if End of PDI SYNC bit is enabled in IHT. More...
 
int XLoader_ReadDdrCryptoPerfCounters (XPlmi_Cmd *Cmd)
 This function reads DDR crypto performance counters of given DDR device id. More...
 
int XLoader_UpdateHandler (XPlmi_ModuleOp Op)
 This function provides update handler for xilloader. More...
 
int XLoader_PlatInit (void)
 This function initializes the loader with platform specific initializations. More...
 
int XLoader_HdrMeasurement (XilPdi *PdiPtr)
 This function measures the PDI's meta header data by calculating the hash using SHA3. More...
 
int XLoader_SecureConfigMeasurement (XLoader_SecureParams *SecurePtr, u32 PcrInfo, u32 *DigestIndex, u32 OverWrite)
 This function measures the Secure Configuration that is SPK, SPK ID and Encryption Revoke ID and extends to the specified PCR. More...
 
int XLoader_ConfigureJtagState (XPlmi_Cmd *Cmd)
 This function enables or disable Jtag Access Command payload parameters are. More...
 
int XLoader_CheckAndUpdateSecureState (void)
 This function checks and updates the secure state configuration. More...
 
int XLoader_LoadLpdAndPsmElf ()
 This function will load the LPD and PSM ELF file from DDR. More...
 

Macro Definition Documentation

#define CFRAME_BCAST_REG_FAR_BLOCKTYPE_SHIFT   (20U)

CFrame address register block type shift.

Referenced by XLoader_CframeDataClearCheck().

#define CFRAME_BCAST_REG_FAR_OFFSET   (0x10U)

CFrame address register offset.

Referenced by XLoader_CframeDataClearCheck().

#define CFRAME_BCAST_REG_TESTMODE_CRAM_SELF_CHECK_MASK   (0x100U)

CRAM self check mask.

Referenced by XLoader_CframeDataClearCheck().

#define CFRAME_BCAST_REG_TESTMODE_OFFSET   (0x120U)

Test mode offset.

Referenced by XLoader_CframeDataClearCheck().

#define CFRAME_CRC_POLL_TIMEOUT   (0xFFFFU)

CRC poll time out.

Referenced by XLoader_CframeDataClearCheck().

#define CFRAME_MAX_BLOCK_TYPE_COUNT   (0x3U)

CFrame maximum block type count.

Referenced by XLoader_CframeDataClearCheck().

#define PLM_VP1802_POR_SETTLE_TIME   (25000U)

Flag indicates POR settle time for VP1802.

Referenced by XLoader_PerformInternalPOR().

#define PMC_GLOBAL_PMC_ERR2_STATUS_CFI_SHIFT   (16U)

CFI Non-Correctable Error shift.

Referenced by XLoader_CframeErrorHandler().

#define XLOADER_AES_RESET_REG   (0xF11E0010U)

AES Reset register address.

#define XLOADER_AES_RESET_VAL   (0x1U)

AES Reset value.

#define XLOADER_ATF_HANDOFF_PARAMS_LCVERSION   (1U)

ATF handoff parameters lowest compatible version.

#define XLOADER_ATF_HANDOFF_PARAMS_LCVERSION   (1U)

ATF handoff parameters lowest compatible version.

#define XLOADER_ATF_HANDOFF_PARAMS_VERSION   (1U)

ATF handoff parameters version.

#define XLOADER_ATF_HANDOFF_PARAMS_VERSION   (1U)

ATF handoff parameters version.

#define XLOADER_BBRAM_OBFUS_KEY   (0x3A5C3C57U)

BBRAM obfuscated key.

#define XLOADER_BBRAM_OBFUS_KEY   (0x3A5C3C57U)

BBRAM obfuscated key.

#define XLOADER_BH_OBFUS_KEY   (0xA35C7CA5U)

Boot header obfuscated key.

#define XLOADER_BH_OBFUS_KEY   (0xA35C7CA5U)

Boot header obfuscated key.

#define XLOADER_BOOT_COPY_OPTIMIZATION_ENABLED   (0U)

Indicates Boot Device Copy Optimization is Enabled.

#define XLOADER_BOOTPDI_INFO_PARAMS_LCVERSION   (2U)

BootPDI info lowest compatible version.

#define XLOADER_BOOTPDI_INFO_PARAMS_LCVERSION   (2U)

BootPDI info lowest compatible version.

#define XLOADER_BOOTPDI_INFO_PARAMS_VERSION   (2U)

BootPDI info version.

#define XLOADER_BOOTPDI_INFO_PARAMS_VERSION   (2U)

BootPDI info version.

#define XLOADER_CFRAME_DATACLEAR_CHECK_CMD_ID   (0xCU)

Data clear check command Id.

Referenced by XLoader_CframeDataClearCheck().

#define XLOADER_CMD_CONFIG_JTAG_STATE_FLAG_INDEX   (0U)

Index in the Payload of ConfigureJtagState command where JTAG state flag is present.

#define XLOADER_CMD_CONFIG_JTAG_STATE_FLAG_INDEX   (0U)

Index in the Payload of ConfigureJtagState command where JTAG state flag is present.

Referenced by XLoader_ConfigureJtagState().

#define XLOADER_CMD_CONFIG_JTAG_STATE_FLAG_MASK   (0x03U)

Mask for JTAG state flag.

#define XLOADER_CMD_CONFIG_JTAG_STATE_FLAG_MASK   (0x03U)

Mask for JTAG state flag.

Referenced by XLoader_ConfigureJtagState().

#define XLOADER_CMD_GET_DDR_DEVICE_ID   (0U)

DDR device id.

#define XLOADER_CMD_GET_DDR_DEVICE_ID   (0U)

DDR device id.

Referenced by XLoader_ReadDdrCryptoPerfCounters().

#define XLOADER_CONFIG_JTAG_STATE_FLAG_DISABLE   (0x00U)

Value of JTAG state flag if disabled.

#define XLOADER_CONFIG_JTAG_STATE_FLAG_DISABLE   (0x00U)

Value of JTAG state flag if disabled.

Referenced by XLoader_ConfigureJtagState().

#define XLOADER_CONFIG_JTAG_STATE_FLAG_ENABLE   (0x03U)

Value of JTAG state flag if enabled.

#define XLOADER_CONFIG_JTAG_STATE_FLAG_ENABLE   (0x03U)

Value of JTAG state flag if enabled.

Referenced by XLoader_ConfigureJtagState().

#define XLOADER_DDR_CRYPTO_MAIN_OFFSET   (0X40000U)

DDR crypto block offset from ub.

#define XLOADER_DDR_CRYPTO_MAIN_OFFSET   (0X40000U)

DDR crypto block offset from ub.

Referenced by XLoader_ReadDdrCryptoPerfCounters().

#define XLOADER_DDR_PERF_MON_CNT0_OFFSET   (0X868U)

Counter 0 offset.

#define XLOADER_DDR_PERF_MON_CNT0_OFFSET   (0X868U)

Counter 0 offset.

Referenced by XLoader_ReadDdrCryptoPerfCounters().

#define XLOADER_DDR_PERF_MON_CNT1_OFFSET   (0X86CU)

Counter 1 offset.

#define XLOADER_DDR_PERF_MON_CNT1_OFFSET   (0X86CU)

Counter 1 offset.

Referenced by XLoader_ReadDdrCryptoPerfCounters().

#define XLOADER_DDR_PERF_MON_CNT2_OFFSET   (0X870U)

Counter 2 offset.

#define XLOADER_DDR_PERF_MON_CNT2_OFFSET   (0X870U)

Counter 2 offset.

Referenced by XLoader_ReadDdrCryptoPerfCounters().

#define XLOADER_DDR_PERF_MON_CNT3_OFFSET   (0X874U)

Counter 3 offset.

#define XLOADER_DDR_PERF_MON_CNT3_OFFSET   (0X874U)

Counter 3 offset.

Referenced by XLoader_ReadDdrCryptoPerfCounters().

#define XLOADER_ECDSA_RSA_RESET_REG   (0xF1200040U)

ECDSA RSA Reset register address.

#define XLOADER_ECDSA_RSA_RESET_VAL   (0x1U)

ECDSA RSA Reset value.

#define XLOADER_EFUSE_OBFUS_KEY   (0xA5C3C5A7U)

eFuse obfuscated key

#define XLOADER_EFUSE_OBFUS_KEY   (0xA5C3C5A7U)

eFuse obfuscated key

#define XLOADER_EFUSE_ROM_RSVD_AUTH_KEYS_TO_HASH_MASK   (0x00000200U)

AUTH_KEYS_TO_HASH eFuse bit mask.

#define XLOADER_EFUSE_ROM_RSVD_AUTH_KEYS_TO_HASH_SHIFT   (9U)

AUTH_KEYS_TO_HASH eFuse bit shift.

#define XLOADER_EFUSE_ROM_RSVD_CACHE_ADDRESS   (0xF1250090U)

ROM Reserved eFuse cache offset.

#define XLOADER_GET_PRTN_HASH_INDEX (   PdiPtr)
Value:
(PdiPtr->PdiType == XLOADER_PDI_TYPE_FULL) \
? (PdiPtr->PrtnNum) : (PdiPtr->PrtnNum +1U)
#define XLOADER_PDI_TYPE_FULL
< Different PDI types
Definition: xloader.h:185

Get partition hash index depending on full/partial PDI.

Referenced by XLoader_DataMeasurement().

#define XLOADER_IMAGE_INFO_LCVERSION   (1U)

Image lowest compatible version information.

#define XLOADER_IMAGE_INFO_LCVERSION   (1U)

Image lowest compatible version information.

#define XLOADER_IMAGE_INFO_TBL_MAX_NUM
Value:
(XPLMI_IMAGE_INFO_TBL_BUFFER_LEN / \
sizeof(XLoader_ImageInfo))

Maximum number of image info tables in the available buffer.

Referenced by XLoader_GetImageInfoEntry().

#define XLOADER_IMAGE_INFO_VERSION   (1U)

Image version information.

#define XLOADER_IMAGE_INFO_VERSION   (1U)

Image version information.

#define XLOADER_INVALID_OBFUS_KEY   (0xFFFFFFFFU)

Invalid obfuscated key.

#define XLOADER_LOG_LEVEL_MASK   (0xF0U)

Flag indicates Log level mask.

#define XLOADER_PCR_MEASUREMENT_INDEX_MASK   (0xFFFF0000U)

Mask for PCR Measurement index.

Referenced by XLoader_MeasureNLoad().

#define XLOADER_PCR_MEASUREMENT_INDEX_MASK   (0xFFFF0000U)

Mask for PCR Measurement index.

#define XLOADER_PDI_LIST_LCVERSION   (1U)

PDI lowest compatible version list.

#define XLOADER_PDI_LIST_LCVERSION   (1U)

PDI lowest compatible version list.

#define XLOADER_PDI_LIST_VERSION   (1U)

PDI version list.

#define XLOADER_PDI_LIST_VERSION   (1U)

PDI version list.

#define XLOADER_PUF_SHUT_GLB_VAR_FLTR_EN_SHIFT   (31U)

Shift for Global Variation Filter in PUF shutter value.

#define XLOADER_RPU_GLBL_CNTL   (0xFF9A0000U)

RPU global control.

Referenced by XLoader_ProcessElf().

#define XLOADER_RSA_EM_MSB_INDEX   (0x0U)

RSA EM MSB Index.

#define XLOADER_RSA_PSS_MSB_PADDING_MASK   (u8)(0x80U)

RSA PSS MSB padding mask.

#define XLOADER_SBI_CTRL_INTERFACE_AXI_SLAVE   (0x8U)

SBI PCIE PDI load.

#define XLOADER_SBI_DELAY_IN_MICROSEC   (5000U)

Flag indicates SBI delay in micro second.

#define XLOADER_SHA3_RESET_REG   (0xF1210004U)

SHA3 Reset register address.

Referenced by XLoader_SecureClear().

#define XLOADER_SHA3_RESET_VAL   (0x1U)

SHA3 Reset value.

Referenced by XLoader_SecureClear().

#define XLOADER_SUCCESS_NOT_PRTN_OWNER   (0x100U)

Indicates that PLM is not the partition owner.

Referenced by XLoader_LoadImagePrtns().

#define XLOADER_TCM_0   (0U)

TCM 0.

Referenced by XLoader_ProcessElf().

#define XLOADER_TCM_1   (1U)

TCM 1.

Referenced by XLoader_ProcessElf().

#define XLOADER_TCMCOMB_MASK   (0x40U)

TCM combine mask.

Referenced by XLoader_ProcessElf().

#define XLOADER_TCMCOMB_SHIFT   (6U)

TCM combine shift.

Referenced by XLoader_ProcessElf().

#define XPLMI_ZERO   (0x0U)

Zero.

Referenced by XLoader_CframeDataClearCheck().

Function Documentation

int XLoader_AddAuthJtagToScheduler ( void  )

This function adds periodic checks of the status of Auth JTAG interrupt status to the scheduler.

Returns
  • XST_SUCCESS otherwise error code is returned
  • XLOADER_ERR_GLITCH_DETECTED if glitch is detected.
  • XLOADER_ERR_ADD_TASK_SCHEDULER if failed to add task to scheduler.
  • Read auth_jtag_disable efuse bits(20:19) of Security Control register in Efuse Cache module.
  • Read PPK hash registers in Efuse Cache module and check if they are non-zero.
  • Check the preconditions for adding task to the scheduler
    • Auth jtag disable efuse bits should not be set.
    • PPK hash registers should be non zero.
  • If the preconditions are correct then add task to the scheduler for calling the API to check Auth JTAG interrupt status.
  • The task should not be added to the scheduler if Auth JTAG disable efuse bit is set or PPK hash is not programmed in efuse. Thus forcing the Status to be XST_SUCCESS.

Referenced by XLoader_Init().

int XLoader_AddDeviceStateChangeToScheduler ( void  )

This function adds periodic checks of the device status change during secure boot.

Returns
XST_SUCCESS on success.
XLOADER_ERR_ADD_TASK_SCHEDULER if failed to add task to scheduler.

References XLoader_CheckDeviceStateChange(), XLOADER_DEVICE_STATE_POLL_INTERVAL, XLOADER_EFUSE_CACHE_JTAG_DIS_MASK, XLOADER_EFUSE_CACHE_SECURITY_CONTROL_OFFSET, XLoader_GetAHWRoT(), and XLoader_GetSHWRoT().

Referenced by XLoader_Init().

int XLoader_AdditionalPpkSelect ( XLoader_PpkSel  PpkSelect,
u32 *  InvalidMask,
u32 *  PpkOffset 
)

This function checks for the additional PPK select and returns the PPK invalid mask and PPK efuse cache start offset if PPK is valid.

Parameters
PpkSelectPPK selection of eFUSE.
InvalidMaskPointer to the PPK invalid mask
PpkOffsetPointer to the efuse cache PPK start offset
Returns
  • XST_SUCCESS on success and error code on failure
Parameters
PpkSelectPPK selection of eFUSE.
InvalidMaskPointer to the PPK invalid mask
PpkOffsetPointer to the efuse cache PPK start offset
Returns
XST_FAILURE always return failue, as this api is not applicable for versal_net
Parameters
PpkSelectPPK selection of eFUSE.
InvalidMaskPointer to the PPK invalid mask
PpkOffsetPointer to the efuse cache PPK start offset
Returns
XST_FAILURE always return failure, as this api is not applicable for versal_net
int XLoader_AesObfusKeySelect ( u32  PdiKeySrc,
u32  DecKeyMask,
void *  KeySrcPtr 
)

This function provides Obfuscated Aes Key source.

Parameters
PdiKeySrcis the Key source given in Pdi
DecKeyMaskis the current DecKeyMask
KeySrcPtris the pointer to the calculated KeySrc
Returns
  • XST_SUCCESS on success and error code on failure
Parameters
PdiKeySrcis the Key source given in Pdi
DecKeyMaskis the current DecKeyMask
KeySrcPtris the pointer to the calculated KeySrc
Returns
XST_SUCCESS on success and error code on failure

References XLOADER_SEC_AES_KEK_DEC.

int XLoader_AuthEncClear ( void  )

This function is called to clear secure critical data related to authentication and encryption in case of exceptions.

The function also places AES, ECDSA_RSA in reset.

Returns
  • XST_SUCCESS on success.
  • XST_FAILURE on failure.
  • Clear keys.
  • Place AES in reset and clear AES instance
  • Release RSA from reset
  • Clear RSA or ECDSA memory
  • Place RSA or ECDSA in reset

Referenced by XLoader_SecureClear().

int XLoader_CfiSelectiveRead ( XPlmi_Cmd *  Cmd)

This function provides CFI SELECTIVE READ command execution.

            Command payload parameters are
 - Row, block type and Start frame address
    - Frame count to be read from CFU(1frame = 25Quadwords)
    - High Dest Addr
    - Low Dest Addr
Parameters
Cmdis pointer to the command structure
Returns
  • XST_SUCCESS on success.
  • Error code on failure

References XLOADER_CFI_SEL_READBACK_ID, XLoader_CframeInit(), XLOADER_ERR_INVALID_BLOCK_TYPE, XLOADER_ERR_INVALID_ROW, XLOADER_FRAME_COUNT_EXCEEDS_LASTFRAME, XLOADER_INVALID_FRAME_ADDRESS, and XLOADER_SELREADBACK_ROW_MASK.

int XLoader_CframeDataClearCheck ( XPlmi_Cmd *  Cmd)

This function is used to check if the Cframe data is cleared or not using CRC method.

This function need to be called after CFI house cleaning is done.

Parameters
Cmdis pointer to the command. Command payload parameters are: Block Type
Returns
  • XST_SUCCESS on success.
  • XLOADER_INVALID_BLOCKTYPE if block type passed is invalid. Only Type 0, Type 1, and Type 2 are supported.
  • XLOADER_CFI_CFRAME_IS_BUSY if CRAM self check fails as CFI CFrame is busy.
  • XLOADER_CFRAME_CRC_CHECK_FAILED if CFRAME CRC check fails.
  • Check if the block type is valid
  • Initialize Cframe driver
  • Enable CRAM Self Check
  • Reset CRC
  • Set Frame Address Register with the Block type
  • Send RDALL command
  • Check if Cframe is busy
  • Check CRC
  • Clear CRAM Self Check

References CFRAME_BCAST_REG_FAR_BLOCKTYPE_SHIFT, CFRAME_BCAST_REG_FAR_OFFSET, CFRAME_BCAST_REG_TESTMODE_CRAM_SELF_CHECK_MASK, CFRAME_BCAST_REG_TESTMODE_OFFSET, CFRAME_CRC_POLL_TIMEOUT, CFRAME_MAX_BLOCK_TYPE_COUNT, XLOADER_CFI_CFRAME_IS_BUSY, XLOADER_CFRAME_CRC_CHECK_FAILED, XLOADER_CFRAME_DATACLEAR_CHECK_CMD_ID, XLoader_CframeInit(), XLOADER_INVALID_BLOCKTYPE, and XPLMI_ZERO.

void XLoader_CframeErrorHandler ( u32  ImageId)

This function is used to check the CFU ISR and PMC_ERR1 and PMC_ERR2 status registers to check for any errors in PL and call corresponding error recovery functions if needed.

Parameters
ImageIdis Id of the image present in PDI

CFU Driver Instance

  • Execute CfiErrorHandler.
  • Execute CFU Error Handler.
  • Retrigger PL house clean if it's a PLD0 image.

References PMC_GLOBAL_PMC_ERR2_STATUS_CFI_SHIFT.

int XLoader_CframeInit ( void  )

This function initializes the Cframe driver.

Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_CFRAME_LOOKUP if CFrame lookup fails.
  • XLOADER_ERR_CFRAME_CFG if CFrame configuration fails.
  • Initialize the Cframe driver so that it's ready to use look up the configuration in the config table, and then initialize it.
  • Enable SLVERR for CFU.

Referenced by XLoader_CfiSelectiveRead(), XLoader_CframeDataClearCheck(), and XLoader_Init().

int XLoader_CheckAndUpdateSecureState ( void  )

This function checks and updates the secure state configuration.

Returns
  • XST_SUCCESS on success.
  • Error code on failure

References XLOADER_SEC_STATE_CONFIG_MEASUREMENT_ERROR.

Referenced by XLoader_CheckDeviceStateChange().

int XLoader_CheckAuthJtagIntStatus ( void *  Arg)

This function checks the status of Auth JTAG interrupt status and it disables the Jtag as per the timeout set by user.

Parameters
ArgNot used in the function currently
Returns
  • XST_SUCCESS on success.
  • XLOADER_DAP_TIMEOUT_DISABLED if timeout is disabled for DAP.
Note
If Auth JTAG interrupt status is set, then XLoader_AuthJtag API will be called.
  • Read Auth Jtag Interrupt Status register in PMC TAP module.
  • Check if Auth JTAG Lock disable efuse bits are set. If set then allow limited number of attempts to enable JTAG.
  • When AUTH_JTAG_LOCK_DIS eFuse is programmed, allow only one failed attempt for AuthJTag message. For the second failure trigger secure lock down.

References XLOADER_AUTH_JTAG_LOCK_DIS_MASK, XLOADER_AUTH_JTAG_MAX_ATTEMPTS, XLOADER_EFUSE_CACHE_SECURITY_CONTROL_OFFSET, XLOADER_PMC_TAP_AUTH_JTAG_INT_STATUS_MASK, and XLOADER_PMC_TAP_AUTH_JTAG_INT_STATUS_OFFSET.

Referenced by XLoader_UpdateHandler().

int XLoader_CheckDeviceStateChange ( void *  Arg)

This function checks the JTAG device state change.

            When Secure gate is opened from close state this API raises an error,
    if the gate is closed and re-opened again this function recognizes the
    state change and performs the action configured.
Parameters
Argis of pointer of void type.
Returns
XST_SUCCESS on success and error code on failure

References XLoader_CheckAndUpdateSecureState(), XLOADER_JTAG_SEC_GATE_CLOSE, XLOADER_JTAG_SEC_GATE_OPEN, XLOADER_PMC_TAP_JTAG_STATUS_0, and XLOADER_PMC_TAP_JTAG_STATUS_DAP_STATUS_MASK.

Referenced by XLoader_AddDeviceStateChangeToScheduler(), and XLoader_UpdateHandler().

int XLoader_CheckNonZeroPpk ( void  )

This function checks if PPK is programmed.

Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_GLITCH_DETECTED if glitch is detected.
  • XST_FAILURE on failure.
  • Check if any of the PPK efuses are not programmed.

References XLOADER_EFUSE_PPK0_START_OFFSET, and XLOADER_EFUSE_PPK2_END_OFFSET.

Referenced by XLoader_CheckSecureStateAuth().

int XLoader_CheckSecureState ( u32  RegVal,
u32  Var,
u32  ExpectedValue 
)

This function checks if the secure state of boot matches the expected value or not.

Parameters
RegVal- Value of secure state stored in register
Var- Value of secure state stored in variable
ExpectedValue- Expected value of secure state
Returns
XST_SUCCESS on success and error code on failure

Referenced by XLoader_DataAuth(), XLoader_SecureEncInit(), and XLoader_UpdateCfgLimitCount().

int XLoader_CheckSecureStateAuth ( volatile u32 *  AHWRoT)

This function checks Secure State for Authentication.

Parameters
AHWRoT- Buffer to store Secure state for authentication
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_HWROT_BH_AUTH_NOT_ALLOWED if PPK is programmed and boot header authentication is enabled.
Parameters
AHWRoT- Buffer to store Secure state for authentication
Returns
XST_SUCCESS on success.
XLOADER_ERR_GLITCH_DETECTED if glitch is detected.
  • If PPK hash is programmed in eFUSEs, then Secure State of boot is A-HWRoT.
  • If BHDR authentication is enabled, then Secure State of boot is emulated A-HWRoT.

If PPK hash is programmed in eFUSEs, then Secure State of boot is A-HWRoT

If PPK hash is not programmed in eFUSEs and PLM is authenticated then Secure State of boot is emulated A-HWRoT

If PPK hash is programmed in eFUSEs, then Secure State of boot is A-HWRoT

If PPK hash is not programmed in eFUSEs and PLM is authenticated then Secure State of boot is emulated A-HWRoT

References XLoader_CheckNonZeroPpk().

Referenced by XLoader_SetSecureState().

int XLoader_ClearAesKey ( u32 *  DecKeySrc)

This function clears the AES keys when RedKeyClear is set in PMC RAM.

Parameters
DecKeySrcis pointer to the Decrypt Key source
Returns
  • XST_SUCCESS on success.
  • ErrorCode on failure.

References XLOADER_SEC_KEY_CLEAR_FAILED_ERROR.

int XLoader_ClearATFHandoffParams ( XilPdi *  PdiPtr)

This function clears ATF Handoff parameters in case of multi-partitions in APU subsystem.

Parameters
PdiPtrPointer to XilPdi instance
Returns
  • XST_SUCCESS on success
  • XST_FAILURE on failure

Referenced by XLoader_ProcessElf().

void XLoader_ClearKatOnPPDI ( XilPdi *  PdiPtr,
u32  PlmKatMask 
)

This function updates the KAT status.

Parameters
PdiPtris pointer to the XilPdi instance
PlmKatMaskis the mask of the KAT that is going to run
int XLoader_ConfigureJtagState ( XPlmi_Cmd *  Cmd)

This function enables or disable Jtag Access Command payload parameters are.

                    - Flag (enable / disable)
Parameters
Cmdis pointer to the command structure
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_INVALID_JTAG_OPERATION

Invalid JTAG Operation request

Invalid JTAG Operation request

References XLOADER_CMD_CONFIG_JTAG_STATE_FLAG_INDEX, XLOADER_CMD_CONFIG_JTAG_STATE_FLAG_MASK, XLOADER_CONFIG_DAP_STATE_NONSECURE_DBG, XLOADER_CONFIG_JTAG_STATE_FLAG_DISABLE, XLOADER_CONFIG_JTAG_STATE_FLAG_ENABLE, XLoader_DisableJtag(), XLoader_EnableJtag(), and XLOADER_ERR_INVALID_JTAG_OPERATION.

int XLoader_DataAuth ( XLoader_SecureParams *  SecurePtr,
u8 *  Hash,
u8 *  Signature 
)

This function authenticates the data with SPK.

Parameters
SecurePtris pointer to the XLoader_SecureParams instance.
Hashis a Pointer to the expected hash buffer.
Signaturepointer points to the signature buffer.
Returns
  • XST_SUCCESS on success.
  • XLOADER_SEC_GLITCH_DETECTED_ERROR if glitch is detected.

References XLoader_CheckSecureState(), XLoader_GetAHWRoT(), XLOADER_NOLOAD_VAL, XLOADER_PPK_SIZE, and XLOADER_SEC_GLITCH_DETECTED_ERROR.

int XLoader_DataMeasurement ( XLoader_ImageMeasureInfo *  ImageInfo)

This function measures the data by calculating SHA3 hash.

Parameters
ImageInfoPointer to the XLoader_ImageMeasureInfo structure
Returns
  • XST_SUCCESS on successfully measuring the data
  • XLOADER_ERR_DATA_MEASUREMENT if error in data measurement.
Parameters
ImageInfoPointer to the XLoader_ImageMeasureInfo structure.
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_DATA_MEASUREMENT if error in data measurement.

References XLOADER_GET_PRTN_HASH_INDEX, XLOADER_MEASURE_FINISH, XLOADER_MEASURE_START, XLOADER_MEASURE_UPDATE, XLOADER_PCR_NUMBER_MASK, and XLOADER_SHA3_LEN.

Referenced by XLoader_HdrMeasurement(), XLoader_MeasureNLoad(), and XLoader_PrtnCopy().

int XLoader_DdrCopy ( u64  SrcAddr,
u64  DestAddr,
u32  Length,
u32  FlagsVal 
)

This function is used to copy the data from DDR to destination address.

Parameters
SrcAddrof DDR
DestAddris the address of the destination where the data needs to be copied.
Lengthof the bytes to be copied
FlagsValthat denote blocking / non-blocking dma
Returns
  • XST_SUCCESS on success.
  • XLOADER_DDR_COPY_UNSUPPORTED_PARAMS on invalid params passed.
  • Validate the source address, destination address and length of the bytes. Otherwise return XLOADER_DDR_COPY_UNSUPPORTED_PARAMS.
  • If the flag is XPLMI_DEVICE_COPY_STATE_WAIT_DONE, then wait till the data is copied and DMA returns done.
  • If the flag is XPLMI_DEVICE_COPY_STATE_INITIATE, then start the dma transfer and don't wait for the done bit.
int XLoader_DdrInit ( u32  DeviceFlags)

This function is used to initialize for DDR init.

Parameters
DeviceFlagsLoader init prototype requires flags
Returns
  • XST_SUCCESS on success
  • XLOADER_ERR_PM_DEV_DDR_0 on device request to DDR fail.
  • Initialize the device request for DDR_0.
  • Otherwise return XLOADER_ERR_PM_DEV_DDR_0.

Referenced by XLoader_DumpDdrmcRegisters().

int XLoader_DdrRelease ( void  )

This function releases control of DDR.

Returns
  • XST_SUCCESS on success
  • XLOADER_ERR_RELEASE_PM_DEV_DDR_0 on device release fail.
  • Initialize the DDR_0 device release request.
  • Otherwise return XLOADER_ERR_RELEASE_PM_DEV_DDR_0.

References XLOADER_PDI_SRC_DDR.

int XLoader_DisableJtag ( void  )

This function disables the Jtag.

Returns
  • XST_SUCCESS on SUCCESS
  • Errorcode upon failure

Reset DBG module

Enable security gate

Disable all the instructions

Disable secure/non-secure debug Disabled invasive & non-invasive debug

Referenced by XLoader_ConfigureJtagState().

int XLoader_EnableJtag ( volatile u32  CfgState)

This function enables the Jtag.

Returns
  • XST_SUCCESS on SUCCESS
  • Errorcode upon failure

Enable secure/non-secure debug Enabled invasive & non-invasive debug

Enable only non-secure debug

Enable all the instructions

Disable security gate

Take DBG module out of reset

References XLOADER_DAP_CFG_ENABLE_ALL_DBG_MASK.

Referenced by XLoader_ConfigureJtagState().

u32 XLoader_GetAHWRoT ( const u32 *  AHWRoTPtr)

This function returns the state of authenticated boot.

Parameters
AHWRoTPtr- Always NULL except at time of initialization of SecureStateAHWRoT variable
Returns
  • XPLMI_RTCFG_SECURESTATE_AHWROT - PPK fuses are programmed
  • XPLMI_RTCFG_SECURESTATE_EMUL_AHWROT - BHDR auth is enabled
  • XPLMI_RTCFG_SECURESTATE_NONSECURE - Neither PPK fuses are programmed nor BH auth is enabled
  • If AHWRoTPtr is not NULL, then set the SecureStateSHWRoT. Otherwise return the previous stored Secure state.

Referenced by XLoader_AddDeviceStateChangeToScheduler(), XLoader_DataAuth(), XLoader_SecureEncInit(), XLoader_SetSecureState(), and XLoader_UpdateCfgLimitCount().

XilPdi_ATFHandoffParams * XLoader_GetATFHandoffParamsAddr ( void  )

This function returns the ATFHandoffParams structure address to the caller.

Returns
Returns ATFHandoffParams structure address

< Instance containing ATF handoff params

Referenced by XLoader_PdiInit(), and XLoader_SetATFHandoffParameters().

XilBootPdiInfo * XLoader_GetBootPdiInfo ( void  )

This function provides pointer to BootPDI Info.

Returns
pointer to BootPDI Info

< BootPDI info Storage

< BootPDI info Storage

< BootPDI info Storage

Referenced by XLoader_RestartImage(), and Xloader_SaveBootPdiInfo().

int XLoader_GetImageAndPrtnInfo ( XilPdi *  PdiPtr,
u32  ImageId 
)

This function provides Image number and partition number of a given ImgId in the PDI instance.

Parameters
PdiPtrPdi instance pointer
ImageIdImage id of a subsystem
Returns
- XST_SUCCESS on success
  • XST_FAILURE on failure

Check if the given ImageId matches with any Images present in PDI.

If not matched return error, else success.

Referenced by XLoader_LoadLpdAndPsmElf().

XLoader_ImageInfo* XLoader_GetImageInfoEntry ( u32  ImgID)

This function returns the ImageInfoEntry by checking if an entry exists for that particular ImgId in the ImgInfoTbl.

Parameters
ImgIDof the the entry that has to be stored
Returns
Address of ImageInfo Entry in the table

Check for a existing valid image entry matching given ImgID

References XLoader_GetImageInfoTbl(), XLOADER_IMAGE_INFO_TBL_MAX_NUM, and XLOADER_INVALID_IMG_ID.

XLoader_ImageInfoTbl * XLoader_GetImageInfoTbl ( void  )

This function provides ImageInfoTbl pointer.

Returns
Pointer to ImageInfoTbl

Referenced by XLoader_GetImageInfoEntry(), and XLoader_LoadImageInfoTbl().

u32 XLoader_GetKekSrc ( void  )

This function updates KEK red key availability status from boot header.

Returns
  • Decryption Key source status.

References XLOADER_BBRAM_BLK_KEY, XLOADER_BBRAM_RED_KEY, XLOADER_BH_BLK_KEY, XLOADER_BHDR_RED_KEY, XLOADER_EFUSE_BLK_KEY, and XLOADER_EFUSE_RED_KEY.

XilPdi* XLoader_GetPdiInstance ( void  )

This function provides PdiInstance pointer.

Returns
Pointer to PdiInstance

Referenced by XLoader_Init(), XLoader_LoadLpdAndPsmElf(), XLoader_PdiInit(), and XLoader_RestartImage().

XLoader_ImageStore * XLoader_GetPdiList ( void  )

This function provides pointer to PdiList.

Returns
Pointer to PdiList
pointer to PdiList

Referenced by XLoader_IsPdiAddrLookup(), XLoader_ReadImageStoreCfg(), and XLoader_RestartImage().

int XLoader_GetSDPdiSrcNAddr ( u32  SecBootMode,
XilPdi *  PdiPtr,
u32 *  PdiSrc,
u64 *  PdiAddr 
)

This function is used to get PdiSrc and PdiAddr for Secondary SD boot modes.

Parameters
SecBootModeis the secondary boot mode value
PdiPtrPointer to PDI instance
PdiSrcPointer to the source of PDI
PdiAddris the pointer to the address of the Pdi
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_UNSUPPORTED_SEC_BOOT_MODE on unsupported secondary bootmode.
Parameters
SecBootModeis the secondary boot mode value
PdiPtrPointer to the PDI instance
PdiSrcis pointer to the source of PDI
PdiAddris the pointer to the address of the Pdi
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_UNSUPPORTED_SEC_BOOT_MODE on unsupported secondary bootmode.
  • Get the PDI source address for the secondary boot device.
  • Get the PDI source address for the secondary boot device.
  • Get the PDI source address for the secondary boot device.

References XLOADER_SD_RAWBOOT_MASK.

u32 XLoader_GetSHWRoT ( const u32 *  SHWRoTPtr)

This function returns the state of encrypted boot.

Parameters
SHWRoTPtr- Always NULL except at time of initialization of SecureStateSHWRoT variable
Returns
  • XPLMI_RTCFG_SECURESTATE_SHWROT - Any DEC only fuse is programmed
  • XPLMI_RTCFG_SECURESTATE_EMUL_SHWROT - PLM is encrypted
  • XPLMI_RTCFG_SECURESTATE_NONSECURE - Neither DEC only fuses are programmed nor PLM is encrypted
  • If SHWRoTPtr is not NULL, then set the SecureStateSHWRoT. Otherwise return the previous stored Secure state.

Referenced by XLoader_AddDeviceStateChangeToScheduler(), XLoader_SecureEncInit(), XLoader_SetSecureState(), and XLoader_UpdateCfgLimitCount().

XLoader_SecureTempParams* XLoader_GetTempParams ( void  )

This function returns the pointer to XLoader_SecureTempParams.

Returns
Pointer to XLoader_SecureTempParams

Referenced by XLoader_ProcessAuthEncPrtn(), XLoader_PrtnCopy(), XLoader_ReadAndVerifySecureHdrs(), XLoader_SecureAuthInit(), XLoader_SecureEncInit(), and XLoader_SecureInit().

int XLoader_HdrMeasurement ( XilPdi *  PdiPtr)

This function measures the PDI's meta header data by calculating the hash using SHA3.

Parameters
PdiPtris the pointer to PDI instance
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_HDR_MEASUREMENT if error in meta header measurement.

References XLoader_DataMeasurement(), XLOADER_MEASURE_FINISH, XLOADER_MEASURE_START, and XLOADER_MEASURE_UPDATE.

int XLoader_IdCodeCheck ( const XilPdi_ImgHdrTbl *  ImgHdrTbl)

This function performs the checks of IDCODE and EXTENDED IDCODE.

                    It also supports bypass of subset of these checks.
Parameters
ImgHdrTblpointer to the image header table.
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_EXT_ID_SI if extended ID code is mismatched with device.
  • XLOADER_ERR_IDCODE on ID code mismatch.
  • XLOADER_ERR_EXT_IDCODE on extended ID code mismatch.

< IdCode as read from IHT

< Extended IdCode as read from IHT

< IdCode as read from Device

< Extended IdCode as read from Device

< Flag to bypass checks

< Flag to indicate IsVC1902-ES1 device

< Flag to indicate Extended IdCode is valid

  • check to bypass entire ID Code Check
  • Read IdCode and extended Id Code from the image header table and from PMC_TAP register
  • Determine and fetch the Extended IDCODE (out of two) for checks
  • Check if the IdCode read is VC1902 ES1
  • Check if a subset of checks to be bypassed
  • Error out for the invalid combination of Extended IDCODE - Device. Assumption is that only VC1902-ES1 device can have Extended IDCODE value 0

References XLOADER_ERR_EXT_ID_SI, XLOADER_ERR_EXT_IDCODE, and XLOADER_ERR_IDCODE.

int XLoader_ImgHdrTblAuth ( XLoader_SecureParams *  SecurePtr)

This function authenticates the image header table.

Parameters
SecurePtris pointer to the XLoader_SecureParams instance
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_IHT_GET_DMA if acquiring DMA is failed.
  • XLOADER_ERR_IHT_COPY_FAIL if IHT copy fails.
  • XLOADER_ERR_IHT_HASH_CALC_FAIL if IHT hash calculation fails.
  • XLOADER_ERR_IHT_AUTH_FAIL if IHT authentication fails.
  • Copy Authentication certificate from PDI to PMCRAM
  • Authenticate Image header table
int XLoader_Init ( void  )

This function initializes the loader instance and registers loader commands with PLM.

Returns
  • XST_SUCCESS on success and error code on failure
  • Initialize the Uart Logs Config
  • Initialize the loader commands
  • Initialize the loader interrupts
  • Set the secure state of boot in registers and global variables
  • Decrements the count of configuration limiter
  • Add task to the scheduler to handle Authenticated JTAG message
  • Add DAP status check task to the scheduler, this is applicable only for VersalNet.

References XLoader_AddAuthJtagToScheduler(), XLoader_AddDeviceStateChangeToScheduler(), XLOADER_BBRAM_CL_DECREMENT_COUNT, XLoader_CframeInit(), XLoader_GetPdiInstance(), XLoader_IntrInit(), XLoader_PlatInit(), XLoader_SetSecureState(), and XLoader_UpdateCfgLimitCount().

int XLoader_InitPdiInstanceForExtractMHAndOptData ( XPlmi_Cmd *  Cmd,
XilPdi *  PdiPtr,
u64  SrcAddr,
u64  DestAddr,
u32  DestSize 
)

This function initializes PDI Instance pointer for extracting Metaheader and OptionalData.

Parameters
CmdPointer to the command structure
PdiPtrPointer to PdiInstance
SrcAddrAddress of the PDI
DestAddrAddress of the destination buffer
DestSizeSize of the destination buffer
Returns
  • XST_SUCCESS on success
  • ErrorCode on failure

Clear the Metaheader instance area

Check if Metaheader offset is pointing to a valid location

Extract Metaheader using PdiInit

  • Get the device copy function for the given boot mode.

References XLOADER_ERR_INVALID_METAHEADER_DEST_ADDR, XLOADER_ERR_INVALID_METAHEADER_OFFSET, XLOADER_ERR_INVALID_METAHEADER_SRC_ADDR, XLOADER_ERR_INVALID_PDI_INPUT, XLOADER_GET_OPT_DATA_FLAG, XLOADER_PDI_SRC_DDR, and XLoader_PdiInit().

int XLoader_IntrInit ( void  )

This function initializes the loader instance and registers loader commands with PLM.

Returns
  • XST_SUCCESS on success and error code on failure.
  • Register the SBI RDY interrupt to enable the PDI loading from SBI interface.

Referenced by XLoader_Init().

int XLoader_IsAdditionalPpkValid ( const u8 *  PpkHash)

This function verifies whether the additional PPK is valid.

Parameters
PpkHashis pointer to the PPK hash.
Returns
  • XST_SUCCESS on success and error code on failure
Parameters
PpkHashis pointer to the PPK hash.
Returns
XST_FAILURE always return failue, as this api is not applicable for versal_net
Parameters
PpkHashis pointer to the PPK hash.
Returns
XST_FAILURE always return failure, as this api is not applicable for versal_net

References XLoader_IsPpkValid().

int XLoader_IsPdiAddrLookup ( u32  PdiId,
u64 *  PdiAddr 
)

This function is used to read the Address based-on PDI Id from Image Store.

Parameters
PdiIdIndex of the PDI stored
PdiAddrPointer to the PDI address
Returns
  • XST_SUCCESS on success
  • XLOADER_ERR_PDI_LIST_EMPTY if PDI list is empty
  • XLOADER_ERR_PDI_ADDR_NOT_FOUND if PDI ID not found in list

References XLOADER_ERR_PDI_ADDR_NOT_FOUND, XLOADER_ERR_PDI_LIST_EMPTY, and XLoader_GetPdiList().

int XLoader_IsPpkValid ( XLoader_PpkSel  PpkSelect,
const u8 *  PpkHash 
)

The function reads PPK invalid bits.

If the bits are valid, it compares the provided hash value with the programed hash value. Efuse stores only 256 bits of hash.

Parameters
PpkSelectPPK selection of eFUSE.
PpkHashPointer to the PPK hash to be verified.
Returns
  • XST_SUCCESS on success.
  • XLOADER_SEC_PPK_INVALID_BIT_ERR if invalid PPK bit set.
  • XLOADER_SEC_PPK_HASH_ALLZERO_INVLD if PPK hash is all zeros.
  • Check if lower 256 PPK bits hash is valid or not by reading the PPK EFUSE bits
  • Check if valid lower 256 bit PPK hash is all zeros

Referenced by XLoader_IsAdditionalPpkValid().

int XLoader_LoadImage ( XilPdi *  PdiPtr)

This function is used load a image in PDI.

PDI can have multiple images present in it. This can be used to load a single image like PL, APU, RPU. This will load all the partitions that are present in that image.

Parameters
PdiPtris Pdi instance pointer
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_SEM_STOP_SCAN if unable to stop SEM scan.
  • XLOADER_ERR_CONFIG_SUBSYSTEM if subsystem configuration fails.
  • XLOADER_ERR_SEM_INIT if unable to start the SEM scan.

References XLOADER_INVALID_IMG_ID, XLoader_MeasureNLoad(), XLOADER_PDI_SRC_JTAG, XLOADER_PDI_TYPE_FULL, and XLoader_SetJtagTapToReset().

int XLoader_LoadImageInfoTbl ( u64  DestAddr,
u32  MaxSize,
u32 *  NumEntries 
)

This function loads the ImageInfo table to the given memory address.

Parameters
DestAddris the 64 bit Destination Address
MaxSizeis the max size of Buffer present at Destination Address
NumEntriesthat are loaded from the Image Info Table
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_INVALID_DEST_IMGINFOTBL_SIZE if destination buffer size is less than the current length of the image info table.
  • XLOADER_ERR_IMAGE_INFO_TBL_FULL if image info table is full.

Validate the available length of ImageInfoTable is in the range of Maximum buffer size available

Copy the ImageInfoTable for the given length of table

References XLOADER_ERR_IMAGE_INFO_TBL_FULL, XLOADER_ERR_INVALID_DEST_IMGINFOTBL_SIZE, and XLoader_GetImageInfoTbl().

int XLoader_LoadImagePrtns ( XilPdi *  PdiPtr)

This function loads the partition.

Parameters
PdiPtris pointer to XilPdi instance
Returns
  • XST_SUCCESS on success.
  • XLOADER_SLD_DETECTED_SKIP_PRTN_PROCESS on secure lockdown.
  • XPLMI_NPI_ERR on NPI errors.
  • Validate and load the image partitions.
  • Clear NPI errors before loading each partition.
  • Validate the partition header.
  • If PLM is not partition owner then skip this partition.
  • Otherwise process the partition.
  • Skip processing rest of the partitions if secure lockdown is triggered.

References XLOADER_SUCCESS_NOT_PRTN_OWNER.

Referenced by XLoader_MeasureNLoad().

int XLoader_LoadLpdAndPsmElf ( void  )

This function will load the LPD and PSM ELF file from DDR.

Returns
  • XST_SUCCESS on success.
  • Error code on failure

Memset the PDI instance.

Initialize the PDI to load the LPD subsystem from DDR.

Check if LPD is present in InPlacePLM PDI and get the Image number and Partition number. If LPD is not found, return error.

Load the LPD image.

We need to reset NoOfHandOffCpus here because we don't call StartImage routine

References XLOADER_ERR_MEMSET_PDIPTR, XLoader_GetImageAndPrtnInfo(), XLoader_GetPdiInstance(), XLoader_LoadImage(), XLOADER_PDI_SRC_DDR, and XLoader_PdiInit().

int XLoader_LoadPdi ( XilPdi *  PdiPtr,
PdiSrc_t  PdiSrc,
u64  PdiAddr 
)

This function provides loading PDI.

Parameters
PdiPtris the instance pointer that points to PDI details
PdiSrcis source of PDI. It can be in Boot Device or DDR.
PdiAddris the address at PDI is located in the PDI source
Returns
  • XST_SUCCESS on success and error code on failure

References XLoader_PdiInit().

int XLoader_MaskGenFunc ( XSecure_Sha3 *  Sha3InstancePtr,
u8 *  Out,
u32  OutLen,
u8 *  Input 
)

Mask generation function with SHA3.

Parameters
Sha3InstancePtris pointer to the XSecure_Sha3 instance.
Outis pointer in which output of this function will be stored.
OutLenspecifies the required length.
Inputis pointer which holds the input data for which mask should be calculated which should be 48 bytes length.
Returns
  • XST_SUCCESS on success.
  • XLOADER_SEC_BUF_CLEAR_ERR if failed to clear buffer.
Parameters
Sha3InstancePtris pointer to the XSecure_Sha3 instance.
Outis pointer in which output of this function will be stored.
OutLenspecifies the required length.
Inputis pointer which holds the input data for which mask should be calculated which should be 48 bytes length.
Returns
  • XST_SUCCESS on success.
  • Errorcode on failure.

References XLOADER_SHA3_LEN.

int XLoader_MaskGenFunc ( XSecure_Sha *  ShaInstancePtr,
u8 *  Out,
u32  OutLen,
u8 *  Input 
)

Mask generation function with SHA3.

Parameters
ShaInstancePtris pointer to the XSecure_Sha3 instance.
Outis pointer in which output of this function will be stored.
OutLenspecifies the required length.
Inputis pointer which holds the input data for which mask should be calculated which should be 48 bytes length.
Returns
  • XST_SUCCESS on success.
  • Errorcode on failure.

References XLOADER_SHA3_LEN.

int XLoader_MeasureNLoad ( XilPdi *  PdiPtr)

This function measures the partion hashes.

This function measures the partion hashes from the hash block.

Parameters
PdiPtris pointer to XilPdi instance
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_DATA_MEASUREMENT if error in data measurement.

References XLoader_DataMeasurement(), XLoader_LoadImagePrtns(), XLOADER_MEASURE_FINISH, XLOADER_MEASURE_START, XLOADER_MEASURE_UPDATE, XLOADER_PCR_MEASUREMENT_INDEX_MASK, XLOADER_PDI_TYPE_PARTIAL, and XLOADER_SHA3_LEN.

Referenced by XLoader_LoadImage().

int XLoader_PdiInit ( XilPdi *  PdiPtr,
PdiSrc_t  PdiSource,
u64  PdiAddr 
)

This function initializes the PDI instance with required details and read the meta header.

Parameters
PdiPtris instance pointer pointing to PDI details
PdiSourceis source of PDI. It can be any boot Device or DDR
PdiAddris the address at which PDI is located in the PDI source
Returns
  • XST_SUCCESS on success.
  • XLOADER_UNSUPPORTED_BOOT_MODE on unsupported boot mode.

Clear the Metaheader instance area

Clear the DDR Calib Check RTCA Register.

  • Mark PDI loading is started.
  • Store address of the structure in PMC_GLOBAL.GLOBAL_GEN_STORAGE4.
  • Read the PDI source.
  • Get the PDI source type.
  • Print the PDI source type.
  • Get the device copy function for the given boot mode.
  • Read and validate all the headers in the PDI.

References PdiSrc_t, XLOADER_GET_PDISRC_INFO, XLoader_GetATFHandoffParamsAddr(), XLoader_GetPdiInstance(), XLOADER_PDI_SRC_USB, XLOADER_PDI_TYPE_FULL, XLOADER_PDI_TYPE_PARTIAL, XLOADER_PDISRC_FLAGS_MASK, XLOADER_SD_RAWBOOT_MASK, and XLOADER_SSIT_MONOLITIC.

Referenced by XLoader_InitPdiInstanceForExtractMHAndOptData(), XLoader_LoadLpdAndPsmElf(), XLoader_LoadPdi(), and XLoader_RestartImage().

void XLoader_PerformInternalPOR ( void  )

This function check conditions and perform internal POR for VP1802 and VP1502 device if required.

  • If the device is not an VP1802 Or VP1502, then return without performing IPOR.
  • If the device is not an master SLR, then return without performing IPOR.
  • If the bootmode is JTAG or SMAP, then return without performing IPOR.
  • Efuse DNA_57 bit should be non-zero for IPOR.
  • Perform IPOR, if all the pre-conditions are met for VP1502/VP1802 device.

References PdiSrc_t, PLM_VP1802_POR_SETTLE_TIME, XLOADER_PDI_SRC_JTAG, and XLOADER_PDI_SRC_SMAP.

int XLoader_PlatInit ( void  )

This function initializes the loader with platform specific initializations.

Returns
XST_SUCCESS on success and error code on failure

Referenced by XLoader_Init().

int XLoader_ProcessAuthEncPrtn ( XLoader_SecureParams *  SecurePtr,
u64  DestAddr,
u32  BlockSize,
u8  Last 
)

This function performs authentication and decryption of the partition.

Parameters
SecurePtris pointer to the XLoader_SecureParams instance
DestAddris the address to which data is copied
BlockSizeis size of the data block to be processed which doesn't include padding lengths and hash
Lastnotifies if the block to be processed is last or not
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_DMA_TRANSFER if DMA transfer fails while copying.
  • XLOADER_ERR_PRTN_DECRYPT_FAIL if partition decryption fails.
  • XLOADER_SEC_BUF_CLEAR_SUCCESS if successfully cleared buffer.
  • XLOADER_SEC_BUF_CLEAR_ERR if failed to clear buffer.
  • Process the 1st block
  • Verify encrypted partition is revoked or not
  • Verify hash
  • If encryption is enabled, decrypt the data.

References XLoader_GetTempParams(), XLOADER_PDI_TYPE_PARTIAL, XLOADER_SECURE_HDR_TOTAL_SIZE, XLoader_SecureChunkCopy(), XLoader_SecureConfigMeasurement(), XLOADER_SHA3_LEN, and XLoader_VerifyHashNUpdateNext().

Referenced by XLoader_SecureAuthInit(), and XLoader_SecureEncInit().

int XLoader_ProcessDeferredError ( void  )

This function checks if MJTAG workaround is required.

Returns
  • XLOADER_ERR_DEFERRED_CDO_PROCESS on error while processing CDO but error is deferred till whole CDO processing is completed.

References XLoader_DumpDdrmcRegisters().

int XLoader_ProcessElf ( XilPdi *  PdiPtr,
const XilPdi_PrtnHdr *  PrtnHdr,
XLoader_PrtnParams *  PrtnParams,
XLoader_SecureParams *  SecureParams 
)

This function copies the elf partitions to specified destinations.

Parameters
PdiPtris pointer to XilPdi instance
PrtnHdris pointer to the partition header
PrtnParamsis pointer to the structure variable that contains parameters required to process the partition
SecureParamsis pointer to the instance containing security related params
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_INVALID_ELF_LOAD_ADDR if the load address of the elf is invalid.
  • XLOADER_ERR_PM_DEV_PSM_PROC if device requet for PSM is failed.
  • XLOADER_ERR_PM_DEV_IOCTL_RPU0_SPLIT if IOCTL call to set RPU0 in split mode fails.
  • XLOADER_ERR_PM_DEV_IOCTL_RPU1_SPLIT if IOCTL call to set RPU1 in split mode fails.
  • XLOADER_ERR_PM_DEV_IOCTL_RPU0_LOCKSTEP if IOCTL call to set RPU0 in lockstep mode fails.
  • XLOADER_ERR_PM_DEV_IOCTL_RPU1_LOCKSTEP if IOCTL call to set RPU1 in lockstep mode fails.
  • XLOADER_ERR_INVALID_TCM_ADDR on Invalid TCM address for A72 elfs.
Parameters
PdiPtris pointer to XilPdi instance
PrtnHdris pointer to the partition header
PrtnParamsis pointer to the structure variable that contains parameters required to process the partition
SecureParamsis pointer to the instance containing security related params
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_INVALID_ELF_LOAD_ADDR if load address of the elf is invalid.
  • XLOADER_ERR_INVALID_R52_CLUSTER if invalid R52 cluster is selected.
Parameters
PdiPtris pointer to XilPdi instance
PrtnHdris pointer to the partition header
PrtnParamsis pointer to the structure variable that contains parameters required to process the partition
SecureParamsis pointer to the instance containing security related params
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_INVALID_ELF_LOAD_ADDR if load address of the elf is invalid.
  • XLOADER_ERR_PM_DEV_PSM_PROC if device request for PSM is failed.
  • XLOADER_ERR_INVALID_R52_CLUSTER if invalid R52 cluster is selected.
  • Verify the load address.
  • For PSM, PSM should be taken out of reset before loading. PSM RAM should be ECC initialized
  • For OCM, RAM should be ECC initialized
  • R5 should be taken out of reset before loading. R5 TCM should be ECC initialized
  • Copy the partition to the load address.
  • Populate handoff parameters to ATF. These correspond to the partitions of application which ATF will be loading.

Check if TCM Boot Bit is set

  • Verify the load address.
  • For OCM, RAM should be ECC initialized
  • R5 should be taken out of reset before loading. R5 TCM should be ECC initialized
  • Copy the partition to the load address.
  • Populate handoff parameters to ATF. These correspond to the partitions of application which ATF will be loading.

Check if TCM Boot Bit is set

  • Verify the load address.
  • For PSM, PSM should be taken out of reset before loading. PSM RAM should be ECC initialized
  • For OCM, RAM should be ECC initialized
  • R5 should be taken out of reset before loading. R5 TCM should be ECC initialized
  • Copy the partition to the load address.
  • Populate handoff parameters to ATF. These correspond to the partitions of application which ATF will be loading.

References XLoader_ClearATFHandoffParams(), XLoader_PrtnCopy(), XLOADER_RPU_GLBL_CNTL, XLoader_SetATFHandoffParameters(), XLOADER_TCM_0, XLOADER_TCM_1, XLOADER_TCMCOMB_MASK, XLOADER_TCMCOMB_SHIFT, and XLoader_UpdateHandoffParam().

int XLoader_PrtnCopy ( const XilPdi *  PdiPtr,
const XLoader_DeviceCopy *  DeviceCopy,
void *  SecureParamsPtr 
)

This function copies partition data to respective target memories.

Parameters
PdiPtris pointer to XilPdi instance
DeviceCopyis pointer to the structure variable with parameters required for copying
SecureParamsPtris pointer to the instance containing security related params
Returns
  • XST_SUCCESS on success and error code on failure

Verify the destination address range before writing

  • Check if security is enabled and start the partition copy securely. Otherwise copy the partition in non-secure mode.

References XLoader_DataMeasurement(), XLoader_GetTempParams(), XLOADER_MEASURE_UPDATE, and XLoader_SecureCopy().

Referenced by XLoader_ProcessElf().

int XLoader_ReadAndVerifySecureHdrs ( XLoader_SecureParams *  SecurePtr,
XilPdi_MetaHdr *  MetaHdr 
)

This function authenticates and/or decrypts the image headers and partition headers and copies the contents to the corresponding structures.

Parameters
SecurePtrPointer to the XLoader_SecureParams instance.
MetaHdrPointer to the Meta header table.
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_HDR_GET_DMA if acquiring DMA fails.
  • XLOADER_ERR_HDR_AES_OP_FAIL if AES initialization fails.
  • XLOADER_ERR_METAHDR_LEN_OVERFLOW on meta header length overflow.
  • XLOADER_ERR_HDR_COPY_FAIL on IH/PH header copy fail.
  • XLOADER_ERR_SEC_IH_READ_FAIL on image header read fail.
  • XLOADER_ERR_SEC_IH_VERIFY_FAIL on image header verify fail.
  • XLOADER_ERR_HDR_NOT_SECURE if neither authentication nor encryption is enabled for IH/PH.
  • XLOADER_ERR_SEC_PH_READ_FAIL if partition header read fails.
  • XLOADER_ERR_SEC_PH_VERIFY_FAIL if partition header verification fails.
  • Validate Meta header length
  • Read headers to a buffer
  • Read IHT and PHT to buffers along with encryption overhead
  • Authenticate headers and decrypt the headers
  • Decrypt the headers
  • Read IHT and PHT to structures and verify checksum
  • Verify Meta header is revoked or not
  • Update buffer address to point to PHs
  • Authenticate Image headers and partition headers

References XLOADER_AUTH_CERT_MIN_SIZE, XLOADER_CHUNK_SIZE, XLoader_GetTempParams(), and XLOADER_SECURE_CHUNK_SIZE.

int XLoader_ReadDdrCryptoPerfCounters ( XPlmi_Cmd *  Cmd)

This function reads DDR crypto performance counters of given DDR device id.

Parameters
Cmdis pointer to the command structure
Returns
  • XST_SUCCESS on success.
  • ErrorCode on Failure.

Get DDRMC UB Base address

Read PCSR control status

Read DDR crypto counters

Get DDRMC UB Base address

Read PCSR control status

Read DDR crypto counters

References XLOADER_CMD_GET_DDR_DEVICE_ID, XLOADER_DDR_CRYPTO_MAIN_OFFSET, XLOADER_DDR_PERF_MON_CNT0_OFFSET, XLOADER_DDR_PERF_MON_CNT1_OFFSET, XLOADER_DDR_PERF_MON_CNT2_OFFSET, XLOADER_DDR_PERF_MON_CNT3_OFFSET, XLOADER_ERR_DDR_DEVICE_ID, and XLOADER_ERR_PCOMPLETE_NOT_DONE.

int XLoader_ReadImageStoreCfg ( void  )

This function is used to read the Image Store DDR Memory Addr.

Returns
  • XST_SUCCESS on success and error code on failure
  • Read & Populate Image Store base address,size from RTCA area.
  • Validate if address is unaligned.

Verify the image store address range

  • Update the PDI image store address in the image list.

References XLOADER_ERR_INVALID_IMAGE_STORE_ADDRESS, XLoader_GetPdiList(), XLOADER_IMG_STORE_INVALID_ADDR, and XLOADER_IMG_STORE_INVALID_SIZE.

int XLoader_RestartImage ( u32  ImageId,
u32 *  FuncID 
)

This function is used to restart the image in PDI.

This function will take ImageId as an input and based on the subsystem info available, it will read the image partitions, loads them and hand-off to the required CPUs as part of the image load.

Parameters
ImageIdId of the image present in PDI
FuncIDis verified with the FuncID present in PDI
Returns
  • XST_SUCCESS on success and error code on failure
  • Scan through PdiList for the given ImageId and restart image from that respective PDI if ImageId is found
  • Load image from BootPdi if the image is not found or loading is unsuccessful from the PdiList

References XLoader_GetBootPdiInfo(), XLoader_GetPdiInstance(), XLoader_GetPdiList(), XLOADER_PDI_LOAD_COMPLETE, XLOADER_PDI_SRC_DDR, XLOADER_PDI_SRC_JTAG, XLOADER_PDI_SRC_SMAP, XLOADER_PDI_TYPE_FULL, XLOADER_PDI_TYPE_PARTIAL, XLoader_PdiInit(), and XLoader_StartImage().

int XLoader_RsaKat ( void  )

This function runs the KAT for RSA.

Returns
  • XST_SUCCESS on success and error code on failure
Parameters
PmcDmaPtr- Pointer to DMA instance
Returns
XST_SUCCESS on success and error code on failure
XST_SUCCESS on success and error code on failure
int XLoader_RsaPssSignVerify ( u8 *  MsgHash,
XSecure_Rsa *  RsaInstPtr,
u8 *  Signature,
u32  KeySize 
)

This function encrypts the RSA signature provided and performs required PSS operations to extract salt and calculates M prime hash and compares with hash obtained from EM.

Parameters
PmcDmaInstPtrPointer to DMA instance
MsgHashof the data to be authenticated.
RsaInstPtris pointer to the XSecure_Rsa instance.
Signatureis pointer to RSA signature for data to be authenticated.
KeySizeis size of RSA key in bytes.
Returns
  • XST_SUCCESS on success.
  • XLOADER_SEC_MEMSET_ERROR and XLOADER_SEC_RSA_MEMSET_SHA3_ARRAY_FAIL if failed to create memory for RSA SHA3.
  • XLOADER_SEC_MEMSET_ERROR and XLOADER_SEC_RSA_MEMSET_VARSCOM_FAIL if failed to create memory for RSA varscom.
  • XLOADER_SEC_RSA_PSS_ENC_BC_VALUE_NOT_MATCHED if failed to match with RSA ENC 0xbc value.
  • XLOADER_SEC_MASKED_DB_MSB_ERROR if error in RSA EM MSB.
  • XLOADER_SEC_RSA_PSS_SIGN_VERIFY_FAIL if failed to verify RSA PSS signature.
  • XLOADER_SEC_EFUSE_DB_PATTERN_MISMATCH_ERROR if failed to verify database in efuse.
  • XLOADER_SEC_RSA_PSS_HASH_COMPARE_FAILURE if RSA PSS hash is not matched.
  • XLOADER_SEC_BUF_CLEAR_ERR if failed to clear buffer.
  • Initialise Buffer variable to store HashMgf and DB.
  • RSA signature encryption with public key components.
  • Check for signature encrypted message.
  • Extract Salt and Generate DB from masked DB and Hash.
  • XOR MGF output with masked DB from EM to get DB.
  • Check DB = PS <414 zeros> || 0x01.
  • Hash on M prime
  • Compare MPrime Hash with Hash from EM
void Xloader_SaveBootPdiInfo ( XilPdi *  BootPdiPtr)

This function is used to save the BootPDI info.

Parameters
BootPdiPtrPointer to the PDI instance

References XLoader_GetBootPdiInfo().

int XLoader_SecureAuthInit ( XLoader_SecureParams *  SecurePtr,
const XilPdi_PrtnHdr *  PrtnHdr 
)

This function initializes authentication parameters of XLoader_SecureParams's instance.

Parameters
SecurePtris pointer to the XLoader_SecureParams instance.
PrtnHdris pointer to XilPdi_PrtnHdr instance that has to be processed.
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_INIT_AC_COPY_FAIL if failed to copy authentication certificate from flash device.
  • Check if authentication is enabled and copy authentication certificate from PDI source to memory location provided in image header. Also initialize the required SecurePtr members.

References XLOADER_AUTH_CERT_MIN_SIZE, XLoader_GetTempParams(), and XLoader_ProcessAuthEncPrtn().

Referenced by XLoader_SecureInit().

int XLoader_SecureChunkCopy ( XLoader_SecureParams *  SecurePtr,
u64  SrcAddr,
u8  Last,
u32  BlockSize,
u32  TotalSize 
)

This function copies the data from SrcAddr to chunk memory during processing of secure partitions.

Parameters
SecurePtris pointer to the XLoader_SecureParams instance
SrcAddris the source address from which the data is to be processed or copied
Lastnotifies if the block to be processed is last or not
BlockSizeis size of the data block to be processed which doesn't include padding lengths and hash.
TotalSizeis pointer to TotalSize which has to be processed
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_DATA_COPY_FAIL if failed to copy data to PMC RAM.
  • Copy the next chunk securely, and then wait for the process to be completed.
  • The following initialization is crucial as the authentication certificate and PUF data are now stored in the PMC RAM instead of the PPU1 RAM. During the processing of the first chunk of any partition, the second 32K chunk of the PMC RAM, starting from 0xf2008120, contains the authentication certificate and PUF data as applicable. As a result, the second chunk of the partition must be loaded at 0xf2000020, not at 0xf2008120. Therefore, double buffering is disabled when processing the first chunk, and only enabled from the second chunk onwards. The third chunk is loaded at 0xf2008120, and from then on, the chunks are loaded alternatively to the two 32KB chunks of the PMC RAM.

Referenced by XLoader_ProcessAuthEncPrtn().

int XLoader_SecureClear ( void  )

This function is called to clear secure critical data in case of exceptions.

The function also places AES, ECDSA_RSA and SHA3 in reset.

Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_SECURE_CLEAR_FAIL if failed to clear AES, RSA, SHA3 engines.

Place SHA3 in reset

References XLoader_AuthEncClear(), XLOADER_SHA3_RESET_REG, and XLOADER_SHA3_RESET_VAL.

int XLoader_SecureConfigMeasurement ( XLoader_SecureParams *  SecurePtr,
u32  PcrInfo,
u32 *  DigestIndex,
u32  OverWrite 
)

This function measures the Secure Configuration that is SPK, SPK ID and Encryption Revoke ID and extends to the specified PCR.

Parameters
SecurePtris pointer to the XLoader_SecureParams instance.
PcrInfoprovides the PCR number and Measurement Index to be extended.
DigestIndexis pointer to the DigestIndex across the PCR
OverWriteTRUE or FALSE to overwrite the extended digest or not
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_SECURE_CONFIG_MEASUREMENT if error in Secure config measurement.

Referenced by XLoader_ProcessAuthEncPrtn().

int XLoader_SecureCopy ( XLoader_SecureParams *  SecurePtr,
u64  DestAddr,
u32  Size 
)

This function loads secure non-cdo partitions.

Parameters
SecurePtris pointer to the XLoader_SecureParams instance.
DestAddris load address of the partition.
Sizeis unencrypted size of the partition in bytes.
Returns
  • XST_SUCCESS on success and error code on failure
  • Update the length for last chunk
  • Process the partition.
  • Update variables for next chunk
  • On failure clear data at destination address

References XLOADER_SECURE_CHUNK_SIZE.

Referenced by XLoader_PrtnCopy().

int XLoader_SecureEncInit ( XLoader_SecureParams *  SecurePtr,
const XilPdi_PrtnHdr *  PrtnHdr 
)

This function initializes encryption parameters of XLoader_SecureParams's instance.

Parameters
SecurePtris pointer to the XLoader_SecureParams instance.
PrtnHdris pointer to XilPdi_PrtnHdr instance that has to be processed.
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_INIT_CHECKSUM_INVLD_WITH_AUTHDEC if both checksum and authentication or encryption are enabled.
  • XLOADER_ERR_PRTN_DECRYPT_NOT_ALLOWED if Partition is not allowed to be encrypted if State of boot is non secure.
  • XLOADER_ERR_GLITCH_DETECTED if glitch is detected.
  • XLOADER_ERR_PRTN_ENC_ONLY_KEYSRC on invalid key source when only encryption is enabled.
  • Check if encryption is enabled
  • Error out if checksum is enabled along with authentication or encryption.
  • Run AES Kat test if the image is encrypted and metaheader is not encrypted
  • Check secure state of boot as partition is allowed to be encrypted only if Secure state of boot is S-HWRoT, Emul S-HWRoT, A-HWRoT or Emul A-HWRoT.
  • Check Secure State of the device. If S-HWRoT is enabled, then validate keysrc

References XLOADER_BBRAM_KEY, XLoader_CheckSecureState(), XLOADER_EFUSE_KEY, XLoader_GetAHWRoT(), XLoader_GetSHWRoT(), XLoader_GetTempParams(), XLOADER_PDI_TYPE_PARTIAL, XLoader_ProcessAuthEncPrtn(), and XLOADER_SHA3_LEN.

Referenced by XLoader_SecureInit().

int XLoader_SecureInit ( XLoader_SecureParams *  SecurePtr,
XilPdi *  PdiPtr,
u32  PrtnNum 
)

This function initializes XLoader_SecureParams's instance.

Parameters
SecurePtris pointer to the XLoader_SecureParams instance.
PdiPtris pointer to the XilPdi instance
PrtnNumis the partition number to be processed
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_MEMSET_SECURE_PTR if failed to set memory for secure pointer.
  • XLOADER_ERR_INIT_GET_DMA if failed to get DMA instance during initialization.
  • Initialize XLoader_SecureParms instance with zeros.
  • Initialize XLoader_SecureTempParams instance with zeros.
  • Read partition header from meta header.
  • The following initialization is crucial as the authentication certificate and PUF data are now stored in the PMC RAM instead of the PPU1 RAM. During the processing of the first chunk of any partition, the second 32K chunk of the PMC RAM, starting from 0xf2008120, contains the authentication certificate and PUF data as applicable. As a result, the second chunk of the partition must be loaded at 0xf2000020, not at 0xf2008120. Therefore, double buffering is disabled when processing the first chunk, and only enabled from the second chunk onwards. The third chunk is loaded at 0xf2008120, and from then on, the chunks are loaded alternatively to the two 32KB chunks of the PMC RAM.
  • Get DMA instance
  • Initialize the checksum.
  • Initialize the authentication.
  • Initialize the encryption.

References XLoader_GetTempParams(), XLoader_SecureAuthInit(), and XLoader_SecureEncInit().

int XLoader_SecureValidations ( const XLoader_SecureParams *  SecurePtr)

This function checks if authentication/encryption is compulsory.

Parameters
SecurePtris pointer to the XLoader_SecureParams instance.
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_GLITCH_DETECTED if glitch is detected.
  • XLOADER_ERR_AUTH_EN_PPK_HASH_ZERO if PPK not programmed and authentication is enabled
  • XLOADER_ERR_HWROT_EFUSE_AUTH_COMPULSORY if PPK Programmed but eFuse authentication is disabled.
  • XLOADER_ERR_ENCONLY_ENC_COMPULSORY if encryption is disabled.
  • XLOADER_ERR_METAHDR_KEYSRC_MISMATCH if metaheader Key Source does not match PLM Key Source.
  • Check Secure State of device if A-HWROT is enabled then authentication is mandatory for metaheader and BHDR authentication must be disabled.
  • Check Secure State of the device. If S-HWRoT is enabled, then metaheader must be encrypted.
  • Verify if Metaheader encryption key source for FPDI/PPDI is same as PLM Key source in Bootheader.
void XLoader_SetATFHandoffParameters ( const XilPdi_PrtnHdr *  PrtnHdr)

This function sets the handoff parameters to the ARM Trusted Firmware(ATF).

Some of the inputs for this are taken from image partition header. A pointer to the structure containing these parameters is stored in the PMC_GLOBAL.GLOBAL_GEN_STORAGE4 register, which ATF reads.

Parameters
PrtnHdris pointer to Partition header details
  • Read partition header and deduce entry point and partition flags.
  • Update CPU number based on destination CPU
  • Read partition header and deduce entry point and partition flags.
  • Update cluster number based on destination cluster number.
  • Update CPU number based on destination CPU
  • Read partition header and deduce entry point and partition flags.
  • Update cluster number based on destination cluster number.
  • Update CPU number based on destination CPU

References XLoader_GetATFHandoffParamsAddr().

Referenced by XLoader_ProcessElf().

void XLoader_SetJtagTapToReset ( void  )

This function is used to run MJTAG solution workaround in which JTAG Tap state will be set to reset.

  • Based on Vivado property, check whether to apply MJTAG workaround or not. By default vivado property disables MJTAG workaround.
  • Skip applying MJTAG workaround if already applied
  • Check if End of PL Startup is asserted or not
  • Enable MJTAG
  • Toggle MJTAG ISO to generate clock pulses, default 10 clock pulses
  • Disable MJTAG

Referenced by XLoader_LoadImage().

int XLoader_SetSecureState ( void  )

This function reads the value of PPK efuse bits, DEC only efuse bits and fields in bootheader and accordingly sets the Secure State of boot.

Returns
  • XST_SUCCESS on SUCCESS and error code in case of failure.
Note
The Secure State of the device will be stored in two 32-bit registers in RTC area of PMCRAM and two global variables -one for authenticated boot and other for encrypted boot, for redundancy.
  • Check secure state for authentication
  • Set the secure state for authentication in register and global variable.
  • Check secure state for encryption.
  • Read DEC_ONLY efuse bits.
  • If more than one DEC_ONLY efuse bits are programmed, then set the SHWRoT register.
  • If none of the DEC_ONLY efuse bits are programmed and PLM is encrypted, then set the SHWRoT register.
  • If none of the DEC_ONLY efuse bits are programmed and PLM is not encrypted, then set the SHWRoT register.

References XLoader_CheckSecureStateAuth(), XLOADER_EFUSE_SEC_DEC_MASK, XLOADER_EFUSE_SEC_MISC0_OFFSET, XLoader_GetAHWRoT(), and XLoader_GetSHWRoT().

Referenced by XLoader_Init().

u8 XLoader_SkipMJtagWorkAround ( XilPdi *  PdiPtr)

This function checks if MJTAG workaround partition needs to be skipped.

Parameters
PdiPtris pointer to PDI instance
Returns
TRUE if MTAG workaround partition needs to be skipped, else FALSE

Skip MJTAG WA2 partitions if boot mode is JTAG and Reset Reason is not external POR

References XLOADER_PDI_SRC_JTAG.

int Xloader_SsitEoPdiSync ( XilPdi *  PdiPtr)

This function will sync the PDI load status with master if End of PDI SYNC bit is enabled in IHT.

Parameters
PdiPtris pointer to PDI instance
Returns
-XST_SUCCESS if no issue in EoPDI sync -XPLMI_ERR_SSIT_EOPDI_SYNC if error in EoPDI Sync
  • Validate if End of PDI SYNC enabled in Slave PDI. Otherwise return XST_SUCCESS.
  • Validate if end of PDI Sync bit set in IHT Attribute. Otherwise return XST_SUCCESS.
  • Sync with master to update slave status.

References XLOADER_SSIT_MONOLITIC.

int XLoader_StartImage ( XilPdi *  PdiPtr)

This function is used to start the subsystems in the PDI.

Parameters
PdiPtrPdi instance pointer
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_WAKEUP_A72_0 if waking up the A72-0 failed during handoff.
  • XLOADER_ERR_WAKEUP_A72_1 if waking up the A72-1 failed during handoff.
  • XLOADER_ERR_WAKEUP_R5_0 if waking up the R5-0 failed during handoff.
  • XLOADER_ERR_WAKEUP_R5_1 if waking up the R5-1 failed during handoff.
  • XLOADER_ERR_WAKEUP_R5_L if waking up the R5-L failed during handoff.
  • XLOADER_ERR_WAKEUP_PSM if waking up the PSM failed during handoff.
Parameters
PdiPtrPdi instance pointer
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_WAKEUP_R52_0 if waking up the R52_0 failed during handoff.
  • XLOADER_ERR_WAKEUP_R52_1 if waking up the R52_1 failed during handoff.
  • XLOADER_ERR_WAKEUP_A78_0 if waking up the A78_0 failed during handoff.
  • XLOADER_ERR_WAKEUP_A78_1 if waking up the A78_1 failed during handoff.
  • XLOADER_ERR_WAKEUP_A78_2 if waking up the A78_2 failed during handoff.
  • XLOADER_ERR_WAKEUP_A78_3 if waking up the A78_3 failed during handoff.
  • XLOADER_ERR_WAKEUP_ASU if waking up the ASU failed during handoff.
Parameters
PdiPtrPdi instance pointer
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_WAKEUP_R52_0 if waking up the R52_0 failed during handoff.
  • XLOADER_ERR_WAKEUP_R52_0 if waking up the R52_1 failed during handoff.
  • XLOADER_ERR_WAKEUP_A78_0 if waking up the A78_0 failed during handoff.
  • XLOADER_ERR_WAKEUP_A78_1 if waking up the A78_1 failed during handoff.
  • XLOADER_ERR_WAKEUP_A78_2 if waking up the A78_2 failed during handoff.
  • XLOADER_ERR_WAKEUP_A78_3 if waking up the A78_3 failed during handoff.
  • XLOADER_ERR_WAKEUP_PSM if waking up the PSM failed during handoff.
  • Start Handoff to the cpus
  • Wake up each processor
  • Start Handoff to the cpus
  • Wake up each processor
  • Make Number of handoff CPUs to zero.
  • Start Handoff to the cpus
  • Wake up each processor
  • Make Number of handoff CPUs to zero.

References XLoader_Printf.

Referenced by XLoader_RestartImage().

int XLoader_UpdateCfgLimitCount ( u32  UpdateFlag)

This function updates the configuration limiter count if Configuration limiter feature is enabled in case of secure boot.

    In case of eny error, secure lockdown is triggered.
Parameters
UpdateFlag- Indicates id the counter should be incremented or decremeted
Returns
XST_SUCCESS on success. Error code in case of failure

References XLOADER_BBRAM_8_ADDRESS, XLOADER_BBRAM_8_MEM_ADDRESS, XLOADER_BBRAM_CL_COUNTER_MASK, XLOADER_BBRAM_CL_DECREMENT_COUNT, XLOADER_BBRAM_CL_FEATURE_EN_MASK, XLOADER_BBRAM_CL_FEATURE_ENABLE, XLOADER_BBRAM_CL_INCREMENT_COUNT, XLoader_CheckSecureState(), XLOADER_CL_FEATURE_EN_SHIFT, XLoader_GetAHWRoT(), and XLoader_GetSHWRoT().

Referenced by XLoader_Init().

int XLoader_UpdateHandler ( XPlmi_ModuleOp  Op)

This function provides update handler for xilloader.

Parameters
Opis the module operation variable
Returns
XST_SUCCESS on success and error code on failure
  • Remove Scheduler tasks if they already exist.
  • Disable SBI Interrupt
  • Add Scheduler tasks if they are removed during shutdown init

Enable SBI Interrupt

  • Remove Scheduler tasks if they already exist.
  • Disable SBI Interrupt
  • Add Scheduler tasks if they are removed during shutdown init

Enable SBI Interrupt

References XLOADER_AUTH_JTAG_INT_STATUS_POLL_INTERVAL, XLoader_CheckAuthJtagIntStatus(), XLoader_CheckDeviceStateChange(), and XLOADER_DEVICE_STATE_POLL_INTERVAL.

int XLoader_UpdateHandoffParam ( XilPdi *  PdiPtr)

This function is used to update the handoff parameters.

Parameters
PdiPtris pointer to XilPdi instance
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_NUM_HANDOFF_CPUS when number of CPUs exceed max count.
Parameters
PdiPtris pointer to XilPdi instance
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_NUM_HANDOFF_CPUS if number of CPUs exceeds max count.
  • Get the destination CPU from the partition header.
  • Validate the destination CPU.
  • Update the CPU settings.
  • Assign the partition header to local variable
  • Update the CPU settings
  • Assign the partition header to local variable
  • Update the CPU settings

References XLOADER_MAX_HANDOFF_CPUS.

Referenced by XLoader_ProcessElf().

int XLoader_VerifyHashNUpdateNext ( XLoader_SecureParams *  SecurePtr,
u64  DataAddr,
u32  Size,
u8  Last 
)

This function calculates hash and compares with expected hash.

                    For every block, hash of next block is updated into expected hash.
Parameters
SecurePtris pointer to the XLoader_SecureParams instance.
DataAddris the address of the data present in the block
Sizeis size of the data block to be processed
Lastnotifies if the block to be processed is last or not.
Returns
  • XST_SUCCESS on success.
  • XLOADER_ERR_PRTN_HASH_CALC_FAIL if failed to calculate hash for partition authentication.
  • XLOADER_ERR_PRTN_HASH_COMPARE_FAIL on partition comparison fail.

Set the data context of previous SHA operation

Update the next expected hash and data location

References XLOADER_SHA3_LEN.

Referenced by XLoader_ProcessAuthEncPrtn().

Variable Documentation

volatile u8 XLoader_AuthJtagStatus::AuthFailCounter

Counter for failed attempts to authenticate JTAG.

volatile u8 XLoader_AuthJtagStatus::AuthFailCounterTmp

For temporal redundancy.

u32 XLoader_AuthJtagStatus::JtagTimeOut

Timeout value set by user.

u8 XLoader_AuthJtagStatus::JtagTimerEnabled

Enable JTAG timer.