lib/sw_services/xilsecure/src/versal/server/xsecure_tamper.c
int XSecure_ProcessTamperResponse(void)
{
	int Status = XST_FAILURE;
	volatile u32 TamperResponse = PMC_GLOBAL_SLD_MASK;
	volatile u32 TamperResponseTmp = PMC_GLOBAL_SLD_MASK;
	volatile u32 IntVal = PMC_GLOBAL_ISR_TAMPER_INT;
	volatile u32 IntValTmp = PMC_GLOBAL_ISR_TAMPER_INT;

	/**
	 * Check the reason for interrupt
	 */
	IntVal = Xil_In32(PMC_GLOBAL_ISR_REG_ADDR) &
		PMC_GLOBAL_ISR_TAMPER_INT;
	IntValTmp = Xil_In32(PMC_GLOBAL_ISR_REG_ADDR) &
		PMC_GLOBAL_ISR_TAMPER_INT;
	if ((IntVal == PMC_GLOBAL_ISR_TAMPER_INT) ||
		(IntValTmp == PMC_GLOBAL_ISR_TAMPER_INT)) {
		TamperResponse = Xil_In32(PMC_GLOBAL_TAMPER_RESP_0) &
				PMC_GLOBAL_SLD_MASK;
		TamperResponseTmp = Xil_In32(PMC_GLOBAL_TAMPER_RESP_0) &
				PMC_GLOBAL_SLD_MASK;
		if ((TamperResponse != 0U) || (TamperResponseTmp != 0U)) {
			XSecure_SecureLockDown();

			/**
			 * Trigger software tamper event to ROM to execute lockdown
			 * for PMC
			 */
			Status = Xil_SecureOut32(PMC_GLOBAL_TAMPER_TRIG,
					PMC_GLOBAL_TAMPER_TRIG_VAL);
			if (Status != XST_SUCCESS) {
				goto END;
			}
			/**
			 * Wait forever; ROM to complete secure lock down
			 */
			while(1U) {
			 ;
			};
		}
		else {
			Status = (int)XSECURE_NO_TAMPER_RESPONSE;
			goto END;
		}
	}

	Status = XST_SUCCESS;

END:
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function processes the tamper response
 *
 * @return 	- XST_SUCCESS - Always
 *
 *****************************************************************************/
@brief       This function processes the tamper response
@return      - XST_SUCCESS - Always
@brief This function processes the tamper response @return - XST_SUCCESS - Always
int XSecure_ProcessTamperResponse(void)
{
	int Status = XST_FAILURE;
	volatile u32 TamperResponse = PMC_GLOBAL_SLD_MASK;
	volatile u32 TamperResponseTmp = PMC_GLOBAL_SLD_MASK;
	volatile u32 IntVal = PMC_GLOBAL_ISR_TAMPER_INT;
	volatile u32 IntValTmp = PMC_GLOBAL_ISR_TAMPER_INT;
	IntVal = Xil_In32(PMC_GLOBAL_ISR_REG_ADDR) &
		PMC_GLOBAL_ISR_TAMPER_INT;
	IntValTmp = Xil_In32(PMC_GLOBAL_ISR_REG_ADDR) &
		PMC_GLOBAL_ISR_TAMPER_INT;
	if ((IntVal == PMC_GLOBAL_ISR_TAMPER_INT) ||
		(IntValTmp == PMC_GLOBAL_ISR_TAMPER_INT)) {
		TamperResponse = Xil_In32(PMC_GLOBAL_TAMPER_RESP_0) &
				PMC_GLOBAL_SLD_MASK;
		TamperResponseTmp = Xil_In32(PMC_GLOBAL_TAMPER_RESP_0) &
				PMC_GLOBAL_SLD_MASK;
		if ((TamperResponse != 0U) || (TamperResponseTmp != 0U)) {
			XSecure_SecureLockDown();
			Status = Xil_SecureOut32(PMC_GLOBAL_TAMPER_TRIG,
					PMC_GLOBAL_TAMPER_TRIG_VAL);
			if (Status != XST_SUCCESS) {
				goto END;
			}
			while(1U) {
			 ;
			};
		}
		else {
			Status = (int)XSECURE_NO_TAMPER_RESPONSE;
			goto END;
		}
	}
	Status = XST_SUCCESS;
END:
	return Status;
}
int XSecure_ProcessTamperResponse ( void ) { int Status = XST_FAILURE ; volatile u32 TamperResponse = PMC_GLOBAL_SLD_MASK ; volatile u32 TamperResponseTmp = PMC_GLOBAL_SLD_MASK ; volatile u32 IntVal = PMC_GLOBAL_ISR_TAMPER_INT ; volatile u32 IntValTmp = PMC_GLOBAL_ISR_TAMPER_INT ; IntVal = Xil_In32 ( PMC_GLOBAL_ISR_REG_ADDR ) & PMC_GLOBAL_ISR_TAMPER_INT ; IntValTmp = Xil_In32 ( PMC_GLOBAL_ISR_REG_ADDR ) & PMC_GLOBAL_ISR_TAMPER_INT ; if ( ( IntVal == PMC_GLOBAL_ISR_TAMPER_INT ) || ( IntValTmp == PMC_GLOBAL_ISR_TAMPER_INT ) ) { TamperResponse = Xil_In32 ( PMC_GLOBAL_TAMPER_RESP_0 ) & PMC_GLOBAL_SLD_MASK ; TamperResponseTmp = Xil_In32 ( PMC_GLOBAL_TAMPER_RESP_0 ) & PMC_GLOBAL_SLD_MASK ; if ( ( TamperResponse != 0U ) || ( TamperResponseTmp != 0U ) ) { XSecure_SecureLockDown ( ) ; Status = Xil_SecureOut32 ( PMC_GLOBAL_TAMPER_TRIG , PMC_GLOBAL_TAMPER_TRIG_VAL ) ; if ( Status != XST_SUCCESS ) { goto END ; } while ( 1U ) { ; } ; } else { Status = ( int ) XSECURE_NO_TAMPER_RESPONSE ; goto END ; } } Status = XST_SUCCESS ; END : return Status ; }
@brief       This function processes the tamper response
 @return      - XST_SUCCESS - Always
@brief This function processes the tamper response @return - XST_SUCCESS - Always
/**
	 * Check the reason for interrupt
	 */ /**
			 * Trigger software tamper event to ROM to execute lockdown
			 * for PMC
			 */ /**
			 * Wait forever; ROM to complete secure lock down
			 */