XilinxProcessorIPLib/drivers/aienginev2/src/io_backend/privilege/xaie_io_privilege.c
AieRC _XAie_PrivilegeTeardownPart(XAie_DevInst *DevInst)
{
	AieRC RC;

	RC = _XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_ENABLE);
	if(RC != XAIE_OK) {
		XAIE_ERROR("Failed to teardown partition, enable protected registers failed.\n");
		return RC;
	}

	RC = _XAie_PmSetPartitionClock(DevInst, XAIE_DISABLE);
	if(RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}

	RC = _XAie_PrivilegeSetPartColReset(DevInst, XAIE_ENABLE);
	if(RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}

	RC = _XAie_PrivilegeSetPartColReset(DevInst, XAIE_DISABLE);
	if(RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}

	RC = _XAie_PrivilegeRstPartShims(DevInst);
	if(RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}

	RC = DevInst->DevOps->SetPartColClockAfterRst(DevInst, XAIE_ENABLE);
	if(RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}

	RC = DevInst->DevOps->PartMemZeroInit(DevInst);
	if (RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}

	RC = _XAie_PmSetPartitionClock(DevInst, XAIE_DISABLE);
	if(RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}

	return _XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
}
/*****************************************************************************/
/**
* This API tears down the AI engine partition
*
* @param	DevInst: AI engine partition device instance pointer
* @param	Opts: Initialization options
*
* @return       XAIE_OK on success, error code on failure
*
* @note		This operation does the following steps to initialize an AI
*		engine partition:
*		- Clock gate all columns
*		- Reset Columns
*		- Reset shims
*		- zeroize memories
*		- Clock gate all columns
*
*******************************************************************************/
This API tears down the AI engine partition
This API tears down the AI engine partition
AieRC _XAie_PrivilegeTeardownPart(XAie_DevInst *DevInst)
{
	AieRC RC;
	RC = _XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_ENABLE);
	if(RC != XAIE_OK) {
		XAIE_ERROR("Failed to teardown partition, enable protected registers failed.\n");
		return RC;
	}
	RC = _XAie_PmSetPartitionClock(DevInst, XAIE_DISABLE);
	if(RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}
	RC = _XAie_PrivilegeSetPartColReset(DevInst, XAIE_ENABLE);
	if(RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}
	RC = _XAie_PrivilegeSetPartColReset(DevInst, XAIE_DISABLE);
	if(RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}
	RC = _XAie_PrivilegeRstPartShims(DevInst);
	if(RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}
	RC = DevInst->DevOps->SetPartColClockAfterRst(DevInst, XAIE_ENABLE);
	if(RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}
	RC = DevInst->DevOps->PartMemZeroInit(DevInst);
	if (RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}
	RC = _XAie_PmSetPartitionClock(DevInst, XAIE_DISABLE);
	if(RC != XAIE_OK) {
		_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		return RC;
	}
	return _XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
}
AieRC _XAie_PrivilegeTeardownPart ( XAie_DevInst * DevInst ) { AieRC RC ; RC = _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_ENABLE ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } RC = _XAie_PmSetPartitionClock ( DevInst , XAIE_DISABLE ) ; if ( RC != XAIE_OK ) { _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_DISABLE ) ; return RC ; } RC = _XAie_PrivilegeSetPartColReset ( DevInst , XAIE_ENABLE ) ; if ( RC != XAIE_OK ) { _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_DISABLE ) ; return RC ; } RC = _XAie_PrivilegeSetPartColReset ( DevInst , XAIE_DISABLE ) ; if ( RC != XAIE_OK ) { _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_DISABLE ) ; return RC ; } RC = _XAie_PrivilegeRstPartShims ( DevInst ) ; if ( RC != XAIE_OK ) { _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_DISABLE ) ; return RC ; } RC = DevInst -> DevOps -> SetPartColClockAfterRst ( DevInst , XAIE_ENABLE ) ; if ( RC != XAIE_OK ) { _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_DISABLE ) ; return RC ; } RC = DevInst -> DevOps -> PartMemZeroInit ( DevInst ) ; if ( RC != XAIE_OK ) { _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_DISABLE ) ; return RC ; } RC = _XAie_PmSetPartitionClock ( DevInst , XAIE_DISABLE ) ; if ( RC != XAIE_OK ) { _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_DISABLE ) ; return RC ; } return _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_DISABLE ) ; }
This API tears down the AI engine partition
This API tears down the AI engine partition