lib/sw_services/xilloader/src/xloader_cfi.c
void XLoader_CframeErrorHandler(u32 ImageId)
{
	u32 Err1Status = XPlmi_In32(PMC_GLOBAL_PMC_ERR1_STATUS);
	u32 Err2Status = XPlmi_In32(PMC_GLOBAL_PMC_ERR2_STATUS);
	u32 CfuIsrStatus = XPlmi_In32(CFU_APB_CFU_ISR);
	u32 CfuStatus = XPlmi_In32(CFU_APB_CFU_STATUS);
#ifndef PLM_DEBUG_MODE
	XCfupmc XLoader_CfuIns; /** CFU Driver Instance */
	u8 CfiErrStatus;
	u32 CountVal = XPlmi_In32(CFU_APB_CFU_QWORD_CNT);
	u8 PlHouseClean = (u8)((CountVal != 0U) && (ImageId == PM_DEV_PLD_0));
#else
	(void)ImageId;
#endif

	XPlmi_Printf(DEBUG_GENERAL, "Error loading PL data: \n\r"
		"CFU_ISR: 0x%08x, CFU_STATUS: 0x%08x \n\r"
		"PMC ERR1: 0x%08x, PMC ERR2: 0x%08x\n\r",
		CfuIsrStatus, CfuStatus, Err1Status, Err2Status);

#ifndef PLM_DEBUG_MODE
	CfiErrStatus = (u8)(Err1Status & PMC_GLOBAL_PMC_ERR1_STATUS_CFRAME_MASK);
	if (CfiErrStatus == 0U) {
		CfiErrStatus = (u8)((Err2Status & PMC_GLOBAL_PMC_ERR2_STATUS_CFI_MASK)
			>> PMC_GLOBAL_PMC_ERR2_STATUS_CFI_SHIFT);
	}

	if ((CfiErrStatus != 0U) || (PlHouseClean == (u8)TRUE)) {
		XLoader_CfiErrHandler(&XLoader_CfuIns);
	}

	XLoader_CfuErrHandler(&XLoader_CfuIns);

	if (PlHouseClean == (u8)TRUE) {
		(void)XPmPlDomain_RetriggerPlHouseClean();
	}
#endif
}
/*****************************************************************************/
/**
 * @brief 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.
 *
 * @param       ImageId is Id of the image present in PDI
 *
 * @return      void
 *
 *****************************************************************************/
@brief 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.

@param       ImageId is Id of the image present in PDI

@return      void
@brief 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 . @param ImageId is Id of the image present in PDI @return void
void XLoader_CframeErrorHandler(u32 ImageId)
{
	u32 Err1Status = XPlmi_In32(PMC_GLOBAL_PMC_ERR1_STATUS);
	u32 Err2Status = XPlmi_In32(PMC_GLOBAL_PMC_ERR2_STATUS);
	u32 CfuIsrStatus = XPlmi_In32(CFU_APB_CFU_ISR);
	u32 CfuStatus = XPlmi_In32(CFU_APB_CFU_STATUS);
#ifndef PLM_DEBUG_MODE
	XCfupmc XLoader_CfuIns; 
	u8 CfiErrStatus;
	u32 CountVal = XPlmi_In32(CFU_APB_CFU_QWORD_CNT);
	u8 PlHouseClean = (u8)((CountVal != 0U) && (ImageId == PM_DEV_PLD_0));
#else
	(void)ImageId;
#endif
	XPlmi_Printf(DEBUG_GENERAL, "Error loading PL data: \n\r"
		"CFU_ISR: 0x%08x, CFU_STATUS: 0x%08x \n\r"
		"PMC ERR1: 0x%08x, PMC ERR2: 0x%08x\n\r",
		CfuIsrStatus, CfuStatus, Err1Status, Err2Status);
#ifndef PLM_DEBUG_MODE
	CfiErrStatus = (u8)(Err1Status & PMC_GLOBAL_PMC_ERR1_STATUS_CFRAME_MASK);
	if (CfiErrStatus == 0U) {
		CfiErrStatus = (u8)((Err2Status & PMC_GLOBAL_PMC_ERR2_STATUS_CFI_MASK)
			>> PMC_GLOBAL_PMC_ERR2_STATUS_CFI_SHIFT);
	}
	if ((CfiErrStatus != 0U) || (PlHouseClean == (u8)TRUE)) {
		XLoader_CfiErrHandler(&XLoader_CfuIns);
	}
	XLoader_CfuErrHandler(&XLoader_CfuIns);
	if (PlHouseClean == (u8)TRUE) {
		(void)XPmPlDomain_RetriggerPlHouseClean();
	}
#endif
}
void XLoader_CframeErrorHandler ( u32 ImageId ) { u32 Err1Status = XPlmi_In32 ( PMC_GLOBAL_PMC_ERR1_STATUS ) ; u32 Err2Status = XPlmi_In32 ( PMC_GLOBAL_PMC_ERR2_STATUS ) ; u32 CfuIsrStatus = XPlmi_In32 ( CFU_APB_CFU_ISR ) ; u32 CfuStatus = XPlmi_In32 ( CFU_APB_CFU_STATUS ) ; #ifndef PLM_DEBUG_MODE XCfupmc XLoader_CfuIns ; u8 CfiErrStatus ; u32 CountVal = XPlmi_In32 ( CFU_APB_CFU_QWORD_CNT ) ; u8 PlHouseClean = ( u8 ) ( ( CountVal != 0U ) && ( ImageId == PM_DEV_PLD_0 ) ) ; #else ( void ) ImageId ; #endif XPlmi_Printf ( DEBUG_GENERAL , " \n \r " " \n \r " " \n \r " , CfuIsrStatus , CfuStatus , Err1Status , Err2Status ) ; #ifndef PLM_DEBUG_MODE CfiErrStatus = ( u8 ) ( Err1Status & PMC_GLOBAL_PMC_ERR1_STATUS_CFRAME_MASK ) ; if ( CfiErrStatus == 0U ) { CfiErrStatus = ( u8 ) ( ( Err2Status & PMC_GLOBAL_PMC_ERR2_STATUS_CFI_MASK ) >> PMC_GLOBAL_PMC_ERR2_STATUS_CFI_SHIFT ) ; } if ( ( CfiErrStatus != 0U ) || ( PlHouseClean == ( u8 ) TRUE ) ) { XLoader_CfiErrHandler ( & XLoader_CfuIns ) ; } XLoader_CfuErrHandler ( & XLoader_CfuIns ) ; if ( PlHouseClean == ( u8 ) TRUE ) { ( void ) XPmPlDomain_RetriggerPlHouseClean ( ) ; } #endif }
@brief 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.
@brief 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 .
/** CFU Driver Instance */