lib/sw_services/xilloader/src/xloader_cmd.c
static int XLoader_RemoveImageStorePdi(XPlmi_Cmd *Cmd)
{
	int Status = XST_FAILURE;
	u64 PdiAddr = (u64)Cmd->Payload[XLOADER_CMD_IMGSTORE_PDIADDR_HIGH_INDEX];
	u8 Index;
	u8 ShiftIdx;
	XLoader_ImageStore *PdiList = XLoader_GetPdiList();

	if (PdiList->Count == 0U) {
		Status = XPlmi_UpdateStatus(XLOADER_ERR_PDI_LIST_EMPTY, 0);
		goto END;
	}

	PdiAddr = ((u64)Cmd->Payload[XLOADER_CMD_IMGSTORE_PDIADDR_LOW_INDEX]) |
			(PdiAddr << 32U);
	/* If PdiAddr matches with any entry in the List, remove it */
	for (Index = 0U; Index < PdiList->Count; Index++) {
		if (PdiList->PdiAddr[Index] == PdiAddr) {
			for (ShiftIdx = Index; ShiftIdx < (PdiList->Count - 1U);
				ShiftIdx++) {
				PdiList->PdiAddr[ShiftIdx] =
					PdiList->PdiAddr[ShiftIdx + 1U];
			}
			break;
		}
	}
	if (Index == PdiList->Count) {
		Status = XPlmi_UpdateStatus(
				XLOADER_ERR_PDI_ADDR_NOT_FOUND, 0);
		goto END;
	}
	PdiList->Count--;
	if (PdiList->Count == 0U) {
		Status = XLoader_DdrRelease();
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	Status = XST_SUCCESS;

END:
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function removes PdiAddress from ImageStore PdiList
 *  Command payload parameters are
 *	- High PdiAddr - Upper 32 bit value of PdiAddr
 *	- Low PdiAddr - Lower 32 bit value of PdiAddr
 *
 * @param	Cmd is pointer to the command structure
 *
 * @return	XST_SUCCESS on success and error code on failure
 *
 *****************************************************************************/
@brief       This function removes PdiAddress from ImageStore PdiList
Command payload parameters are
- High PdiAddr - Upper 32 bit value of PdiAddr
- Low PdiAddr - Lower 32 bit value of PdiAddr

@param       Cmd is pointer to the command structure

@return      XST_SUCCESS on success and error code on failure
@brief This function removes PdiAddress from ImageStore PdiList Command payload parameters are - High PdiAddr - Upper 32 bit value of PdiAddr - Low PdiAddr - Lower 32 bit value of PdiAddr @param Cmd is pointer to the command structure @return XST_SUCCESS on success and error code on failure
static int XLoader_RemoveImageStorePdi(XPlmi_Cmd *Cmd)
{
	int Status = XST_FAILURE;
	u64 PdiAddr = (u64)Cmd->Payload[XLOADER_CMD_IMGSTORE_PDIADDR_HIGH_INDEX];
	u8 Index;
	u8 ShiftIdx;
	XLoader_ImageStore *PdiList = XLoader_GetPdiList();
	if (PdiList->Count == 0U) {
		Status = XPlmi_UpdateStatus(XLOADER_ERR_PDI_LIST_EMPTY, 0);
		goto END;
	}
	PdiAddr = ((u64)Cmd->Payload[XLOADER_CMD_IMGSTORE_PDIADDR_LOW_INDEX]) |
			(PdiAddr << 32U);
	for (Index = 0U; Index < PdiList->Count; Index++) {
		if (PdiList->PdiAddr[Index] == PdiAddr) {
			for (ShiftIdx = Index; ShiftIdx < (PdiList->Count - 1U);
				ShiftIdx++) {
				PdiList->PdiAddr[ShiftIdx] =
					PdiList->PdiAddr[ShiftIdx + 1U];
			}
			break;
		}
	}
	if (Index == PdiList->Count) {
		Status = XPlmi_UpdateStatus(
				XLOADER_ERR_PDI_ADDR_NOT_FOUND, 0);
		goto END;
	}
	PdiList->Count--;
	if (PdiList->Count == 0U) {
		Status = XLoader_DdrRelease();
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	Status = XST_SUCCESS;
END:
	return Status;
}
static int XLoader_RemoveImageStorePdi ( XPlmi_Cmd * Cmd ) { int Status = XST_FAILURE ; u64 PdiAddr = ( u64 ) Cmd -> Payload [ XLOADER_CMD_IMGSTORE_PDIADDR_HIGH_INDEX ] ; u8 Index ; u8 ShiftIdx ; XLoader_ImageStore * PdiList = XLoader_GetPdiList ( ) ; if ( PdiList -> Count == 0U ) { Status = XPlmi_UpdateStatus ( XLOADER_ERR_PDI_LIST_EMPTY , 0 ) ; goto END ; } PdiAddr = ( ( u64 ) Cmd -> Payload [ XLOADER_CMD_IMGSTORE_PDIADDR_LOW_INDEX ] ) | ( PdiAddr << 32U ) ; for ( Index = 0U ; Index < PdiList -> Count ; Index ++ ) { if ( PdiList -> PdiAddr [ Index ] == PdiAddr ) { for ( ShiftIdx = Index ; ShiftIdx < ( PdiList -> Count - 1U ) ; ShiftIdx ++ ) { PdiList -> PdiAddr [ ShiftIdx ] = PdiList -> PdiAddr [ ShiftIdx + 1U ] ; } break ; } } if ( Index == PdiList -> Count ) { Status = XPlmi_UpdateStatus ( XLOADER_ERR_PDI_ADDR_NOT_FOUND , 0 ) ; goto END ; } PdiList -> Count -- ; if ( PdiList -> Count == 0U ) { Status = XLoader_DdrRelease ( ) ; if ( Status != XST_SUCCESS ) { goto END ; } } Status = XST_SUCCESS ; END : return Status ; }
@brief       This function removes PdiAddress from ImageStore PdiList
  Command payload parameters are
      - High PdiAddr - Upper 32 bit value of PdiAddr
      - Low PdiAddr - Lower 32 bit value of PdiAddr
@brief This function removes PdiAddress from ImageStore PdiList Command payload parameters are - High PdiAddr - Upper 32 bit value of PdiAddr - Low PdiAddr - Lower 32 bit value of PdiAddr
/* If PdiAddr matches with any entry in the List, remove it */