lib/sw_services/xilloader/src/xloader.c
static int XLoader_StartImage(XilPdi *PdiPtr)
{
	int Status = XST_FAILURE;
	u32 Index;
	u32 CpuId;
	u64 HandoffAddr;
	u32 ExecState;
	u32 VInitHi;
	u32 DeviceId;
	u8 SetAddress = 1U;
	u32 ErrorCode;

	/* Handoff to the cpus */
	for (Index = 0U; Index < PdiPtr->NoOfHandoffCpus; Index++) {
		CpuId = PdiPtr->HandoffParam[Index].CpuSettings &
			XIH_PH_ATTRB_DSTN_CPU_MASK;

		HandoffAddr = PdiPtr->HandoffParam[Index].HandoffAddr;
		ExecState = PdiPtr->HandoffParam[Index].CpuSettings &
				XIH_PH_ATTRB_A72_EXEC_ST_MASK;
		VInitHi = PdiPtr->HandoffParam[Index].CpuSettings &
				XIH_PH_ATTRB_HIVEC_MASK;
		Status = XST_FAILURE;
		switch (CpuId)
		{
			case XIH_PH_ATTRB_DSTN_CPU_A72_0:
				/* APU Core configuration */
				XLoader_A72Config(CpuId, ExecState, VInitHi);
				DeviceId = PM_DEV_ACPU_0;
				ErrorCode = XLOADER_ERR_WAKEUP_A72_0;
				XLoader_Printf(DEBUG_INFO, "Request APU0 "
						"wakeup\r\n");
				break;
			case XIH_PH_ATTRB_DSTN_CPU_A72_1:
				/* APU Core configuration */
				XLoader_A72Config(CpuId, ExecState, VInitHi);
				DeviceId = PM_DEV_ACPU_1;
				ErrorCode = XLOADER_ERR_WAKEUP_A72_1;
				XLoader_Printf(DEBUG_INFO, "Request APU1"
						"wakeup\r\n");
				break;
			case XIH_PH_ATTRB_DSTN_CPU_R5_0:
				DeviceId = PM_DEV_RPU0_0;
				ErrorCode = XLOADER_ERR_WAKEUP_R5_0;
				XLoader_Printf(DEBUG_INFO, "Request RPU 0 "
						"wakeup\r\n");
				break;
			case XIH_PH_ATTRB_DSTN_CPU_R5_1:
				DeviceId = PM_DEV_RPU0_1;
				ErrorCode = XLOADER_ERR_WAKEUP_R5_1;
				XLoader_Printf(DEBUG_INFO, "Request RPU 1 "
						"wakeup\r\n");
				break;
			case XIH_PH_ATTRB_DSTN_CPU_R5_L:
				DeviceId = PM_DEV_RPU0_0;
				ErrorCode = XLOADER_ERR_WAKEUP_R5_L;
				XLoader_Printf(DEBUG_INFO, "Request RPU "
						"wakeup\r\n");
				break;
			case XIH_PH_ATTRB_DSTN_CPU_PSM:
				DeviceId = PM_DEV_PSM_PROC;
				ErrorCode = XLOADER_ERR_WAKEUP_PSM;
				SetAddress = 0U;
				XLoader_Printf(DEBUG_INFO, "Request PSM wakeup\r\n");
				break;

			default:
				Status = XST_SUCCESS;
				break;
		}
		if (Status != XST_SUCCESS) {
			Status = XPm_RequestWakeUp(PM_SUBSYS_PMC, DeviceId,
				SetAddress, HandoffAddr, 0U, XPLMI_CMD_SECURE);
			if (Status != XST_SUCCESS) {
				Status = XPlmi_UpdateStatus(ErrorCode, Status);
				goto END;
			}
		}
	}

	Status = XST_SUCCESS;

END:
	/*
	 * Make Number of handoff CPUs to zero
	 */
	PdiPtr->NoOfHandoffCpus = 0x0U;
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function is used to start the subsystems in the PDI.
 *
 * @param	PdiPtr Pdi instance pointer
 *
 * @return	XST_SUCCESS on success and error code on failure
 *
 *****************************************************************************/
@brief       This function is used to start the subsystems in the PDI.
@param       PdiPtr Pdi instance pointer

@return      XST_SUCCESS on success and error code on failure
@brief This function is used to start the subsystems in the PDI . @param PdiPtr Pdi instance pointer @return XST_SUCCESS on success and error code on failure
static int XLoader_StartImage(XilPdi *PdiPtr)
{
	int Status = XST_FAILURE;
	u32 Index;
	u32 CpuId;
	u64 HandoffAddr;
	u32 ExecState;
	u32 VInitHi;
	u32 DeviceId;
	u8 SetAddress = 1U;
	u32 ErrorCode;
	for (Index = 0U; Index < PdiPtr->NoOfHandoffCpus; Index++) {
		CpuId = PdiPtr->HandoffParam[Index].CpuSettings &
			XIH_PH_ATTRB_DSTN_CPU_MASK;
		HandoffAddr = PdiPtr->HandoffParam[Index].HandoffAddr;
		ExecState = PdiPtr->HandoffParam[Index].CpuSettings &
				XIH_PH_ATTRB_A72_EXEC_ST_MASK;
		VInitHi = PdiPtr->HandoffParam[Index].CpuSettings &
				XIH_PH_ATTRB_HIVEC_MASK;
		Status = XST_FAILURE;
		switch (CpuId)
		{
			case XIH_PH_ATTRB_DSTN_CPU_A72_0:
				XLoader_A72Config(CpuId, ExecState, VInitHi);
				DeviceId = PM_DEV_ACPU_0;
				ErrorCode = XLOADER_ERR_WAKEUP_A72_0;
				XLoader_Printf(DEBUG_INFO, "Request APU0 "
						"wakeup\r\n");
				break;
			case XIH_PH_ATTRB_DSTN_CPU_A72_1:
				XLoader_A72Config(CpuId, ExecState, VInitHi);
				DeviceId = PM_DEV_ACPU_1;
				ErrorCode = XLOADER_ERR_WAKEUP_A72_1;
				XLoader_Printf(DEBUG_INFO, "Request APU1"
						"wakeup\r\n");
				break;
			case XIH_PH_ATTRB_DSTN_CPU_R5_0:
				DeviceId = PM_DEV_RPU0_0;
				ErrorCode = XLOADER_ERR_WAKEUP_R5_0;
				XLoader_Printf(DEBUG_INFO, "Request RPU 0 "
						"wakeup\r\n");
				break;
			case XIH_PH_ATTRB_DSTN_CPU_R5_1:
				DeviceId = PM_DEV_RPU0_1;
				ErrorCode = XLOADER_ERR_WAKEUP_R5_1;
				XLoader_Printf(DEBUG_INFO, "Request RPU 1 "
						"wakeup\r\n");
				break;
			case XIH_PH_ATTRB_DSTN_CPU_R5_L:
				DeviceId = PM_DEV_RPU0_0;
				ErrorCode = XLOADER_ERR_WAKEUP_R5_L;
				XLoader_Printf(DEBUG_INFO, "Request RPU "
						"wakeup\r\n");
				break;
			case XIH_PH_ATTRB_DSTN_CPU_PSM:
				DeviceId = PM_DEV_PSM_PROC;
				ErrorCode = XLOADER_ERR_WAKEUP_PSM;
				SetAddress = 0U;
				XLoader_Printf(DEBUG_INFO, "Request PSM wakeup\r\n");
				break;
			default:
				Status = XST_SUCCESS;
				break;
		}
		if (Status != XST_SUCCESS) {
			Status = XPm_RequestWakeUp(PM_SUBSYS_PMC, DeviceId,
				SetAddress, HandoffAddr, 0U, XPLMI_CMD_SECURE);
			if (Status != XST_SUCCESS) {
				Status = XPlmi_UpdateStatus(ErrorCode, Status);
				goto END;
			}
		}
	}
	Status = XST_SUCCESS;
END:
	PdiPtr->NoOfHandoffCpus = 0x0U;
	return Status;
}
static int XLoader_StartImage ( XilPdi * PdiPtr ) { int Status = XST_FAILURE ; u32 Index ; u32 CpuId ; u64 HandoffAddr ; u32 ExecState ; u32 VInitHi ; u32 DeviceId ; u8 SetAddress = 1U ; u32 ErrorCode ; for ( Index = 0U ; Index < PdiPtr -> NoOfHandoffCpus ; Index ++ ) { CpuId = PdiPtr -> HandoffParam [ Index ] . CpuSettings & XIH_PH_ATTRB_DSTN_CPU_MASK ; HandoffAddr = PdiPtr -> HandoffParam [ Index ] . HandoffAddr ; ExecState = PdiPtr -> HandoffParam [ Index ] . CpuSettings & XIH_PH_ATTRB_A72_EXEC_ST_MASK ; VInitHi = PdiPtr -> HandoffParam [ Index ] . CpuSettings & XIH_PH_ATTRB_HIVEC_MASK ; Status = XST_FAILURE ; switch ( CpuId ) { case XIH_PH_ATTRB_DSTN_CPU_A72_0 : XLoader_A72Config ( CpuId , ExecState , VInitHi ) ; DeviceId = PM_DEV_ACPU_0 ; ErrorCode = XLOADER_ERR_WAKEUP_A72_0 ; XLoader_Printf ( DEBUG_INFO , " " " \r \n " ) ; break ; case XIH_PH_ATTRB_DSTN_CPU_A72_1 : XLoader_A72Config ( CpuId , ExecState , VInitHi ) ; DeviceId = PM_DEV_ACPU_1 ; ErrorCode = XLOADER_ERR_WAKEUP_A72_1 ; XLoader_Printf ( DEBUG_INFO , " " " \r \n " ) ; break ; case XIH_PH_ATTRB_DSTN_CPU_R5_0 : DeviceId = PM_DEV_RPU0_0 ; ErrorCode = XLOADER_ERR_WAKEUP_R5_0 ; XLoader_Printf ( DEBUG_INFO , " " " \r \n " ) ; break ; case XIH_PH_ATTRB_DSTN_CPU_R5_1 : DeviceId = PM_DEV_RPU0_1 ; ErrorCode = XLOADER_ERR_WAKEUP_R5_1 ; XLoader_Printf ( DEBUG_INFO , " " " \r \n " ) ; break ; case XIH_PH_ATTRB_DSTN_CPU_R5_L : DeviceId = PM_DEV_RPU0_0 ; ErrorCode = XLOADER_ERR_WAKEUP_R5_L ; XLoader_Printf ( DEBUG_INFO , " " " \r \n " ) ; break ; case XIH_PH_ATTRB_DSTN_CPU_PSM : DeviceId = PM_DEV_PSM_PROC ; ErrorCode = XLOADER_ERR_WAKEUP_PSM ; SetAddress = 0U ; XLoader_Printf ( DEBUG_INFO , " \r \n " ) ; break ; default : Status = XST_SUCCESS ; break ; } if ( Status != XST_SUCCESS ) { Status = XPm_RequestWakeUp ( PM_SUBSYS_PMC , DeviceId , SetAddress , HandoffAddr , 0U , XPLMI_CMD_SECURE ) ; if ( Status != XST_SUCCESS ) { Status = XPlmi_UpdateStatus ( ErrorCode , Status ) ; goto END ; } } } Status = XST_SUCCESS ; END : PdiPtr -> NoOfHandoffCpus = 0x0U ; return Status ; }
@brief       This function is used to start the subsystems in the PDI.
@brief This function is used to start the subsystems in the PDI .
/* Handoff to the cpus */ /* APU Core configuration */ /* APU Core configuration */ /*
	 * Make Number of handoff CPUs to zero
	 */