/*
 * Function definition: ixNpeDlLoadedImageFunctionalityGet
 */
PUBLIC IX_STATUS
ixNpeDlLoadedImageFunctionalityGet (IxNpeDlNpeId npeId,
                                    UINT8 *functionalityId)
{
    /* Check input parameters */
    if ((npeId >= IX_NPEDL_NPEID_MAX) || (npeId < 0))
    {
        IX_NPEDL_ERROR_REPORT ("ixNpeDlLoadedImageFunctionalityGet "
                               "- invalid parameter\n");
        return IX_NPEDL_PARAM_ERR;
    }
    if (functionalityId == NULL)
    {
        IX_NPEDL_ERROR_REPORT ("ixNpeDlLoadedImageFunctionalityGet "
                               "- invalid parameter\n");
        return IX_NPEDL_PARAM_ERR;
    }

    if (ixNpeDlNpeState[npeId].validImage)
    {
        *functionalityId = ixNpeDlNpeState[npeId].imageId.functionalityId;
        return IX_SUCCESS;
    }
    else
    {
        return IX_FAIL;
    }
}
/*
 * Function definition: ixNpeDlImageMgrImageLocate
 *
 * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
 * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
 */
IX_STATUS
ixNpeDlImageMgrImageLocate (
    IxNpeDlImageId *imageId,
    UINT32 **imagePtr,
    UINT32 *imageSize)
{
    UINT32 imageOffset;
    UINT32 rawImageId;
    IxNpeDlImageId formattedImageId;
    /* used to index image entries in image library header */
    UINT32 imageCount = 0;   
    IX_STATUS status = IX_FAIL;
    IxNpeDlImageMgrImageLibraryHeader *header;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
		     "Entering ixNpeDlImageMgrImageLocate\n");

    header = (IxNpeDlImageMgrImageLibraryHeader *) IxNpeMicroCodeImageLibrary;

    if (ixNpeDlImageMgrSignatureCheck (IxNpeMicroCodeImageLibrary))
    {
	/* for each image entry in the image library header ... */
	while (header->entry[imageCount].eohMarker !=
	       IX_NPEDL_IMAGEMGR_END_OF_HEADER)
	{
	    rawImageId = header->entry[imageCount].image.id;
	    ixNpeDlImageMgrImageIdFormat (rawImageId, &formattedImageId);
	    /* if a match for imageId is found in the image library header... */
	    if (ixNpeDlImageMgrImageIdCompare (imageId, &formattedImageId))
	    {
		/*
		 * get pointer to the image in the image library using offset from
		 * 1st word in image library
		 */
		imageOffset = header->entry[imageCount].image.offset;
		*imagePtr = &IxNpeMicroCodeImageLibrary[imageOffset];
		/* get the image size */
		*imageSize = header->entry[imageCount].image.size;
		status = IX_SUCCESS;
		break;
	    }
	    imageCount++;
	}
	if (status != IX_SUCCESS)
	{
	    IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageLocate: "
				   "imageId not found in image library header\n");
	    ixNpeDlImageMgrStats.imageIdNotFound++;
	}
    }
    else
    {
	IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageLocate: "
			       "invalid signature in image library\n");
    }

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
		     "Exiting ixNpeDlImageMgrImageLocate: status = %d\n", status);
    return status;
}
/*
 * Function definition: ixNpeDlImageMgrLatestImageExtract
 *
 * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
 * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
 */
IX_STATUS
ixNpeDlImageMgrLatestImageExtract (IxNpeDlImageId *imageId)
{
    UINT32 imageCount = 0; 
    UINT32 rawImageId;
    IxNpeDlImageId formattedImageId;
    IX_STATUS status = IX_FAIL;
    IxNpeDlImageMgrImageLibraryHeader *header;
    
    
    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
		     "Entering ixNpeDlImageMgrLatestImageExtract\n");
		     
    header = (IxNpeDlImageMgrImageLibraryHeader *) IxNpeMicroCodeImageLibrary;
    
    if (ixNpeDlImageMgrSignatureCheck (IxNpeMicroCodeImageLibrary))
    {
	/* for each image entry in the image library header ... */
	while (header->entry[imageCount].eohMarker !=
	       IX_NPEDL_IMAGEMGR_END_OF_HEADER)
	{
	    rawImageId = header->entry[imageCount].image.id;
	    ixNpeDlImageMgrImageIdFormat (rawImageId, &formattedImageId);
	    /* 
	     * if a match for the npe Id and functionality Id of the imageId is
	     *  found in the image library header... 
	     */
            if(ixNpeDlImageMgrNpeFunctionIdCompare(imageId, &formattedImageId))
            {
                if(imageId->major <= formattedImageId.major)
                {
                    if(imageId->minor < formattedImageId.minor)
                    {
                        imageId->minor = formattedImageId.minor;
                    }
                    imageId->major = formattedImageId.major;
                }
                status = IX_SUCCESS;
            }
            imageCount++;
	}
	if (status != IX_SUCCESS)
	{
	    IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrLatestImageExtract: "
				   "imageId not found in image library header\n");
	    ixNpeDlImageMgrStats.imageIdNotFound++;
	}
    }
    else
    {
	IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrLatestImageGet: "
			       "invalid signature in image library\n");
    }

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
		     "Exiting ixNpeDlImageMgrLatestImageGet: status = %d\n", status);
    return status;
}
Esempio n. 4
0
/*
 * Function definition: ixNpeDlImageMgrImageFind
 */
IX_STATUS
ixNpeDlImageMgrImageFind (
    UINT32 *imageLibrary,
    UINT32 imageId,
    UINT32 **imagePtr,
    UINT32 *imageSize)
{
    IxNpeDlImageMgrImageHeader *image;
    UINT32 offset = 0;

    /* If user didn't specify a library to use, use the default
     * one from IxNpeMicrocode.h
     */
    if (imageLibrary == NULL)
    {
#ifdef IX_NPEDL_READ_MICROCODE_FROM_FILE
	if (ixNpeMicrocode_binaryArray == NULL)
        {
	    printk (KERN_ERR "ixp400.o:  ERROR, no Microcode found in memory\n");
	    return IX_FAIL;
	}
	else
	{
	    imageLibrary = ixNpeMicrocode_binaryArray;
	}
#else
	imageLibrary = IxNpeMicroCodeImageLibrary;
#endif /* IX_NPEDL_READ_MICROCODE_FROM_FILE */
    }

    while (*(imageLibrary+offset) == NPE_IMAGE_MARKER)
    {
        image = (IxNpeDlImageMgrImageHeader *)(imageLibrary+offset);
        offset += sizeof(IxNpeDlImageMgrImageHeader)/sizeof(UINT32);
        
        if (image->id == imageId)
        {
            *imagePtr = imageLibrary + offset;
            *imageSize = image->size;
            return IX_SUCCESS;
        }
        /* 2 consecutive NPE_IMAGE_MARKER's indicates end of library */
        else if (image->id == NPE_IMAGE_MARKER)
        {
	    IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageFind: "
				   "imageId not found in image library header\n");
	    ixNpeDlImageMgrStats.imageIdNotFound++;
            /* reached end of library, image not found */
            return IX_FAIL;
        }
        offset += image->size;
    }

    /* If we get here, our image library may be corrupted */
    IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageFind: "
                           "image library format may be invalid or corrupted\n");
    return IX_FAIL;
}
/*
 * Function definition: ixNpeDlAvailableImagesListGet
 */
PUBLIC IX_STATUS
ixNpeDlAvailableImagesListGet (IxNpeDlImageId *imageIdListPtr,
                               UINT32 *listSizePtr)
{
    IX_STATUS status;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Entering ixNpeDlAvailableImagesListGet\n");

    /* Check input parameters */
    if ((imageIdListPtr == NULL) || (listSizePtr == NULL))
    {
        status = IX_NPEDL_PARAM_ERR;
        IX_NPEDL_ERROR_REPORT ("ixNpeDlAvailableImagesListGet - "
                               "invalid parameter\n");
    }
    else
    {
        /* Call ImageMgr to get list of images listed in Image Library Header */
        status = ixNpeDlImageMgrImageListExtract (imageIdListPtr,
                                                  listSizePtr);
    } /* end of if-else(imageIdListPtr) */

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Exiting ixNpeDlAvailableImagesListGet : status = %d\n",
                     status);
    return status;
}
/*
 * Function definition: ixNpeDlAvailableImagesCountGet
 */
PUBLIC IX_STATUS
ixNpeDlAvailableImagesCountGet (UINT32 *numImagesPtr)
{
    IX_STATUS status;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Entering ixNpeDlAvailableImagesCountGet\n");

    /* Check input parameters */
    if (numImagesPtr == NULL)
    {
        status = IX_NPEDL_PARAM_ERR;
        IX_NPEDL_ERROR_REPORT ("ixNpeDlAvailableImagesCountGet - "
                               "invalid parameter\n");
    }
    else
    {
        /*
         * Use ImageMgr module to get no. of images listed in Image Library Header.
         * If NULL is passed as imageListPtr parameter to following function,
         * it will only fill number of images into numImagesPtr
         */
        status = ixNpeDlImageMgrImageListExtract (NULL, numImagesPtr);
    } /* end of if-else(numImagesPtr) */

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Exiting ixNpeDlAvailableImagesCountGet : "
                     "status = %d\n", status);
    return status;
}
/*
 * Function definition: ixNpeDlImageMgrMicrocodeImageLibraryOverride
 *
 * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
 * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
 */
IX_STATUS
ixNpeDlImageMgrMicrocodeImageLibraryOverride (
    UINT32 *clientImageLibrary)
{
    IX_STATUS status = IX_SUCCESS;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, 
		     "Entering ixNpeDlImageMgrMicrocodeImageLibraryOverride\n");

    if (ixNpeDlImageMgrSignatureCheck (clientImageLibrary))
    {
	IxNpeMicroCodeImageLibrary = clientImageLibrary;
    }
    else
    {
	IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrMicrocodeImageLibraryOverride: "
			       "Client-supplied image has invalid signature\n");
	status = IX_FAIL;
    }

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, 
		     "Exiting ixNpeDlImageMgrMicrocodeImageLibraryOverride: status = %d\n",
		     status);
    return status;
}
Esempio n. 8
0
/*
 * Function definition: ixNpeDlNpeMgrNpeStop
 */
IX_STATUS
ixNpeDlNpeMgrNpeStop (
    IxNpeDlNpeId npeId)
{
    UINT32    npeBaseAddress;
    IX_STATUS status = IX_SUCCESS;
    
    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
		     "Entering ixNpeDlNpeMgrNpeStop\n");
    
    /* get base memory address of NPE from npeId */
    npeBaseAddress = ixNpeDlNpeMgrBaseAddressGet (npeId);

    /* stop NPE execution by issuing command through EXCTL register on NPE */
    ixNpeDlNpeMgrCommandIssue (npeBaseAddress, IX_NPEDL_EXCTL_CMD_NPE_STOP);

    /* verify that NPE Stop was successful */
    if (! ixNpeDlNpeMgrBitsSetCheck (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXCTL,
				     IX_NPEDL_EXCTL_STATUS_STOP))
    {
	IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrNpeStop: "
			       "failed to stop NPE execution\n");
	status = IX_FAIL;
    }

    ixNpeDlNpeMgrStats.npeStops++;
    
    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
		     "Exiting ixNpeDlNpeMgrNpeStop : status = %d\n", status);
    return status;
}
/*
 * Function definition: ixNpeDlMicrocodeImageLibraryOverride
 */
PUBLIC IX_STATUS
ixNpeDlMicrocodeImageLibraryOverride (UINT32 *clientImageLibrary)
{
    IX_STATUS status = IX_SUCCESS;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Entering ixNpeDlMicrocodeImageLibraryOverride\n");

    if (clientImageLibrary == NULL)
    {
        status = IX_NPEDL_PARAM_ERR;
        IX_NPEDL_ERROR_REPORT ("ixNpeDlMicrocodeImageLibraryOverride - "
                               "invalid parameter\n");
    }
    else
    {
        status = ixNpeDlImageMgrMicrocodeImageLibraryOverride (clientImageLibrary);
        if (status != IX_SUCCESS)
        {
            status = IX_FAIL;
        }
    } /* end of if-else(clientImageLibrary) */

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Exiting ixNpeDlMicrocodeImageLibraryOverride : "
                     "status = %d\n", status);
    return status;
}
Esempio n. 10
0
/*
 * Function definition: ixNpeDlCustomImageNpeInitAndStart
 */
PUBLIC IX_STATUS
ixNpeDlCustomImageNpeInitAndStart (UINT32 *imageLibrary,
                                   UINT32 imageId)
{
    IX_STATUS status;

    if (imageLibrary == NULL)
    {
        status = IX_NPEDL_PARAM_ERR;
        IX_NPEDL_ERROR_REPORT ("ixNpeDlCustomImageNpeInitAndStart "
                               "- invalid parameter\n");
    }
    else
    {
        status = ixNpeDlNpeInitAndStartInternal (imageLibrary, imageId);
    } /* end of if-else(imageLibrary) */

    return status;
}
Esempio n. 11
0
/*
 * Function definition: ixNpeDlNpeMgrNpeStart
 */
IX_STATUS
ixNpeDlNpeMgrNpeStart (
    IxNpeDlNpeId npeId)
{
    UINT32    npeBaseAddress;
    UINT32    ecsRegVal;
    BOOL      npeRunning;
    IX_STATUS status = IX_SUCCESS;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, 
		     "Entering ixNpeDlNpeMgrNpeStart\n");

    /* get base memory address of NPE from npeId */
    npeBaseAddress = ixNpeDlNpeMgrBaseAddressGet (npeId);

    /*
     * ensure only Background Context Stack Level is Active by turning off
     * the Active bit in each of the other Executing Context Stack levels
     */
    ecsRegVal = ixNpeDlNpeMgrExecAccRegRead (npeBaseAddress,
					     IX_NPEDL_ECS_PRI_1_CTXT_REG_0);
    ecsRegVal &= ~IX_NPEDL_MASK_ECS_REG_0_ACTIVE;
    ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, IX_NPEDL_ECS_PRI_1_CTXT_REG_0,
				  ecsRegVal);

    ecsRegVal = ixNpeDlNpeMgrExecAccRegRead (npeBaseAddress,
					     IX_NPEDL_ECS_PRI_2_CTXT_REG_0);
    ecsRegVal &= ~IX_NPEDL_MASK_ECS_REG_0_ACTIVE;
    ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, IX_NPEDL_ECS_PRI_2_CTXT_REG_0,
				  ecsRegVal);

    ecsRegVal = ixNpeDlNpeMgrExecAccRegRead (npeBaseAddress,
					     IX_NPEDL_ECS_DBG_CTXT_REG_0);
    ecsRegVal &= ~IX_NPEDL_MASK_ECS_REG_0_ACTIVE;
    ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, IX_NPEDL_ECS_DBG_CTXT_REG_0,
				  ecsRegVal);
    
    /* clear the pipeline */
    ixNpeDlNpeMgrCommandIssue (npeBaseAddress, IX_NPEDL_EXCTL_CMD_NPE_CLR_PIPE);
    
    /* start NPE execution by issuing command through EXCTL register on NPE */
    ixNpeDlNpeMgrCommandIssue (npeBaseAddress, IX_NPEDL_EXCTL_CMD_NPE_START);

    /*
     * check execution status of NPE to verify NPE Start operation was
     * successful
     */
    npeRunning = ixNpeDlNpeMgrBitsSetCheck (npeBaseAddress,
					    IX_NPEDL_REG_OFFSET_EXCTL,
					    IX_NPEDL_EXCTL_STATUS_RUN);
    if (npeRunning)
    {
	ixNpeDlNpeMgrStats.npeStarts++;
    }
    else
    {
	IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrNpeStart: "
			       "failed to start NPE execution\n");
	status = IX_FAIL;
    }

    
    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
		     "Exiting ixNpeDlNpeMgrNpeStart : status = %d\n", status);
    return status;
}
Esempio n. 12
0
/*
 * Function definition: ixNpeDlNpeMgrStateInfoLoad
 */
PRIVATE IX_STATUS
ixNpeDlNpeMgrStateInfoLoad (
    UINT32 npeBaseAddress,
    IxNpeDlNpeMgrStateInfoBlock *blockPtr,
    BOOL verify)
{
    UINT32 blockSize;
    UINT32 ctxtRegAddrInfo; 
    UINT32 ctxtRegVal;
    IxNpeDlCtxtRegNum ctxtReg; /* identifies Context Store reg (0-3) */
    UINT32 ctxtNum;            /* identifies Context number (0-16)   */
    UINT32 i;
    IX_STATUS status = IX_SUCCESS;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
		     "Entering ixNpeDlNpeMgrStateInfoLoad\n");

    /* block size contains number of words of state-info in block */
    blockSize = blockPtr->size;
    
    ixNpeDlNpeMgrDebugInstructionPreExec (npeBaseAddress);

    /* for each state-info context register entry in block */
    for (i = 0; i < (blockSize/IX_NPEDL_STATE_INFO_ENTRY_SIZE); i++)
    {
	/* each state-info entry is 2 words (address, value) in length */
	ctxtRegAddrInfo = (blockPtr->ctxtRegEntry[i]).addressInfo;
	ctxtRegVal      = (blockPtr->ctxtRegEntry[i]).value;
	
	ctxtReg = (ctxtRegAddrInfo & IX_NPEDL_MASK_STATE_ADDR_CTXT_REG);
	ctxtNum = (ctxtRegAddrInfo & IX_NPEDL_MASK_STATE_ADDR_CTXT_NUM) >> 
	    IX_NPEDL_OFFSET_STATE_ADDR_CTXT_NUM;
	
	/* error-check Context Register No. and Context Number values  */
	/* NOTE that there is no STEVT register for Context 0 */
	if ((ctxtReg < 0) ||
	    (ctxtReg >= IX_NPEDL_CTXT_REG_MAX) ||
	    (ctxtNum > IX_NPEDL_CTXT_NUM_MAX) ||
	    ((ctxtNum == 0) && (ctxtReg == IX_NPEDL_CTXT_REG_STEVT)))
	{
	    IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrStateInfoLoad: "
				   "invalid Context Register Address\n");
	    status = IX_NPEDL_CRITICAL_MICROCODE_ERR;
	    ixNpeDlNpeMgrStats.criticalMicrocodeErrors++;
	    break;   /* abort download */
	}    
	
	status = ixNpeDlNpeMgrCtxtRegWrite (npeBaseAddress, ctxtNum, ctxtReg,
					    ctxtRegVal, verify);
	if (status != IX_SUCCESS)
	{
	    IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrStateInfoLoad: "
				   "write of state-info to NPE failed\n");
	    status = IX_NPEDL_CRITICAL_NPE_ERR;
	    ixNpeDlNpeMgrStats.criticalNpeErrors++;
	    break;   /* abort download */
	}
    }/* loop: for each context reg entry in State Info block */
    
    ixNpeDlNpeMgrDebugInstructionPostExec (npeBaseAddress);

    if (status == IX_SUCCESS)
    {
	ixNpeDlNpeMgrStats.stateInfoBlocksLoaded++;
    }

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
		     "Exiting ixNpeDlNpeMgrStateInfoLoad : status = %d\n",
		     status);
    return status;
}
Esempio n. 13
0
/*
 * Function definition: ixNpeDlNpeMgrMemLoad
 */
PRIVATE IX_STATUS
ixNpeDlNpeMgrMemLoad (
    IxNpeDlNpeId npeId,
    UINT32 npeBaseAddress,
    IxNpeDlNpeMgrCodeBlock *blockPtr,
    BOOL verify,
    IxNpeDlNpeMemType npeMemType)
{
    UINT32 npeMemAddress;
    UINT32 blockSize;
    UINT32 memSize = 0;
    IxNpeDlNpeMgrMemWrite memWriteFunc = NULL;
    UINT32 localIndex = 0;
    IX_STATUS status = IX_SUCCESS;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
		     "Entering ixNpeDlNpeMgrMemLoad\n");
    
    /*
     * select NPE EXCTL reg read/write commands depending on memory
     * type (instruction/data) to be accessed
     */
    if (npeMemType == IX_NPEDL_MEM_TYPE_INSTRUCTION)
    {
	memSize = ixNpeDlNpeInfo[npeId].insMemSize;
	memWriteFunc = (IxNpeDlNpeMgrMemWrite) ixNpeDlNpeMgrInsMemWrite;
    }
    else if (npeMemType == IX_NPEDL_MEM_TYPE_DATA)
    {
	memSize = ixNpeDlNpeInfo[npeId].dataMemSize;
	memWriteFunc = (IxNpeDlNpeMgrMemWrite) ixNpeDlNpeMgrDataMemWrite;
    }

    /*
     * NPE memory is loaded contiguously from each block, so only address
     * of 1st word in block is needed
     */
    npeMemAddress = blockPtr->npeMemAddress;
    /* number of words of instruction/data microcode in block to download */
    blockSize = blockPtr->size;
    if ((npeMemAddress + blockSize) > memSize)
    {
	IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrMemLoad: "
			       "Block size too big for NPE memory\n");
	status = IX_NPEDL_CRITICAL_MICROCODE_ERR;
	ixNpeDlNpeMgrStats.criticalMicrocodeErrors++;
    }
    else
    {
	for (localIndex = 0; localIndex < blockSize; localIndex++)
	{
	    status = memWriteFunc (npeBaseAddress, npeMemAddress,
				   blockPtr->data[localIndex], verify);

	    if (status != IX_SUCCESS)
	    {
		IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrMemLoad: "
				       "write to NPE memory failed\n");
		status = IX_NPEDL_CRITICAL_NPE_ERR;
		ixNpeDlNpeMgrStats.criticalNpeErrors++;
		break;   /* abort download */
	    }
	    /* increment target (word)address in NPE memory */
	    npeMemAddress++;   
	}
    }/* condition: block size will fit in NPE memory */

    if (status == IX_SUCCESS)
    {
	if (npeMemType == IX_NPEDL_MEM_TYPE_INSTRUCTION)
	{
	    ixNpeDlNpeMgrStats.instructionBlocksLoaded++;
	}
	else if (npeMemType == IX_NPEDL_MEM_TYPE_DATA)
	{
	    ixNpeDlNpeMgrStats.dataBlocksLoaded++;
	}
    }

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
		     "Exiting ixNpeDlNpeMgrMemLoad : status = %d\n", status);
    return status;
}
Esempio n. 14
0
/*
 * Function definition: ixNpeDlNpeMgrImageLoad
 */
IX_STATUS
ixNpeDlNpeMgrImageLoad (
    IxNpeDlNpeId npeId,
    UINT32 *imageCodePtr,
    BOOL verify)
{
    UINT32 npeBaseAddress;
    IxNpeDlNpeMgrDownloadMap *downloadMap;
    UINT32 *blockPtr;
    UINT32 mapIndex = 0;
    IX_STATUS status = IX_SUCCESS;
    
    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
		     "Entering ixNpeDlNpeMgrImageLoad\n");

    /* get base memory address of NPE from npeId */
    npeBaseAddress = ixNpeDlNpeMgrBaseAddressGet (npeId);

    /* check execution status of NPE to verify NPE Stop was successful */
    if (!ixNpeDlNpeMgrBitsSetCheck (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXCTL,
				    IX_NPEDL_EXCTL_STATUS_STOP))
    {
	IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrImageDownload - "
			       "NPE was not stopped before download\n");
	status = IX_FAIL;
    }
    else
    {
	/*
	 * Read Download Map, checking each block type and calling
	 * appropriate function to perform download 
	 */
	downloadMap = (IxNpeDlNpeMgrDownloadMap *) imageCodePtr;
	while ((downloadMap->entry[mapIndex].eodmMarker != 
		IX_NPEDL_END_OF_DOWNLOAD_MAP)
	       && (status == IX_SUCCESS))
	{
	    /* calculate pointer to block to be downloaded */
	    blockPtr = imageCodePtr +
		downloadMap->entry[mapIndex].block.offset;

	    switch (downloadMap->entry[mapIndex].block.type)
	    {
	    case IX_NPEDL_BLOCK_TYPE_INSTRUCTION:
		status = ixNpeDlNpeMgrMemLoad (npeId, npeBaseAddress, 
					     (IxNpeDlNpeMgrCodeBlock *)blockPtr,
					       verify,
					       IX_NPEDL_MEM_TYPE_INSTRUCTION);
		break;
	    case IX_NPEDL_BLOCK_TYPE_DATA:
		status = ixNpeDlNpeMgrMemLoad (npeId, npeBaseAddress,
                                             (IxNpeDlNpeMgrCodeBlock *)blockPtr,
					       verify, IX_NPEDL_MEM_TYPE_DATA);
		break;
	    case IX_NPEDL_BLOCK_TYPE_STATE:
		status = ixNpeDlNpeMgrStateInfoLoad (npeBaseAddress,
				       (IxNpeDlNpeMgrStateInfoBlock *) blockPtr,
						     verify);
		break;
	    default:
		IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrImageLoad: "
				       "unknown block type in download map\n");
		status = IX_NPEDL_CRITICAL_MICROCODE_ERR;
		ixNpeDlNpeMgrStats.criticalMicrocodeErrors++;
		break;
	    }
	    mapIndex++;
	}/* loop: for each entry in download map, while status == SUCCESS */
    }/* condition: NPE stopped before attempting download */
    
    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, 
		     "Exiting ixNpeDlNpeMgrImageLoad : status = %d\n",
		     status);
    return status;
}
Esempio n. 15
0
/*
 * Function definition: ixNpeDlLoadedImageGet
 */
PUBLIC IX_STATUS
ixNpeDlLoadedImageGet (IxNpeDlNpeId npeId,
                       IxNpeDlImageId *imageIdPtr)
{
    IX_STATUS status = IX_SUCCESS;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Entering ixNpeDlLoadedImageGet\n");

    /* Check input parameters */
    if ((npeId >= IX_NPEDL_NPEID_MAX) || (npeId < 0) || (imageIdPtr == NULL))
    {
        status = IX_NPEDL_PARAM_ERR;
        IX_NPEDL_ERROR_REPORT ("ixNpeDlLoadedImageGet - invalid parameter\n");
    }
    else
    {

         /* If not IXP42X A0 stepping, proceed to check for existence of npe's */
         if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
	      (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
	     || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
        {
            if (npeId == IX_NPEDL_NPEID_NPEA &&
                (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA) ==
                 IX_FEATURE_CTRL_COMPONENT_DISABLED))
            {
                IX_NPEDL_WARNING_REPORT("Warning: the NPE A component you specified does"
                                        " not exist\n");
                return IX_SUCCESS;
            } /* end of if(npeId) */

            if (npeId == IX_NPEDL_NPEID_NPEB &&
                (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB) ==
                 IX_FEATURE_CTRL_COMPONENT_DISABLED))
            {
                IX_NPEDL_WARNING_REPORT("Warning: the NPE B component you specified does"
                                        " not exist\n");
                return IX_SUCCESS;
            } /* end of if(npeId) */

            if (npeId == IX_NPEDL_NPEID_NPEC &&
                (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC) ==
                 IX_FEATURE_CTRL_COMPONENT_DISABLED))
            {
                IX_NPEDL_WARNING_REPORT("Warning: the NPE C component you specified does"
                                        " not exist\n");
                return IX_SUCCESS;
            } /* end of if(npeId) */
        } /* end of if not IXP42x-A0 silicon */

        if (ixNpeDlNpeState[npeId].validImage)
        {
            /* use npeId to get imageId from list of currently loaded
               images */
            *imageIdPtr = ixNpeDlNpeState[npeId].imageId;
        }
        else
        {
            status = IX_FAIL;
        } /* end of if-else(ixNpeDlNpeState) */
    } /* end of if-else(npeId) */

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Exiting ixNpeDlLoadedImageGet : status = %d\n",
                     status);
    return status;
}
Esempio n. 16
0
/*
 * Function definition: ixNpeDlLatestImageGet
 */
PUBLIC IX_STATUS
ixNpeDlLatestImageGet (
    IxNpeDlNpeId npeId,
    IxNpeDlFunctionalityId functionalityId,
    IxNpeDlImageId *imageIdPtr)
{
    IX_STATUS status;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Entering ixNpeDlLatestImageGet\n");

    /* Check input parameters */
    if ((npeId >= IX_NPEDL_NPEID_MAX) ||
        (npeId < 0) ||
        (imageIdPtr == NULL))
    {
        status = IX_NPEDL_PARAM_ERR;
        IX_NPEDL_ERROR_REPORT ("ixNpeDlLatestImageGet - "
                               "invalid parameter\n");
    } /* end of if(npeId) */
    else
    {

	/* If not IXP42X A0 stepping, proceed to check for existence of npe's */
	if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
	     (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
	    || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
        {
            if (npeId == IX_NPEDL_NPEID_NPEA &&
                (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA) ==
                 IX_FEATURE_CTRL_COMPONENT_DISABLED))
            {
                IX_NPEDL_WARNING_REPORT("Warning: the NPE A component you specified does"
                                        " not exist\n");
                return IX_SUCCESS;
            } /* end of if(npeId) */

            if (npeId == IX_NPEDL_NPEID_NPEB &&
                (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB) ==
                 IX_FEATURE_CTRL_COMPONENT_DISABLED))
            {
                IX_NPEDL_WARNING_REPORT("Warning: the NPE B component you specified does"
                                        " not exist\n");
                return IX_SUCCESS;
            } /* end of if(npeId) */

            if (npeId == IX_NPEDL_NPEID_NPEC &&
                (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC) ==
                 IX_FEATURE_CTRL_COMPONENT_DISABLED))
            {
                IX_NPEDL_WARNING_REPORT("Warning: the NPE C component you specified does"
                                        " not exist\n");
                return IX_SUCCESS;
            } /* end of if(npeId) */
        } /* end of if not IXP42x-A0 silicon */

        imageIdPtr->npeId = npeId;
        imageIdPtr->functionalityId = functionalityId;
        imageIdPtr->major = IMAGEID_MAJOR_NUMBER_DEFAULT;
        imageIdPtr->minor = IMAGEID_MINOR_NUMBER_DEFAULT;
        /* Call ImageMgr to get list of images listed in Image Library Header */
        status = ixNpeDlImageMgrLatestImageExtract(imageIdPtr);
    } /* end of if-else(npeId) */

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Exiting ixNpeDlLatestImageGet : status = %d\n",
                     status);

    return status;
}
Esempio n. 17
0
/*
 * Function definition: ixNpeDlNpeExecutionStop
 */
PUBLIC IX_STATUS
ixNpeDlNpeExecutionStop (IxNpeDlNpeId npeId)
{
    IX_STATUS status = IX_SUCCESS;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Entering ixNpeDlNpeExecutionStop\n");

    /* Ensure initialisation has been completed */
    ixNpeDlNpeMgrInit();

    /* If not IXP42X A0 stepping, proceed to check for existence of npe's */
    if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
	 (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
	|| (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
    {
        /*
         * Check whether NPE is present
         */
        if (IX_NPEDL_NPEID_NPEA == npeId)
        {
            /* Check whether NPE A is present */
            if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA)==
                IX_FEATURE_CTRL_COMPONENT_DISABLED)
            {
                /* NPE A does not present */
                IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStop - Warning:NPEA does not present.\n");
                return IX_SUCCESS;
            }
        } /* end of if(IX_NPEDL_NPEID_NPEA) */
        else if (IX_NPEDL_NPEID_NPEB == npeId)
        {
            /* Check whether NPE B is present */
            if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)==
                IX_FEATURE_CTRL_COMPONENT_DISABLED)
            {
                /* NPE B does not present */
                IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStop - Warning:NPEB does not present.\n");
                return IX_SUCCESS;
            }
        } /* end of elseif(IX_NPEDL_NPEID_NPEB) */
        else if (IX_NPEDL_NPEID_NPEC == npeId)
        {
            /* Check whether NPE C is present */
            if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)==
                IX_FEATURE_CTRL_COMPONENT_DISABLED)
            {
                /* NPE C does not present */
                IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStop - Warning:NPEC does not present.\n");
                return IX_SUCCESS;
            }
        } /* end of elseif(IX_NPEDL_NPEID_NPEC) */
        else
        {
            /* Invalid NPE ID */
            IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeExecutionStop - invalid Npe ID\n");
            status = IX_NPEDL_PARAM_ERR;
        } /* end of if-else(IX_NPEDL_NPEID_NPEC) */
    } /* end of if not IXP42X-AO Silicon */

    if (status == IX_SUCCESS)
    {
        /* call NpeMgr function to stop the NPE */
        status = ixNpeDlNpeMgrNpeStop (npeId);
    }

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Exiting ixNpeDlNpeExecutionStop : status = %d\n",
                     status);

    if (IX_SUCCESS == status)
    {
        /* Indicate NPE has been stopped */
        ixNpeDlNpeStarted[npeId] = FALSE ;
    }

    return status;
}
/*
 * Function definition: ixNpeDlImageMgrImageListExtract
 *
 * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
 * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
 */
IX_STATUS
ixNpeDlImageMgrImageListExtract (
    IxNpeDlImageId *imageListPtr,
    UINT32 *numImages)
{
    UINT32 rawImageId;
    IxNpeDlImageId formattedImageId;
    IX_STATUS status = IX_SUCCESS;
    UINT32 imageCount = 0;
    IxNpeDlImageMgrImageLibraryHeader *header;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, 
		     "Entering ixNpeDlImageMgrImageListExtract\n");

    header = (IxNpeDlImageMgrImageLibraryHeader *) IxNpeMicroCodeImageLibrary;

    if (ixNpeDlImageMgrSignatureCheck (IxNpeMicroCodeImageLibrary))
    {
	/* for each image entry in the image header ... */
	while (header->entry[imageCount].eohMarker !=
	       IX_NPEDL_IMAGEMGR_END_OF_HEADER)
	{
	    /*
	     * if the image list container from calling function has capacity,
	     * add the image id to the list 
	     */
	    if ((imageListPtr != NULL) && (imageCount < *numImages))
	    {
		rawImageId = header->entry[imageCount].image.id;
	        ixNpeDlImageMgrImageIdFormat (rawImageId, &formattedImageId);
		imageListPtr[imageCount] = formattedImageId;
	    }
	    /* imageCount reflects no. of image entries in image library header */
	    imageCount++;  
	}
	
	/*
	 * if image list container from calling function was too small to
	 * contain all image ids in the header, set return status to FAIL
	 */
	if ((imageListPtr != NULL) && (imageCount > *numImages))
	{
	    status = IX_FAIL;
	    IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageListExtract: "
				   "number of Ids found exceeds list capacity\n");
	    ixNpeDlImageMgrStats.imageIdListOverflow++;
	}
	/* return number of image ids found in image library header */
	*numImages = imageCount;  
    }
    else
    {
	status = IX_FAIL;
	IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageListExtract: "
			       "invalid signature in image\n");
    }
    
    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, 
		     "Exiting ixNpeDlImageMgrImageListExtract: status = %d\n",
		     status);
    return status;
}
Esempio n. 19
0
/*
 * Function definition: ixNpeDlImageDownload
 */
PUBLIC IX_STATUS
ixNpeDlImageDownload (IxNpeDlImageId *imageIdPtr,
                      BOOL verify)
{
    UINT32        imageSize;
    UINT32       *imageCodePtr  = NULL;
    IX_STATUS     status;
    IxNpeDlNpeId  npeId           = imageIdPtr->npeId;

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Entering ixNpeDlImageDownload\n");

    ixNpeDlStats.attemptedDownloads++;

    /* Check input parameters */
    if ((npeId >= IX_NPEDL_NPEID_MAX) || (npeId < 0))
    {
        status = IX_NPEDL_PARAM_ERR;
        IX_NPEDL_ERROR_REPORT ("ixNpeDlImageDownload - invalid parameter\n");
    }
    else
    {
        /* Ensure initialisation has been completed */
        ixNpeDlNpeMgrInit();

	/* If not IXP42X A0 stepping, proceed to check for existence of npe's */
	if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
	     (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
	    || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
	{
            if (npeId == IX_NPEDL_NPEID_NPEA)
            {
                if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA) ==
                    IX_FEATURE_CTRL_COMPONENT_DISABLED)
                {
                    IX_NPEDL_WARNING_REPORT("Warning: the NPE A component you specified does"
                                            " not exist\n");
                    return IX_SUCCESS;
                }
            } /* end of if(npeId) */
            else if (npeId == IX_NPEDL_NPEID_NPEB)
            {
                if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)==
                    IX_FEATURE_CTRL_COMPONENT_DISABLED)
                {
                    IX_NPEDL_WARNING_REPORT("Warning: the NPE B component you specified"
                                            " does not exist\n");
                    return IX_SUCCESS;
                }
            } /* end of elseif(npeId) */
            else if (npeId == IX_NPEDL_NPEID_NPEC)
            {
                if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)==
                    IX_FEATURE_CTRL_COMPONENT_DISABLED)
                {
                    IX_NPEDL_WARNING_REPORT("Warning: the NPE C component you specified"
                                            " does not exist\n");
                    return IX_SUCCESS;
                }
            } /* end of elseif(npeId) */
        } /* end of if(IX_FEATURE_CTRL_SILICON_TYPE_B0) */ /*End of Silicon Type Check*/

        /* stop and reset the NPE */
        if (IX_SUCCESS != ixNpeDlNpeStopAndReset (npeId))
        {
            IX_NPEDL_ERROR_REPORT ("Failed to stop and reset NPE\n");
            return IX_FAIL;
        }

        /* Locate image */
        status = ixNpeDlImageMgrImageLocate (imageIdPtr, &imageCodePtr,
                                             &imageSize);
        if (IX_SUCCESS == status)
        {
            /*
             * If download was successful, store image Id in list of
             * currently loaded images. If a critical error occured
             * during download, record that the NPE has an invalid image
             */
            status = ixNpeDlNpeMgrImageLoad (npeId, imageCodePtr,
                                             verify);
            if (IX_SUCCESS == status)
            {
                ixNpeDlNpeState[npeId].imageId = *imageIdPtr;
                ixNpeDlNpeState[npeId].validImage = TRUE;
                ixNpeDlStats.successfulDownloads++;

                status =  ixNpeDlNpeExecutionStart (npeId);
            }
            else if ((status == IX_NPEDL_CRITICAL_NPE_ERR) ||
                     (status == IX_NPEDL_CRITICAL_MICROCODE_ERR))
            {
                ixNpeDlNpeState[npeId].imageId = *imageIdPtr;
                ixNpeDlNpeState[npeId].validImage = FALSE;
                ixNpeDlStats.criticalFailDownloads++;
            }
        } /* end of if(IX_SUCCESS) */ /* condition: image located successfully in microcode image */
    } /* end of if-else(npeId) */ /* condition: parameter checks ok */

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Exiting ixNpeDlImageDownload : status = %d\n", status);
    return status;
}
Esempio n. 20
0
/*
 * Function definition: ixNpeDlNpeInitAndStartInternal
 */
PRIVATE IX_STATUS
ixNpeDlNpeInitAndStartInternal (UINT32 *imageLibrary,
                                UINT32 imageId)
{
    UINT32        imageSize;
    UINT32       *imageCodePtr  = NULL;
    IX_STATUS     status;
    IxNpeDlNpeId  npeId = IX_NPEDL_NPEID_FROM_IMAGEID_GET(imageId);
    IxFeatureCtrlDeviceId deviceId = IX_NPEDL_DEVICEID_FROM_IMAGEID_GET(imageId);

    IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Entering ixNpeDlNpeInitAndStartInternal\n");

    ixNpeDlStats.attemptedDownloads++;

    /* Check input parameter device correctness */
    if ((deviceId >= IX_FEATURE_CTRL_DEVICE_TYPE_MAX) ||
        (deviceId < IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X))
    {
        status = IX_NPEDL_PARAM_ERR;
        IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeInitAndStartInternal - "
                               "invalid parameter\n");
    } /* End valid device id checking */

    /* Check input parameters */
    else if ((npeId >= IX_NPEDL_NPEID_MAX) || (npeId < 0))
    {
        status = IX_NPEDL_PARAM_ERR;
        IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeInitAndStartInternal - "
                               "invalid parameter\n");
    }

    else
    {
        /* Ensure initialisation has been completed */
        ixNpeDlNpeMgrInit();

        /* Checking if image being loaded is meant for device that is running.
         * Image is forward compatible. i.e Image built for IXP42X should run
         * on IXP46X but not vice versa.*/
        if (deviceId > (ixFeatureCtrlDeviceRead() & IX_FEATURE_CTRL_DEVICE_TYPE_MASK))
        {
            IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeInitAndStartInternal - "
                                   "Device type mismatch. NPE Image not "
                                   "meant for device in use \n");
            return IX_NPEDL_DEVICE_ERR;
        }/* if statement - matching image device and current device */

	/* If not IXP42X A0 stepping, proceed to check for existence of npe's */
	if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
	     (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
	    || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
        {
            if (npeId == IX_NPEDL_NPEID_NPEA)
            {
                if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA) ==
                    IX_FEATURE_CTRL_COMPONENT_DISABLED)
                {
                    IX_NPEDL_WARNING_REPORT("Warning: the NPE A component you specified does"
                                            " not exist\n");
                    return IX_SUCCESS;
                }
            } /* end of if(npeId) */
            else if (npeId == IX_NPEDL_NPEID_NPEB)
            {
                if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)==
                    IX_FEATURE_CTRL_COMPONENT_DISABLED)
                {
                    IX_NPEDL_WARNING_REPORT("Warning: the NPE B component you specified"
                                            " does not exist\n");
                    return IX_SUCCESS;
                }
            } /* end of elseif(npeId) */
            else if (npeId == IX_NPEDL_NPEID_NPEC)
            {
                if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)==
                    IX_FEATURE_CTRL_COMPONENT_DISABLED)
                {
                    IX_NPEDL_WARNING_REPORT("Warning: the NPE C component you specified"
                                            " does not exist\n");
                    return IX_SUCCESS;
                }
            } /* end of elseif(npeId) */
        } /* end of if not IXP42X-A0 Silicon */

        /* stop and reset the NPE */
        status = ixNpeDlNpeStopAndReset (npeId);
        if (IX_SUCCESS != status)
        {
            IX_NPEDL_ERROR_REPORT ("Failed to stop and reset NPE\n");
            return status;
        }

        /* Locate image */
        status = ixNpeDlImageMgrImageFind (imageLibrary, imageId,
                                           &imageCodePtr, &imageSize);
        if (IX_SUCCESS == status)
        {
            /*
             * If download was successful, store image Id in list of
             * currently loaded images. If a critical error occured
             * during download, record that the NPE has an invalid image
             */
            status = ixNpeDlNpeMgrImageLoad (npeId, imageCodePtr, TRUE);
            if (IX_SUCCESS == status)
            {
                ixNpeDlNpeState[npeId].validImage = TRUE;
                ixNpeDlStats.successfulDownloads++;

                status = ixNpeDlNpeExecutionStart (npeId);
            }
            else if ((status == IX_NPEDL_CRITICAL_NPE_ERR) ||
                     (status == IX_NPEDL_CRITICAL_MICROCODE_ERR))
            {
                ixNpeDlNpeState[npeId].validImage = FALSE;
                ixNpeDlStats.criticalFailDownloads++;
            }

            /* NOTE - The following section of code is here to support
             * a deprecated function ixNpeDlLoadedImageGet().  When that
             * function is removed from the API, this code should be revised.
             */
            ixNpeDlNpeState[npeId].imageId.npeId = npeId;
            ixNpeDlNpeState[npeId].imageId.functionalityId =
                IX_NPEDL_FUNCTIONID_FROM_IMAGEID_GET(imageId);
            ixNpeDlNpeState[npeId].imageId.major =
                IX_NPEDL_MAJOR_FROM_IMAGEID_GET(imageId);
            ixNpeDlNpeState[npeId].imageId.minor =
                IX_NPEDL_MINOR_FROM_IMAGEID_GET(imageId);
        } /* end of if(IX_SUCCESS) */ /* condition: image located successfully in microcode image */
    } /* end of if-else(npeId-deviceId) */ /* condition: parameter checks ok */

    IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
                     "Exiting ixNpeDlNpeInitAndStartInternal : "
                     "status = %d\n", status);
    return status;
}