lib/sw_services/xilloader/src/xloader_cmd.c
static int XLoader_CheckIpiAccess(u32 CmdId, u32 IpiReqType)
{
	int Status = XST_FAILURE;
	volatile u8 ModuleCmdId = (u8)(CmdId & XPLMI_PLM_GENERIC_CMD_ID_MASK);
	volatile u8 ModuleCmdIdTmp = (u8)(CmdId & XPLMI_PLM_GENERIC_CMD_ID_MASK);
	volatile u32 IpiRequestType = IpiReqType;
	volatile u32 IpiRequestTypeTmp = IpiReqType;

	/* Secure check for Loader IPI commands */
	if (((ModuleCmdId == XLOADER_CMD_READBACK_CMD_ID) &&
		(ModuleCmdIdTmp == XLOADER_CMD_READBACK_CMD_ID)) ||
		((ModuleCmdId == XLOADER_CMD_UPDATE_MULTIBOOT_CMD_ID) &&
		(ModuleCmdIdTmp == XLOADER_CMD_UPDATE_MULTIBOOT_CMD_ID))) {
		if ((XPLMI_CMD_SECURE == IpiRequestType) &&
			(XPLMI_CMD_SECURE == IpiRequestTypeTmp)) {
			Status = XST_SUCCESS;
		}
	}
	else if (((ModuleCmdId != XLOADER_CMD_READBACK_CMD_ID) &&
		(ModuleCmdIdTmp != XLOADER_CMD_READBACK_CMD_ID)) &&
		((ModuleCmdId != XLOADER_CMD_UPDATE_MULTIBOOT_CMD_ID) &&
		(ModuleCmdIdTmp != XLOADER_CMD_UPDATE_MULTIBOOT_CMD_ID))) {
		if (ModuleCmdId == ModuleCmdIdTmp) {
			Status = XST_SUCCESS;
		}
	}
	else {
		Status = (int)XLOADER_ERR_GLITCH_DETECTED;
	}

	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function checks if the IPI command is accessible or not
 *
 * @param	CmdId is the Command ID
 * @param	IpiReqType is the IPI command request type
 *
 * @return	XST_SUCCESS on success and XST_FAILURE on failure
 *
 *****************************************************************************/
@brief       This function checks if the IPI command is accessible or not
@param       CmdId is the Command ID
@param       IpiReqType is the IPI command request type

@return      XST_SUCCESS on success and XST_FAILURE on failure
@brief This function checks if the IPI command is accessible or not @param CmdId is the Command ID @param IpiReqType is the IPI command request type @return XST_SUCCESS on success and XST_FAILURE on failure
static int XLoader_CheckIpiAccess(u32 CmdId, u32 IpiReqType)
{
	int Status = XST_FAILURE;
	volatile u8 ModuleCmdId = (u8)(CmdId & XPLMI_PLM_GENERIC_CMD_ID_MASK);
	volatile u8 ModuleCmdIdTmp = (u8)(CmdId & XPLMI_PLM_GENERIC_CMD_ID_MASK);
	volatile u32 IpiRequestType = IpiReqType;
	volatile u32 IpiRequestTypeTmp = IpiReqType;
	if (((ModuleCmdId == XLOADER_CMD_READBACK_CMD_ID) &&
		(ModuleCmdIdTmp == XLOADER_CMD_READBACK_CMD_ID)) ||
		((ModuleCmdId == XLOADER_CMD_UPDATE_MULTIBOOT_CMD_ID) &&
		(ModuleCmdIdTmp == XLOADER_CMD_UPDATE_MULTIBOOT_CMD_ID))) {
		if ((XPLMI_CMD_SECURE == IpiRequestType) &&
			(XPLMI_CMD_SECURE == IpiRequestTypeTmp)) {
			Status = XST_SUCCESS;
		}
	}
	else if (((ModuleCmdId != XLOADER_CMD_READBACK_CMD_ID) &&
		(ModuleCmdIdTmp != XLOADER_CMD_READBACK_CMD_ID)) &&
		((ModuleCmdId != XLOADER_CMD_UPDATE_MULTIBOOT_CMD_ID) &&
		(ModuleCmdIdTmp != XLOADER_CMD_UPDATE_MULTIBOOT_CMD_ID))) {
		if (ModuleCmdId == ModuleCmdIdTmp) {
			Status = XST_SUCCESS;
		}
	}
	else {
		Status = (int)XLOADER_ERR_GLITCH_DETECTED;
	}
	return Status;
}
static int XLoader_CheckIpiAccess ( u32 CmdId , u32 IpiReqType ) { int Status = XST_FAILURE ; volatile u8 ModuleCmdId = ( u8 ) ( CmdId & XPLMI_PLM_GENERIC_CMD_ID_MASK ) ; volatile u8 ModuleCmdIdTmp = ( u8 ) ( CmdId & XPLMI_PLM_GENERIC_CMD_ID_MASK ) ; volatile u32 IpiRequestType = IpiReqType ; volatile u32 IpiRequestTypeTmp = IpiReqType ; if ( ( ( ModuleCmdId == XLOADER_CMD_READBACK_CMD_ID ) && ( ModuleCmdIdTmp == XLOADER_CMD_READBACK_CMD_ID ) ) || ( ( ModuleCmdId == XLOADER_CMD_UPDATE_MULTIBOOT_CMD_ID ) && ( ModuleCmdIdTmp == XLOADER_CMD_UPDATE_MULTIBOOT_CMD_ID ) ) ) { if ( ( XPLMI_CMD_SECURE == IpiRequestType ) && ( XPLMI_CMD_SECURE == IpiRequestTypeTmp ) ) { Status = XST_SUCCESS ; } } else if ( ( ( ModuleCmdId != XLOADER_CMD_READBACK_CMD_ID ) && ( ModuleCmdIdTmp != XLOADER_CMD_READBACK_CMD_ID ) ) && ( ( ModuleCmdId != XLOADER_CMD_UPDATE_MULTIBOOT_CMD_ID ) && ( ModuleCmdIdTmp != XLOADER_CMD_UPDATE_MULTIBOOT_CMD_ID ) ) ) { if ( ModuleCmdId == ModuleCmdIdTmp ) { Status = XST_SUCCESS ; } } else { Status = ( int ) XLOADER_ERR_GLITCH_DETECTED ; } return Status ; }
@brief       This function checks if the IPI command is accessible or not
 @param       CmdId is the Command ID
 @param       IpiReqType is the IPI command request type
@brief This function checks if the IPI command is accessible or not @param CmdId is the Command ID @param IpiReqType is the IPI command request type
/* Secure check for Loader IPI commands */