lib/sw_services/xilloader/src/xloader.c
static int XLoader_LoadImage(XilPdi *PdiPtr)
{
	int Status = XST_FAILURE;
	u32 NodeId = NODESUBCLASS(PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID);

#ifdef XPLM_SEM
	/* Stop the SEM scan before PL load */
	if ((PdiPtr->PdiType != XLOADER_PDI_TYPE_FULL) &&
		(NodeId == (u32)XPM_NODESUBCL_DEV_PL)) {
		Status = XSem_StopScan();
		if (Status != XST_SUCCESS) {
			Status = XPlmi_UpdateStatus(
				XLOADER_ERR_SEM_STOP_SCAN, Status);
			goto END;
		}
	}
#endif

	Status = XLoader_VerifyImgInfo((const XLoader_ImageInfo *)
		&PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID);
	if (Status != XST_SUCCESS) {
		goto END;
	}
	/* Configure preallocs for subsystem */
	if (NODECLASS(PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID)
			== XPM_NODECLASS_SUBSYSTEM) {
		Status = XPmSubsystem_Configure(
			PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID);
		if (Status != XST_SUCCESS) {
			Status = XPlmi_UpdateStatus(
				XLOADER_ERR_CONFIG_SUBSYSTEM, Status);
			goto END;
		}
	}

	PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgName[XILPDI_IMG_NAME_ARRAY_SIZE - 1U] = 0;
	PdiPtr->CurImgId = PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID;
	/* Update current subsystem ID for EM */
	XPlmi_SetEmSubsystemId(&PdiPtr->CurImgId);
	Status = XLoader_LoadImagePrtns(PdiPtr);
	if (Status != XST_SUCCESS) {
		goto END;
	}

	if ((PdiPtr->DelayLoad == (u8)FALSE) &&
		(PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID !=
		XLOADER_INVALID_IMG_ID)) {
		Status = XLoader_StoreImageInfo((const XLoader_ImageInfo *)
		&PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	/* Log the image load to the Trace Log buffer */
	XPlmi_TraceLog3(XPLMI_TRACE_LOG_LOAD_IMAGE, PdiPtr->CurImgId);

	/* Apply MJTAG Work-around after first PL loading */
	if (NodeId == (u32)XPM_NODESUBCL_DEV_PL) {
		/* Apply MJTAG workaround only if bootmode is other than JTAG */
		if (PdiPtr->PdiSrc != XLOADER_PDI_SRC_JTAG) {
			XLoader_SetJtagTapToReset();
		}
	}

#ifdef XPLM_SEM
	/* Resume the SEM scan after PL load */
	if ((PdiPtr->PdiType != XLOADER_PDI_TYPE_FULL) &&
		(NodeId == (u32)XPM_NODESUBCL_DEV_PL)) {
		Status = XSem_InitScan();
		if (Status != XST_SUCCESS) {
			Status = XPlmi_UpdateStatus(XLOADER_ERR_SEM_INIT, Status);
		}
	}
#endif

END:
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function is used load a image in PDI. PDI can have multiple
 * images present in it. This can be used to load a single image like PL, APU, RPU.
 * This will load all the partitions that are present in that image.
 *
 * @param	PdiPtr is Pdi instance pointer
 *
 * @return	XST_SUCCESS on success and error code on failure
 *
 *****************************************************************************/
@brief       This function is used load a image in PDI. PDI can have multiple
images present in it. This can be used to load a single image like PL, APU, RPU.
This will load all the partitions that are present in that image.

@param       PdiPtr is Pdi instance pointer

@return      XST_SUCCESS on success and error code on failure
@brief This function is used load a image in PDI . PDI can have multiple images present in it . This can be used to load a single image like PL APU RPU . This will load all the partitions that are present in that image . @param PdiPtr is Pdi instance pointer @return XST_SUCCESS on success and error code on failure
static int XLoader_LoadImage(XilPdi *PdiPtr)
{
	int Status = XST_FAILURE;
	u32 NodeId = NODESUBCLASS(PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID);
#ifdef XPLM_SEM
	if ((PdiPtr->PdiType != XLOADER_PDI_TYPE_FULL) &&
		(NodeId == (u32)XPM_NODESUBCL_DEV_PL)) {
		Status = XSem_StopScan();
		if (Status != XST_SUCCESS) {
			Status = XPlmi_UpdateStatus(
				XLOADER_ERR_SEM_STOP_SCAN, Status);
			goto END;
		}
	}
#endif
	Status = XLoader_VerifyImgInfo((const XLoader_ImageInfo *)
		&PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID);
	if (Status != XST_SUCCESS) {
		goto END;
	}
	if (NODECLASS(PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID)
			== XPM_NODECLASS_SUBSYSTEM) {
		Status = XPmSubsystem_Configure(
			PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID);
		if (Status != XST_SUCCESS) {
			Status = XPlmi_UpdateStatus(
				XLOADER_ERR_CONFIG_SUBSYSTEM, Status);
			goto END;
		}
	}
	PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgName[XILPDI_IMG_NAME_ARRAY_SIZE - 1U] = 0;
	PdiPtr->CurImgId = PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID;
	XPlmi_SetEmSubsystemId(&PdiPtr->CurImgId);
	Status = XLoader_LoadImagePrtns(PdiPtr);
	if (Status != XST_SUCCESS) {
		goto END;
	}
	if ((PdiPtr->DelayLoad == (u8)FALSE) &&
		(PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID !=
		XLOADER_INVALID_IMG_ID)) {
		Status = XLoader_StoreImageInfo((const XLoader_ImageInfo *)
		&PdiPtr->MetaHdr.ImgHdr[PdiPtr->ImageNum].ImgID);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	XPlmi_TraceLog3(XPLMI_TRACE_LOG_LOAD_IMAGE, PdiPtr->CurImgId);
	if (NodeId == (u32)XPM_NODESUBCL_DEV_PL) {
		if (PdiPtr->PdiSrc != XLOADER_PDI_SRC_JTAG) {
			XLoader_SetJtagTapToReset();
		}
	}
#ifdef XPLM_SEM
	if ((PdiPtr->PdiType != XLOADER_PDI_TYPE_FULL) &&
		(NodeId == (u32)XPM_NODESUBCL_DEV_PL)) {
		Status = XSem_InitScan();
		if (Status != XST_SUCCESS) {
			Status = XPlmi_UpdateStatus(XLOADER_ERR_SEM_INIT, Status);
		}
	}
#endif
END:
	return Status;
}
static int XLoader_LoadImage ( XilPdi * PdiPtr ) { int Status = XST_FAILURE ; u32 NodeId = NODESUBCLASS ( PdiPtr -> MetaHdr . ImgHdr [ PdiPtr -> ImageNum ] . ImgID ) ; #ifdef XPLM_SEM if ( ( PdiPtr -> PdiType != XLOADER_PDI_TYPE_FULL ) && ( NodeId == ( u32 ) XPM_NODESUBCL_DEV_PL ) ) { Status = XSem_StopScan ( ) ; if ( Status != XST_SUCCESS ) { Status = XPlmi_UpdateStatus ( XLOADER_ERR_SEM_STOP_SCAN , Status ) ; goto END ; } } #endif Status = XLoader_VerifyImgInfo ( ( const XLoader_ImageInfo * ) & PdiPtr -> MetaHdr . ImgHdr [ PdiPtr -> ImageNum ] . ImgID ) ; if ( Status != XST_SUCCESS ) { goto END ; } if ( NODECLASS ( PdiPtr -> MetaHdr . ImgHdr [ PdiPtr -> ImageNum ] . ImgID ) == XPM_NODECLASS_SUBSYSTEM ) { Status = XPmSubsystem_Configure ( PdiPtr -> MetaHdr . ImgHdr [ PdiPtr -> ImageNum ] . ImgID ) ; if ( Status != XST_SUCCESS ) { Status = XPlmi_UpdateStatus ( XLOADER_ERR_CONFIG_SUBSYSTEM , Status ) ; goto END ; } } PdiPtr -> MetaHdr . ImgHdr [ PdiPtr -> ImageNum ] . ImgName [ XILPDI_IMG_NAME_ARRAY_SIZE - 1U ] = 0 ; PdiPtr -> CurImgId = PdiPtr -> MetaHdr . ImgHdr [ PdiPtr -> ImageNum ] . ImgID ; XPlmi_SetEmSubsystemId ( & PdiPtr -> CurImgId ) ; Status = XLoader_LoadImagePrtns ( PdiPtr ) ; if ( Status != XST_SUCCESS ) { goto END ; } if ( ( PdiPtr -> DelayLoad == ( u8 ) FALSE ) && ( PdiPtr -> MetaHdr . ImgHdr [ PdiPtr -> ImageNum ] . ImgID != XLOADER_INVALID_IMG_ID ) ) { Status = XLoader_StoreImageInfo ( ( const XLoader_ImageInfo * ) & PdiPtr -> MetaHdr . ImgHdr [ PdiPtr -> ImageNum ] . ImgID ) ; if ( Status != XST_SUCCESS ) { goto END ; } } XPlmi_TraceLog3 ( XPLMI_TRACE_LOG_LOAD_IMAGE , PdiPtr -> CurImgId ) ; if ( NodeId == ( u32 ) XPM_NODESUBCL_DEV_PL ) { if ( PdiPtr -> PdiSrc != XLOADER_PDI_SRC_JTAG ) { XLoader_SetJtagTapToReset ( ) ; } } #ifdef XPLM_SEM if ( ( PdiPtr -> PdiType != XLOADER_PDI_TYPE_FULL ) && ( NodeId == ( u32 ) XPM_NODESUBCL_DEV_PL ) ) { Status = XSem_InitScan ( ) ; if ( Status != XST_SUCCESS ) { Status = XPlmi_UpdateStatus ( XLOADER_ERR_SEM_INIT , Status ) ; } } #endif END : return Status ; }
@brief       This function is used load a image in PDI.
@brief This function is used load a image in PDI .
/* Stop the SEM scan before PL load */ /* Configure preallocs for subsystem */ /* Update current subsystem ID for EM */ /* Log the image load to the Trace Log buffer */ /* Apply MJTAG Work-around after first PL loading */ /* Apply MJTAG workaround only if bootmode is other than JTAG */ /* Resume the SEM scan after PL load */