XilinxProcessorIPLib/drivers/aiengine/src/tile/xaietile_error.c
static void XAieTile_ErrorHandler(XAieGbl *AieInst, XAie_LocType Loc, u8 Module,
			     u8 Error, void *Arg)
{
	u8 ErrOff;
	XAieGbl_ErrorHandler *Handler;
	u32 *ErrsDefaultTrap;
	const char **ErrsStrs;

	(void)Arg;
	XAie_AssertVoid(AieInst != NULL);
	if (Module == XAIEGBL_MODULE_CORE) {
		ErrOff = Error - XAIETILE_EVENT_CORE_SRS_SATURATE;
		Handler = &AieInst->CoreErrHandlers[ErrOff];
		ErrsDefaultTrap = &(AieInst->CoreErrsDefaultTrap);
		ErrsStrs = XAie_CoreErrorStr;
	} else if (Module == XAIEGBL_MODULE_PL) {
		ErrOff = Error - XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR;
		Handler = &AieInst->ShimErrHandlers[ErrOff];
		ErrsDefaultTrap = &(AieInst->ShimErrsDefaultTrap);
		ErrsStrs = XAie_ShimErrorStr;
	} else {
		ErrOff = Error - XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED;
		Handler = &AieInst->MemErrHandlers[ErrOff];
		ErrsDefaultTrap = &(AieInst->MemErrsDefaultTrap);
		ErrsStrs = XAie_MemErrorStr;
	}
	XAieLib_log(XAIELIB_LOGERROR,
		    "Dev Error: (%d,%d),%s\n",
		    Loc.Col, Loc.Row, ErrsStrs[ErrOff]);
	if (Handler->Cb != NULL) {
		XAieGbl_ErrorHandleStatus Ret;

		Ret = Handler->Cb(AieInst, Loc, Module, Error, Handler->Arg);
		if (Ret == XAIETILE_ERROR_NOTHANDLED) {
			XAieTile_ErrorTrap(Handler);
		}
	} else {
		u32 Val, NumRows;
		XAieGbl_Tile *TilePtr;

		TilePtr = AieInst->Tiles;
		NumRows = AieInst->Config->NumRows;
		TilePtr += Loc.Col * (NumRows + 1) + Loc.Row;
		/* Check if it will need to trap application by default */
		if ((*ErrsDefaultTrap & (1 << ErrOff)) != 0) {
			/* Disable interrupt for this error and clean it*/
			if (Module == XAIEGBL_MODULE_CORE) {
				Val = XAieTile_CoreGroupEventGet(TilePtr, XAIETILE_GROUP_EVENT_CORE_ERROR0);
				Val &= ~(1 << ErrOff);
				XAieTile_CoreGroupEventSet(TilePtr, XAIETILE_GROUP_EVENT_CORE_ERROR0, Val);
			} else if (Module == XAIEGBL_MODULE_PL) {
				Val = XAieTile_PlGroupEventGet(TilePtr, XAIETILE_GROUP_EVENT_PL_ERRORS);
				Val &= ~(1 << ErrOff);
				XAieTile_PlGroupEventSet(TilePtr, XAIETILE_GROUP_EVENT_PL_ERRORS, Val);
			} else {
				Val = XAieTile_PlGroupEventGet(TilePtr, XAIETILE_GROUP_EVENT_MEM_ERROR);
				Val &= ~(1 << ErrOff);
				XAieTile_PlGroupEventSet(TilePtr, XAIETILE_GROUP_EVENT_MEM_ERROR, Val);
			}
			XAieTile_ErrorTrap(Handler);
		}
	}
}
/*****************************************************************************/
/**
 * This API checks if it needs to handle errors.
 *
 * @param	AieInst - pointer to AIE instance
 * @param	Loc - location of the tile
 * @param	Module - Module type
 *			XAIEGBL_MODULE_CORE, XAIEGBL_MODULE_PL,
 *			XAIEGBL_MODULE_MEM
 * @param	Error - Error event id
 * @param	Arg - Argument for event handler
 *
 * @return	None.
 *
 * @note	There are three types of error events:
 *              * Errors without notification, by default when this error
 *                happens, no notification is raised, user can register for
 *                events hadler for this type of errors.
 *              * Errors for logging only, by default, when this error happens
 *                driver will be notified by the interrupt, the driver will
 *                log this error and clear it.
 *              * Errors will notify users, by default, when this error happens,
 *                driver will call the registered error handler, based on
 *                the return value from the error handler, driver will kill the
 *                application or not. If there is no registered application
 *                error handler, driver will kill the application.
 *
 *		Used only within this file.
 *****************************************************************************/
This API checks if it needs to handle errors.

@return      None.

@note        There are three types of error events:
Errors without notification, by default when this error
happens, no notification is raised, user can register for
events hadler for this type of errors.
Errors for logging only, by default, when this error happens
driver will be notified by the interrupt, the driver will
log this error and clear it.
Errors will notify users, by default, when this error happens,
driver will call the registered error handler, based on
the return value from the error handler, driver will kill the
application or not. If there is no registered application
error handler, driver will kill the application.

Used only within this file.
This API checks if it needs to handle errors . @return None . @note There are three types of error events : Errors without notification by default when this error happens no notification is raised user can register for events hadler for this type of errors . Errors for logging only by default when this error happens driver will be notified by the interrupt the driver will log this error and clear it . Errors will notify users by default when this error happens driver will call the registered error handler based on the return value from the error handler driver will kill the application or not . If there is no registered application error handler driver will kill the application . Used only within this file .
static void XAieTile_ErrorHandler(XAieGbl *AieInst, XAie_LocType Loc, u8 Module,
			     u8 Error, void *Arg)
{
	u8 ErrOff;
	XAieGbl_ErrorHandler *Handler;
	u32 *ErrsDefaultTrap;
	const char **ErrsStrs;
	(void)Arg;
	XAie_AssertVoid(AieInst != NULL);
	if (Module == XAIEGBL_MODULE_CORE) {
		ErrOff = Error - XAIETILE_EVENT_CORE_SRS_SATURATE;
		Handler = &AieInst->CoreErrHandlers[ErrOff];
		ErrsDefaultTrap = &(AieInst->CoreErrsDefaultTrap);
		ErrsStrs = XAie_CoreErrorStr;
	} else if (Module == XAIEGBL_MODULE_PL) {
		ErrOff = Error - XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR;
		Handler = &AieInst->ShimErrHandlers[ErrOff];
		ErrsDefaultTrap = &(AieInst->ShimErrsDefaultTrap);
		ErrsStrs = XAie_ShimErrorStr;
	} else {
		ErrOff = Error - XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED;
		Handler = &AieInst->MemErrHandlers[ErrOff];
		ErrsDefaultTrap = &(AieInst->MemErrsDefaultTrap);
		ErrsStrs = XAie_MemErrorStr;
	}
	XAieLib_log(XAIELIB_LOGERROR,
		    "Dev Error: (%d,%d),%s\n",
		    Loc.Col, Loc.Row, ErrsStrs[ErrOff]);
	if (Handler->Cb != NULL) {
		XAieGbl_ErrorHandleStatus Ret;
		Ret = Handler->Cb(AieInst, Loc, Module, Error, Handler->Arg);
		if (Ret == XAIETILE_ERROR_NOTHANDLED) {
			XAieTile_ErrorTrap(Handler);
		}
	} else {
		u32 Val, NumRows;
		XAieGbl_Tile *TilePtr;
		TilePtr = AieInst->Tiles;
		NumRows = AieInst->Config->NumRows;
		TilePtr += Loc.Col * (NumRows + 1) + Loc.Row;
		if ((*ErrsDefaultTrap & (1 << ErrOff)) != 0) {
			if (Module == XAIEGBL_MODULE_CORE) {
				Val = XAieTile_CoreGroupEventGet(TilePtr, XAIETILE_GROUP_EVENT_CORE_ERROR0);
				Val &= ~(1 << ErrOff);
				XAieTile_CoreGroupEventSet(TilePtr, XAIETILE_GROUP_EVENT_CORE_ERROR0, Val);
			} else if (Module == XAIEGBL_MODULE_PL) {
				Val = XAieTile_PlGroupEventGet(TilePtr, XAIETILE_GROUP_EVENT_PL_ERRORS);
				Val &= ~(1 << ErrOff);
				XAieTile_PlGroupEventSet(TilePtr, XAIETILE_GROUP_EVENT_PL_ERRORS, Val);
			} else {
				Val = XAieTile_PlGroupEventGet(TilePtr, XAIETILE_GROUP_EVENT_MEM_ERROR);
				Val &= ~(1 << ErrOff);
				XAieTile_PlGroupEventSet(TilePtr, XAIETILE_GROUP_EVENT_MEM_ERROR, Val);
			}
			XAieTile_ErrorTrap(Handler);
		}
	}
}
static void XAieTile_ErrorHandler ( XAieGbl * AieInst , XAie_LocType Loc , u8 Module , u8 Error , void * Arg ) { u8 ErrOff ; XAieGbl_ErrorHandler * Handler ; u32 * ErrsDefaultTrap ; const char * * ErrsStrs ; ( void ) Arg ; XAie_AssertVoid ( AieInst != NULL ) ; if ( Module == XAIEGBL_MODULE_CORE ) { ErrOff = Error - XAIETILE_EVENT_CORE_SRS_SATURATE ; Handler = & AieInst -> CoreErrHandlers [ ErrOff ] ; ErrsDefaultTrap = & ( AieInst -> CoreErrsDefaultTrap ) ; ErrsStrs = XAie_CoreErrorStr ; } else if ( Module == XAIEGBL_MODULE_PL ) { ErrOff = Error - XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR ; Handler = & AieInst -> ShimErrHandlers [ ErrOff ] ; ErrsDefaultTrap = & ( AieInst -> ShimErrsDefaultTrap ) ; ErrsStrs = XAie_ShimErrorStr ; } else { ErrOff = Error - XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED ; Handler = & AieInst -> MemErrHandlers [ ErrOff ] ; ErrsDefaultTrap = & ( AieInst -> MemErrsDefaultTrap ) ; ErrsStrs = XAie_MemErrorStr ; } XAieLib_log ( XAIELIB_LOGERROR , " \n " , Loc . Col , Loc . Row , ErrsStrs [ ErrOff ] ) ; if ( Handler -> Cb != NULL ) { XAieGbl_ErrorHandleStatus Ret ; Ret = Handler -> Cb ( AieInst , Loc , Module , Error , Handler -> Arg ) ; if ( Ret == XAIETILE_ERROR_NOTHANDLED ) { XAieTile_ErrorTrap ( Handler ) ; } } else { u32 Val , NumRows ; XAieGbl_Tile * TilePtr ; TilePtr = AieInst -> Tiles ; NumRows = AieInst -> Config -> NumRows ; TilePtr += Loc . Col * ( NumRows + 1 ) + Loc . Row ; if ( ( * ErrsDefaultTrap & ( 1 << ErrOff ) ) != 0 ) { if ( Module == XAIEGBL_MODULE_CORE ) { Val = XAieTile_CoreGroupEventGet ( TilePtr , XAIETILE_GROUP_EVENT_CORE_ERROR0 ) ; Val &= ~ ( 1 << ErrOff ) ; XAieTile_CoreGroupEventSet ( TilePtr , XAIETILE_GROUP_EVENT_CORE_ERROR0 , Val ) ; } else if ( Module == XAIEGBL_MODULE_PL ) { Val = XAieTile_PlGroupEventGet ( TilePtr , XAIETILE_GROUP_EVENT_PL_ERRORS ) ; Val &= ~ ( 1 << ErrOff ) ; XAieTile_PlGroupEventSet ( TilePtr , XAIETILE_GROUP_EVENT_PL_ERRORS , Val ) ; } else { Val = XAieTile_PlGroupEventGet ( TilePtr , XAIETILE_GROUP_EVENT_MEM_ERROR ) ; Val &= ~ ( 1 << ErrOff ) ; XAieTile_PlGroupEventSet ( TilePtr , XAIETILE_GROUP_EVENT_MEM_ERROR , Val ) ; } XAieTile_ErrorTrap ( Handler ) ; } } }
This API checks if it needs to handle errors.
This API checks if it needs to handle errors .
/* Check if it will need to trap application by default */ /* Disable interrupt for this error and clean it*/