XilinxProcessorIPLib/drivers/aienginev2/src/io_backend/privilege/xaie_io_privilege.c
AieRC _XAie_PrivilegeInitPart(XAie_DevInst *DevInst, XAie_PartInitOpts *Opts)
{
	u32 OptFlags;
	AieRC RC;

	if(Opts != NULL) {
		OptFlags = Opts->InitOpts;
	} else {
		OptFlags = XAIE_PART_INIT_OPT_DEFAULT;
	}

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

	if((OptFlags & XAIE_PART_INIT_OPT_COLUMN_RST) != 0) {
		/* Always gate all tiles before resetting columns */
		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;
		}

	}

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

	if((OptFlags & XAIE_PART_INIT_OPT_BLOCK_NOCAXIMMERR) != 0) {
		RC = _XAie_PrivilegeSetPartBlockAxiMmNsuErr(DevInst,
			XAIE_ENABLE, XAIE_ENABLE);
		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;
	}

	if ((OptFlags & XAIE_PART_INIT_OPT_ISOLATE) != 0) {
		RC = DevInst->DevOps->SetPartIsolationAfterRst(DevInst);
		if(RC != XAIE_OK) {
			_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		}
	}

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

	return _XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
}
/*****************************************************************************/
/**
* This API initializes 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
*		- Setup AXI MM not to return errors for AXI decode or slave
*		  errors, raise events instead.
*		- ungate all columns
*		- Setup partition isolation.
*		- zeroize memory if it is requested
*
*******************************************************************************/
This API initializes the AI engine partition
This API initializes the AI engine partition
AieRC _XAie_PrivilegeInitPart(XAie_DevInst *DevInst, XAie_PartInitOpts *Opts)
{
	u32 OptFlags;
	AieRC RC;
	if(Opts != NULL) {
		OptFlags = Opts->InitOpts;
	} else {
		OptFlags = XAIE_PART_INIT_OPT_DEFAULT;
	}
	RC = _XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_ENABLE);
	if(RC != XAIE_OK) {
		XAIE_ERROR("Failed to initialize partition, enable protected registers failed.\n");
		return RC;
	}
	if((OptFlags & XAIE_PART_INIT_OPT_COLUMN_RST) != 0) {
		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;
		}
	}
	if((OptFlags & XAIE_PART_INIT_OPT_SHIM_RST) != 0) {
		RC = _XAie_PrivilegeRstPartShims(DevInst);
		if(RC != XAIE_OK) {
			_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
			return RC;
		}
	}
	if((OptFlags & XAIE_PART_INIT_OPT_BLOCK_NOCAXIMMERR) != 0) {
		RC = _XAie_PrivilegeSetPartBlockAxiMmNsuErr(DevInst,
			XAIE_ENABLE, XAIE_ENABLE);
		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;
	}
	if ((OptFlags & XAIE_PART_INIT_OPT_ISOLATE) != 0) {
		RC = DevInst->DevOps->SetPartIsolationAfterRst(DevInst);
		if(RC != XAIE_OK) {
			_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
		}
	}
	if ((OptFlags & XAIE_PART_INIT_OPT_ZEROIZEMEM) != 0) {
		RC = DevInst->DevOps->PartMemZeroInit(DevInst);
		if(RC != XAIE_OK) {
			_XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
			return RC;
		}
	}
	return _XAie_PrivilegeSetPartProtectedRegs(DevInst, XAIE_DISABLE);
}
AieRC _XAie_PrivilegeInitPart ( XAie_DevInst * DevInst , XAie_PartInitOpts * Opts ) { u32 OptFlags ; AieRC RC ; if ( Opts != NULL ) { OptFlags = Opts -> InitOpts ; } else { OptFlags = XAIE_PART_INIT_OPT_DEFAULT ; } RC = _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_ENABLE ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } if ( ( OptFlags & XAIE_PART_INIT_OPT_COLUMN_RST ) != 0 ) { 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 ; } } if ( ( OptFlags & XAIE_PART_INIT_OPT_SHIM_RST ) != 0 ) { RC = _XAie_PrivilegeRstPartShims ( DevInst ) ; if ( RC != XAIE_OK ) { _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_DISABLE ) ; return RC ; } } if ( ( OptFlags & XAIE_PART_INIT_OPT_BLOCK_NOCAXIMMERR ) != 0 ) { RC = _XAie_PrivilegeSetPartBlockAxiMmNsuErr ( DevInst , XAIE_ENABLE , XAIE_ENABLE ) ; 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 ; } if ( ( OptFlags & XAIE_PART_INIT_OPT_ISOLATE ) != 0 ) { RC = DevInst -> DevOps -> SetPartIsolationAfterRst ( DevInst ) ; if ( RC != XAIE_OK ) { _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_DISABLE ) ; } } if ( ( OptFlags & XAIE_PART_INIT_OPT_ZEROIZEMEM ) != 0 ) { RC = DevInst -> DevOps -> PartMemZeroInit ( DevInst ) ; if ( RC != XAIE_OK ) { _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_DISABLE ) ; return RC ; } } return _XAie_PrivilegeSetPartProtectedRegs ( DevInst , XAIE_DISABLE ) ; }
This API initializes the AI engine partition
This API initializes the AI engine partition
/* Always gate all tiles before resetting columns */