XilinxProcessorIPLib/drivers/aienginev2/src/interrupt/xaie_interrupt.c
AieRC XAie_ErrorHandlingInit(XAie_DevInst *DevInst)
{
	AieRC RC;
	u8 TileType, L1BroadcastIdSwA, L1BroadcastIdSwB, MemTileStart,
	   MemTileEnd, AieRowStart, AieRowEnd, BroadcastDirSwA, BroadcastDirSwB;
	XAie_LocType Loc;
	const XAie_L1IntrMod *L1IntrMod;

	if((DevInst == XAIE_NULL) ||
			(DevInst->IsReady != XAIE_COMPONENT_IS_READY)) {
		XAIE_ERROR("Invalid device instance\n");
		return XAIE_INVALID_ARGS;
	}

	RC = XAie_ErrorHandlingReserveRsc(DevInst);
	if (RC != XAIE_OK) {
		return RC;
	}

	MemTileStart = DevInst->MemTileRowStart;
	MemTileEnd = DevInst->MemTileRowStart + DevInst->MemTileNumRows;
	AieRowStart = DevInst->AieTileRowStart;
	AieRowEnd = DevInst->AieTileRowStart + DevInst->AieTileNumRows;

	for(Loc.Col = 0; Loc.Col < DevInst->NumCols; Loc.Col++) {
		/* Setup error broadcasts to SOUTH from memory and core module */
		BroadcastDirSwA = XAIE_EVENT_BROADCAST_NORTH |
				  XAIE_EVENT_BROADCAST_EAST |
				  XAIE_EVENT_BROADCAST_WEST;
		BroadcastDirSwB = BroadcastDirSwA;

		for(Loc.Row = AieRowStart; Loc.Row < AieRowEnd; Loc.Row++) {
			if (_XAie_PmIsTileRequested(DevInst, Loc) == XAIE_DISABLE)
				continue;

			RC = XAie_EventBroadcastBlockDir(DevInst, Loc,
				   XAIE_CORE_MOD, XAIE_EVENT_SWITCH_A,
				   XAIE_ERROR_BROADCAST_ID, BroadcastDirSwA);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to block broadcasts in core module\n");
				return RC;
			}

			RC = XAie_EventBroadcastBlockDir(DevInst, Loc,
				   XAIE_MEM_MOD, XAIE_EVENT_SWITCH_A,
				   XAIE_ERROR_BROADCAST_ID, BroadcastDirSwB);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to block broadcasts in memory module\n");
				return RC;
			}
		}

		/* Setup error broadcasts to SOUTH from mem tile */
		for(Loc.Row = MemTileStart; Loc.Row < MemTileEnd; Loc.Row++) {
			if (_XAie_PmIsTileRequested(DevInst, Loc) == XAIE_DISABLE)
				continue;

			RC = XAie_EventBroadcastBlockDir(DevInst, Loc,
				   XAIE_MEM_MOD, XAIE_EVENT_SWITCH_A,
				   XAIE_ERROR_BROADCAST_ID, BroadcastDirSwA);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to block broadcasts in mem tile switch A\n");
				return RC;
			}

			RC = XAie_EventBroadcastBlockDir(DevInst, Loc,
				   XAIE_MEM_MOD, XAIE_EVENT_SWITCH_B,
				   XAIE_ERROR_BROADCAST_ID, BroadcastDirSwB);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to block broadcasts in mem tile switch B\n");
				return RC;
			}
		}

		/*
		 * Setup broadcast from array and PL module to the closest
		 * available L2 interrupt controller.
		 */
		Loc.Row = DevInst->ShimRow;

		/*
		 * Block direct broadcast from AIE array to the
		 * broadcast network in shim tiles.
		 */
		RC = XAie_IntrCtrlL1BroadcastBlock(DevInst, Loc,
				XAIE_EVENT_SWITCH_A, XAIE_ERROR_BROADCAST_MASK);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to block direct broadcasts from AIE array\n");
			return RC;
		}

		RC = XAie_IntrCtrlL1BroadcastBlock(DevInst, Loc,
				XAIE_EVENT_SWITCH_B, XAIE_ERROR_BROADCAST_MASK);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to block direct broadcasts from AIE array\n");
			return RC;
		}

		/*
		 * Enable broadcast network from AIE array to generate
		 * interrupts in L1 interrupt controller.
		 */
		RC = XAie_IntrCtrlL1Enable(DevInst, Loc, XAIE_EVENT_SWITCH_A,
				XAIE_ERROR_BROADCAST_ID);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to enable interrupts to L1\n");
			return RC;
		}

		RC = XAie_IntrCtrlL1Enable(DevInst, Loc, XAIE_EVENT_SWITCH_B,
				XAIE_ERROR_BROADCAST_ID);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to enable interrupts to L1\n");
			return RC;
		}

		/*
		 * Enable shim tile's internal error interrupts to L1
		 * interrupt controller in switch A.
		 */
		RC = XAie_IntrCtrlL1Enable(DevInst, Loc, XAIE_EVENT_SWITCH_A,
				XAIE_ERROR_SHIM_INTR_ID);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to enable interrupts to L1\n");
			return RC;
		}

		/*
		 * Compute the broadcast line number on which L1 interrupt
		 * controller must generate error interrupts.
		 */
		TileType = DevInst->DevOps->GetTTypefromLoc(DevInst, Loc);
		L1IntrMod = DevInst->DevProp.DevMod[TileType].L1IntrMod;
		if (L1IntrMod == NULL) {
			XAIE_ERROR("Invalid module type\n");
			return XAIE_INVALID_ARGS;
		}

		L1BroadcastIdSwA = L1IntrMod->IntrCtrlL1IrqId(DevInst, Loc,
					XAIE_EVENT_SWITCH_A);

		RC = XAie_IntrCtrlL1IrqSet(DevInst, Loc, XAIE_EVENT_SWITCH_A,
				L1BroadcastIdSwA);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to configure L1 IRQ line\n");
			return RC;
		}

		L1BroadcastIdSwB = L1IntrMod->IntrCtrlL1IrqId(DevInst, Loc,
					XAIE_EVENT_SWITCH_B);
		RC = XAie_IntrCtrlL1IrqSet(DevInst, Loc, XAIE_EVENT_SWITCH_B,
				L1BroadcastIdSwB);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to configure L1 IRQ line\n");
			return RC;
		}

		/*
		 * Interrupts within the shim tile's broadcast network must be
		 * routed to the closest L2 interrupt controller. While doing
		 * so, such interrupts need to be blocked from broadcasting
		 * beyond the L2 interrupt controller tile.
		 */
		if(TileType == XAIEGBL_TILE_TYPE_SHIMNOC) {
			XAie_LocType NextLoc;

			BroadcastDirSwA = XAIE_EVENT_BROADCAST_NORTH |
					  XAIE_EVENT_BROADCAST_SOUTH |
					  XAIE_EVENT_BROADCAST_WEST;
			BroadcastDirSwB = XAIE_EVENT_BROADCAST_ALL;

			/*
			 * Create bitmask to block broadcast from previous
			 * columns based on the location NoC tile.
			 */
			RC = _XAie_FindNextNoCTile(DevInst, Loc, &NextLoc);
			if (RC != XAIE_OK) {
				L1BroadcastIdSwB = XAIE_ERROR_L2_ENABLE;
			} else {
				L1BroadcastIdSwB = (1U <<
						(L1BroadcastIdSwB + 1U)) - 1U;
			}

			RC = XAie_EventBroadcastBlockMapDir(DevInst, Loc,
					XAIE_PL_MOD, XAIE_EVENT_SWITCH_B,
					L1BroadcastIdSwB, BroadcastDirSwB);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to block broadcasts in shim tile switch B\n");
				return RC;
			}

			RC = XAie_IntrCtrlL2Enable(DevInst, Loc,
					XAIE_ERROR_L2_ENABLE);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to enable interrupts to L2\n");
				return RC;
			}
		} else {
			XAie_LocType NextLoc;

			RC = _XAie_FindNextNoCTile(DevInst, Loc, &NextLoc);
			if (RC != XAIE_OK) {
				BroadcastDirSwA = XAIE_EVENT_BROADCAST_NORTH |
						  XAIE_EVENT_BROADCAST_SOUTH |
						  XAIE_EVENT_BROADCAST_EAST;
				BroadcastDirSwB = BroadcastDirSwA;
			} else {
				BroadcastDirSwA = XAIE_EVENT_BROADCAST_NORTH |
						  XAIE_EVENT_BROADCAST_SOUTH |
						  XAIE_EVENT_BROADCAST_WEST;
				BroadcastDirSwB = BroadcastDirSwA;
			}

			RC = XAie_EventBroadcastBlockDir(DevInst, Loc,
					XAIE_PL_MOD, XAIE_EVENT_SWITCH_B,
					L1BroadcastIdSwB, BroadcastDirSwB);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to block broadcasts in shim tile switch B\n");
				return RC;
			}
		}

		RC = XAie_EventBroadcastBlockDir(DevInst, Loc, XAIE_PL_MOD,
				XAIE_EVENT_SWITCH_A, L1BroadcastIdSwA,
				BroadcastDirSwA);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to block broadcasts in shim tile switch A\n");
			return RC;
		}
	}

	/* Enable NPI interrupt to PS GIC */
	RC = _XAie_NpiIrqEnable(DevInst, XAIE_ERROR_NPI_INTR_ID,
				XAIE_ERROR_NPI_INTR_ID);
	if (RC != XAIE_OK) {
		XAIE_ERROR("Failed to enable NPI interrupt\n");
		return RC;
	}

	RC =  _XAie_GroupErrorInit(DevInst);
	if(RC != XAIE_OK) {
		XAIE_ERROR("Failed to initialize group errors\n");
		return RC;
	}

	return XAIE_OK;
}
/*****************************************************************************/
/**
*
* This API configures broadcast network to deliver error events as interrupts in
* NPI. When error occurs, interrupt is raised on NPI interrupt line #5.
*
* @param	DevInst: Device Instance
*
* @return	XAIE_OK on success, error code on failure.
*
* @note		This API assumes the whole AIE as a single partition and the
*		following broadcast channels to be available. To avoid conflicts,
*		it is the user's responsibility to make sure none of the below
*		channels are being used.
*			* Broadcast channel #0 in AIE array tiles.
*			* Switch A L1 IRQ 16.
*			* NPI interrupt line #5.
*		Currently, this API only supports Linux UIO, CDO, and debug
*		backends.
******************************************************************************/
This API configures broadcast network to deliver error events as interrupts in
NPI. When error occurs, interrupt is raised on NPI interrupt line #5.
This API configures broadcast network to deliver error events as interrupts in NPI . When error occurs interrupt is raised on NPI interrupt line #5 .
AieRC XAie_ErrorHandlingInit(XAie_DevInst *DevInst)
{
	AieRC RC;
	u8 TileType, L1BroadcastIdSwA, L1BroadcastIdSwB, MemTileStart,
	   MemTileEnd, AieRowStart, AieRowEnd, BroadcastDirSwA, BroadcastDirSwB;
	XAie_LocType Loc;
	const XAie_L1IntrMod *L1IntrMod;
	if((DevInst == XAIE_NULL) ||
			(DevInst->IsReady != XAIE_COMPONENT_IS_READY)) {
		XAIE_ERROR("Invalid device instance\n");
		return XAIE_INVALID_ARGS;
	}
	RC = XAie_ErrorHandlingReserveRsc(DevInst);
	if (RC != XAIE_OK) {
		return RC;
	}
	MemTileStart = DevInst->MemTileRowStart;
	MemTileEnd = DevInst->MemTileRowStart + DevInst->MemTileNumRows;
	AieRowStart = DevInst->AieTileRowStart;
	AieRowEnd = DevInst->AieTileRowStart + DevInst->AieTileNumRows;
	for(Loc.Col = 0; Loc.Col < DevInst->NumCols; Loc.Col++) {
		BroadcastDirSwA = XAIE_EVENT_BROADCAST_NORTH |
				  XAIE_EVENT_BROADCAST_EAST |
				  XAIE_EVENT_BROADCAST_WEST;
		BroadcastDirSwB = BroadcastDirSwA;
		for(Loc.Row = AieRowStart; Loc.Row < AieRowEnd; Loc.Row++) {
			if (_XAie_PmIsTileRequested(DevInst, Loc) == XAIE_DISABLE)
				continue;
			RC = XAie_EventBroadcastBlockDir(DevInst, Loc,
				   XAIE_CORE_MOD, XAIE_EVENT_SWITCH_A,
				   XAIE_ERROR_BROADCAST_ID, BroadcastDirSwA);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to block broadcasts in core module\n");
				return RC;
			}
			RC = XAie_EventBroadcastBlockDir(DevInst, Loc,
				   XAIE_MEM_MOD, XAIE_EVENT_SWITCH_A,
				   XAIE_ERROR_BROADCAST_ID, BroadcastDirSwB);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to block broadcasts in memory module\n");
				return RC;
			}
		}
		for(Loc.Row = MemTileStart; Loc.Row < MemTileEnd; Loc.Row++) {
			if (_XAie_PmIsTileRequested(DevInst, Loc) == XAIE_DISABLE)
				continue;
			RC = XAie_EventBroadcastBlockDir(DevInst, Loc,
				   XAIE_MEM_MOD, XAIE_EVENT_SWITCH_A,
				   XAIE_ERROR_BROADCAST_ID, BroadcastDirSwA);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to block broadcasts in mem tile switch A\n");
				return RC;
			}
			RC = XAie_EventBroadcastBlockDir(DevInst, Loc,
				   XAIE_MEM_MOD, XAIE_EVENT_SWITCH_B,
				   XAIE_ERROR_BROADCAST_ID, BroadcastDirSwB);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to block broadcasts in mem tile switch B\n");
				return RC;
			}
		}
		Loc.Row = DevInst->ShimRow;
		RC = XAie_IntrCtrlL1BroadcastBlock(DevInst, Loc,
				XAIE_EVENT_SWITCH_A, XAIE_ERROR_BROADCAST_MASK);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to block direct broadcasts from AIE array\n");
			return RC;
		}
		RC = XAie_IntrCtrlL1BroadcastBlock(DevInst, Loc,
				XAIE_EVENT_SWITCH_B, XAIE_ERROR_BROADCAST_MASK);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to block direct broadcasts from AIE array\n");
			return RC;
		}
		RC = XAie_IntrCtrlL1Enable(DevInst, Loc, XAIE_EVENT_SWITCH_A,
				XAIE_ERROR_BROADCAST_ID);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to enable interrupts to L1\n");
			return RC;
		}
		RC = XAie_IntrCtrlL1Enable(DevInst, Loc, XAIE_EVENT_SWITCH_B,
				XAIE_ERROR_BROADCAST_ID);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to enable interrupts to L1\n");
			return RC;
		}
		RC = XAie_IntrCtrlL1Enable(DevInst, Loc, XAIE_EVENT_SWITCH_A,
				XAIE_ERROR_SHIM_INTR_ID);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to enable interrupts to L1\n");
			return RC;
		}
		TileType = DevInst->DevOps->GetTTypefromLoc(DevInst, Loc);
		L1IntrMod = DevInst->DevProp.DevMod[TileType].L1IntrMod;
		if (L1IntrMod == NULL) {
			XAIE_ERROR("Invalid module type\n");
			return XAIE_INVALID_ARGS;
		}
		L1BroadcastIdSwA = L1IntrMod->IntrCtrlL1IrqId(DevInst, Loc,
					XAIE_EVENT_SWITCH_A);
		RC = XAie_IntrCtrlL1IrqSet(DevInst, Loc, XAIE_EVENT_SWITCH_A,
				L1BroadcastIdSwA);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to configure L1 IRQ line\n");
			return RC;
		}
		L1BroadcastIdSwB = L1IntrMod->IntrCtrlL1IrqId(DevInst, Loc,
					XAIE_EVENT_SWITCH_B);
		RC = XAie_IntrCtrlL1IrqSet(DevInst, Loc, XAIE_EVENT_SWITCH_B,
				L1BroadcastIdSwB);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to configure L1 IRQ line\n");
			return RC;
		}
		if(TileType == XAIEGBL_TILE_TYPE_SHIMNOC) {
			XAie_LocType NextLoc;
			BroadcastDirSwA = XAIE_EVENT_BROADCAST_NORTH |
					  XAIE_EVENT_BROADCAST_SOUTH |
					  XAIE_EVENT_BROADCAST_WEST;
			BroadcastDirSwB = XAIE_EVENT_BROADCAST_ALL;
			RC = _XAie_FindNextNoCTile(DevInst, Loc, &NextLoc);
			if (RC != XAIE_OK) {
				L1BroadcastIdSwB = XAIE_ERROR_L2_ENABLE;
			} else {
				L1BroadcastIdSwB = (1U <<
						(L1BroadcastIdSwB + 1U)) - 1U;
			}
			RC = XAie_EventBroadcastBlockMapDir(DevInst, Loc,
					XAIE_PL_MOD, XAIE_EVENT_SWITCH_B,
					L1BroadcastIdSwB, BroadcastDirSwB);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to block broadcasts in shim tile switch B\n");
				return RC;
			}
			RC = XAie_IntrCtrlL2Enable(DevInst, Loc,
					XAIE_ERROR_L2_ENABLE);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to enable interrupts to L2\n");
				return RC;
			}
		} else {
			XAie_LocType NextLoc;
			RC = _XAie_FindNextNoCTile(DevInst, Loc, &NextLoc);
			if (RC != XAIE_OK) {
				BroadcastDirSwA = XAIE_EVENT_BROADCAST_NORTH |
						  XAIE_EVENT_BROADCAST_SOUTH |
						  XAIE_EVENT_BROADCAST_EAST;
				BroadcastDirSwB = BroadcastDirSwA;
			} else {
				BroadcastDirSwA = XAIE_EVENT_BROADCAST_NORTH |
						  XAIE_EVENT_BROADCAST_SOUTH |
						  XAIE_EVENT_BROADCAST_WEST;
				BroadcastDirSwB = BroadcastDirSwA;
			}
			RC = XAie_EventBroadcastBlockDir(DevInst, Loc,
					XAIE_PL_MOD, XAIE_EVENT_SWITCH_B,
					L1BroadcastIdSwB, BroadcastDirSwB);
			if(RC != XAIE_OK) {
				XAIE_ERROR("Failed to block broadcasts in shim tile switch B\n");
				return RC;
			}
		}
		RC = XAie_EventBroadcastBlockDir(DevInst, Loc, XAIE_PL_MOD,
				XAIE_EVENT_SWITCH_A, L1BroadcastIdSwA,
				BroadcastDirSwA);
		if(RC != XAIE_OK) {
			XAIE_ERROR("Failed to block broadcasts in shim tile switch A\n");
			return RC;
		}
	}
	RC = _XAie_NpiIrqEnable(DevInst, XAIE_ERROR_NPI_INTR_ID,
				XAIE_ERROR_NPI_INTR_ID);
	if (RC != XAIE_OK) {
		XAIE_ERROR("Failed to enable NPI interrupt\n");
		return RC;
	}
	RC =  _XAie_GroupErrorInit(DevInst);
	if(RC != XAIE_OK) {
		XAIE_ERROR("Failed to initialize group errors\n");
		return RC;
	}
	return XAIE_OK;
}
AieRC XAie_ErrorHandlingInit ( XAie_DevInst * DevInst ) { AieRC RC ; u8 TileType , L1BroadcastIdSwA , L1BroadcastIdSwB , MemTileStart , MemTileEnd , AieRowStart , AieRowEnd , BroadcastDirSwA , BroadcastDirSwB ; XAie_LocType Loc ; const XAie_L1IntrMod * L1IntrMod ; if ( ( DevInst == XAIE_NULL ) || ( DevInst -> IsReady != XAIE_COMPONENT_IS_READY ) ) { XAIE_ERROR ( " \n " ) ; return XAIE_INVALID_ARGS ; } RC = XAie_ErrorHandlingReserveRsc ( DevInst ) ; if ( RC != XAIE_OK ) { return RC ; } MemTileStart = DevInst -> MemTileRowStart ; MemTileEnd = DevInst -> MemTileRowStart + DevInst -> MemTileNumRows ; AieRowStart = DevInst -> AieTileRowStart ; AieRowEnd = DevInst -> AieTileRowStart + DevInst -> AieTileNumRows ; for ( Loc . Col = 0 ; Loc . Col < DevInst -> NumCols ; Loc . Col ++ ) { BroadcastDirSwA = XAIE_EVENT_BROADCAST_NORTH | XAIE_EVENT_BROADCAST_EAST | XAIE_EVENT_BROADCAST_WEST ; BroadcastDirSwB = BroadcastDirSwA ; for ( Loc . Row = AieRowStart ; Loc . Row < AieRowEnd ; Loc . Row ++ ) { if ( _XAie_PmIsTileRequested ( DevInst , Loc ) == XAIE_DISABLE ) continue ; RC = XAie_EventBroadcastBlockDir ( DevInst , Loc , XAIE_CORE_MOD , XAIE_EVENT_SWITCH_A , XAIE_ERROR_BROADCAST_ID , BroadcastDirSwA ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } RC = XAie_EventBroadcastBlockDir ( DevInst , Loc , XAIE_MEM_MOD , XAIE_EVENT_SWITCH_A , XAIE_ERROR_BROADCAST_ID , BroadcastDirSwB ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } } for ( Loc . Row = MemTileStart ; Loc . Row < MemTileEnd ; Loc . Row ++ ) { if ( _XAie_PmIsTileRequested ( DevInst , Loc ) == XAIE_DISABLE ) continue ; RC = XAie_EventBroadcastBlockDir ( DevInst , Loc , XAIE_MEM_MOD , XAIE_EVENT_SWITCH_A , XAIE_ERROR_BROADCAST_ID , BroadcastDirSwA ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } RC = XAie_EventBroadcastBlockDir ( DevInst , Loc , XAIE_MEM_MOD , XAIE_EVENT_SWITCH_B , XAIE_ERROR_BROADCAST_ID , BroadcastDirSwB ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } } Loc . Row = DevInst -> ShimRow ; RC = XAie_IntrCtrlL1BroadcastBlock ( DevInst , Loc , XAIE_EVENT_SWITCH_A , XAIE_ERROR_BROADCAST_MASK ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } RC = XAie_IntrCtrlL1BroadcastBlock ( DevInst , Loc , XAIE_EVENT_SWITCH_B , XAIE_ERROR_BROADCAST_MASK ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } RC = XAie_IntrCtrlL1Enable ( DevInst , Loc , XAIE_EVENT_SWITCH_A , XAIE_ERROR_BROADCAST_ID ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } RC = XAie_IntrCtrlL1Enable ( DevInst , Loc , XAIE_EVENT_SWITCH_B , XAIE_ERROR_BROADCAST_ID ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } RC = XAie_IntrCtrlL1Enable ( DevInst , Loc , XAIE_EVENT_SWITCH_A , XAIE_ERROR_SHIM_INTR_ID ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } TileType = DevInst -> DevOps -> GetTTypefromLoc ( DevInst , Loc ) ; L1IntrMod = DevInst -> DevProp . DevMod [ TileType ] . L1IntrMod ; if ( L1IntrMod == NULL ) { XAIE_ERROR ( " \n " ) ; return XAIE_INVALID_ARGS ; } L1BroadcastIdSwA = L1IntrMod -> IntrCtrlL1IrqId ( DevInst , Loc , XAIE_EVENT_SWITCH_A ) ; RC = XAie_IntrCtrlL1IrqSet ( DevInst , Loc , XAIE_EVENT_SWITCH_A , L1BroadcastIdSwA ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } L1BroadcastIdSwB = L1IntrMod -> IntrCtrlL1IrqId ( DevInst , Loc , XAIE_EVENT_SWITCH_B ) ; RC = XAie_IntrCtrlL1IrqSet ( DevInst , Loc , XAIE_EVENT_SWITCH_B , L1BroadcastIdSwB ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } if ( TileType == XAIEGBL_TILE_TYPE_SHIMNOC ) { XAie_LocType NextLoc ; BroadcastDirSwA = XAIE_EVENT_BROADCAST_NORTH | XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_WEST ; BroadcastDirSwB = XAIE_EVENT_BROADCAST_ALL ; RC = _XAie_FindNextNoCTile ( DevInst , Loc , & NextLoc ) ; if ( RC != XAIE_OK ) { L1BroadcastIdSwB = XAIE_ERROR_L2_ENABLE ; } else { L1BroadcastIdSwB = ( 1U << ( L1BroadcastIdSwB + 1U ) ) - 1U ; } RC = XAie_EventBroadcastBlockMapDir ( DevInst , Loc , XAIE_PL_MOD , XAIE_EVENT_SWITCH_B , L1BroadcastIdSwB , BroadcastDirSwB ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } RC = XAie_IntrCtrlL2Enable ( DevInst , Loc , XAIE_ERROR_L2_ENABLE ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } } else { XAie_LocType NextLoc ; RC = _XAie_FindNextNoCTile ( DevInst , Loc , & NextLoc ) ; if ( RC != XAIE_OK ) { BroadcastDirSwA = XAIE_EVENT_BROADCAST_NORTH | XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_EAST ; BroadcastDirSwB = BroadcastDirSwA ; } else { BroadcastDirSwA = XAIE_EVENT_BROADCAST_NORTH | XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_WEST ; BroadcastDirSwB = BroadcastDirSwA ; } RC = XAie_EventBroadcastBlockDir ( DevInst , Loc , XAIE_PL_MOD , XAIE_EVENT_SWITCH_B , L1BroadcastIdSwB , BroadcastDirSwB ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } } RC = XAie_EventBroadcastBlockDir ( DevInst , Loc , XAIE_PL_MOD , XAIE_EVENT_SWITCH_A , L1BroadcastIdSwA , BroadcastDirSwA ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } } RC = _XAie_NpiIrqEnable ( DevInst , XAIE_ERROR_NPI_INTR_ID , XAIE_ERROR_NPI_INTR_ID ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } RC = _XAie_GroupErrorInit ( DevInst ) ; if ( RC != XAIE_OK ) { XAIE_ERROR ( " \n " ) ; return RC ; } return XAIE_OK ; }
This API configures broadcast network to deliver error events as interrupts in
NPI.
This API configures broadcast network to deliver error events as interrupts in NPI .
/* Setup error broadcasts to SOUTH from memory and core module */ /* Setup error broadcasts to SOUTH from mem tile */ /*
		 * Setup broadcast from array and PL module to the closest
		 * available L2 interrupt controller.
		 */ /*
		 * Block direct broadcast from AIE array to the
		 * broadcast network in shim tiles.
		 */ /*
		 * Enable broadcast network from AIE array to generate
		 * interrupts in L1 interrupt controller.
		 */ /*
		 * Enable shim tile's internal error interrupts to L1
		 * interrupt controller in switch A.
		 */ /*
		 * Compute the broadcast line number on which L1 interrupt
		 * controller must generate error interrupts.
		 */ /*
		 * Interrupts within the shim tile's broadcast network must be
		 * routed to the closest L2 interrupt controller. While doing
		 * so, such interrupts need to be blocked from broadcasting
		 * beyond the L2 interrupt controller tile.
		 */ /*
			 * Create bitmask to block broadcast from previous
			 * columns based on the location NoC tile.
			 */ /* Enable NPI interrupt to PS GIC */