[U-Boot-Users] [PATCH] IXP: add dynamic microcode addr
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Wed Jan 9 18:49:15 CET 2008
allow to load the microde from flash or ram by download it through
the serial or other.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
diff --git a/README b/README
index 26f93c2..9a8d6d7 100644
--- a/README
+++ b/README
@@ -2685,6 +2685,9 @@ Some configuration options can be set using Environment Variables:
are tried once without success.
Useful on scripts which control the retry operation
themselves.
+
+ npe_ucode - see CONFIG_IXP4XX_NPE_EXT_UCOD
+ if set load address for the npe microcode
tftpsrcport - If this is set, the value is used for TFTP's
UDP source port.
diff --git a/cpu/ixp/npe/IxNpeDlImageMgr.c b/cpu/ixp/npe/IxNpeDlImageMgr.c
index c0e7349..f7326bd 100644
--- a/cpu/ixp/npe/IxNpeDlImageMgr.c
+++ b/cpu/ixp/npe/IxNpeDlImageMgr.c
@@ -140,6 +140,12 @@ static UINT32 *IxNpeMicroCodeImageLibrary = (UINT32 *)CONFIG_IXP4XX_NPE_EXT_UCOD
static UINT32 *IxNpeMicroCodeImageLibrary = (UINT32 *)IxNpeMicrocode_array;
#endif
+static UNIT32* getIxNpeMicroCodeImageLibrary()
+{
+ if ((s = getenv("npe_ucode")) != NULL)
+ load_addr = simple_strtoul(s, NULL, 16);
+ else return IxNpeMicroCodeImageLibrary;
+}
/*
* static function prototypes.
@@ -218,9 +224,9 @@ ixNpeDlImageMgrImageListExtract (
IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
"Entering ixNpeDlImageMgrImageListExtract\n");
- header = (IxNpeDlImageMgrImageLibraryHeader *) IxNpeMicroCodeImageLibrary;
+ header = (IxNpeDlImageMgrImageLibraryHeader *) getIxNpeMicroCodeImageLibrary();
- if (ixNpeDlImageMgrSignatureCheck (IxNpeMicroCodeImageLibrary))
+ if (ixNpeDlImageMgrSignatureCheck (getIxNpeMicroCodeImageLibrary()))
{
/* for each image entry in the image header ... */
while (header->entry[imageCount].eohMarker !=
@@ -291,9 +297,9 @@ ixNpeDlImageMgrImageLocate (
IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
"Entering ixNpeDlImageMgrImageLocate\n");
- header = (IxNpeDlImageMgrImageLibraryHeader *) IxNpeMicroCodeImageLibrary;
+ header = (IxNpeDlImageMgrImageLibraryHeader *) getIxNpeMicroCodeImageLibrary();
- if (ixNpeDlImageMgrSignatureCheck (IxNpeMicroCodeImageLibrary))
+ if (ixNpeDlImageMgrSignatureCheck (getIxNpeMicroCodeImageLibrary()))
{
/* for each image entry in the image library header ... */
while (header->entry[imageCount].eohMarker !=
@@ -308,8 +314,9 @@ ixNpeDlImageMgrImageLocate (
* get pointer to the image in the image library using offset from
* 1st word in image library
*/
+ UINT32 *tmp=getIxNpeMicroCodeImageLibrary();
imageOffset = header->entry[imageCount].image.offset;
- *imagePtr = &IxNpeMicroCodeImageLibrary[imageOffset];
+ *imagePtr = &tmp[imageOffset];
/* get the image size */
*imageSize = header->entry[imageCount].image.size;
status = IX_SUCCESS;
@@ -354,9 +361,9 @@ ixNpeDlImageMgrLatestImageExtract (IxNpeDlImageId *imageId)
IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
"Entering ixNpeDlImageMgrLatestImageExtract\n");
- header = (IxNpeDlImageMgrImageLibraryHeader *) IxNpeMicroCodeImageLibrary;
+ header = (IxNpeDlImageMgrImageLibraryHeader *) getIxNpeMicroCodeImageLibrary();
- if (ixNpeDlImageMgrSignatureCheck (IxNpeMicroCodeImageLibrary))
+ if (ixNpeDlImageMgrSignatureCheck (getIxNpeMicroCodeImageLibrary()))
{
/* for each image entry in the image library header ... */
while (header->entry[imageCount].eohMarker !=
@@ -633,7 +640,7 @@ ixNpeDlImageMgrImageFind (
imageLibrary = ixNpeMicrocode_binaryArray;
}
#else
- imageLibrary = IxNpeMicroCodeImageLibrary;
+ imageLibrary = getIxNpeMicroCodeImageLibrary();
#endif /* IX_NPEDL_READ_MICROCODE_FROM_FILE */
}
--
1.5.3.7
More information about the U-Boot
mailing list