summaryrefslogtreecommitdiff
path: root/cpu/ixp/npe/IxNpeDlImageMgr.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2008-01-07 08:41:34 +0100
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2008-01-18 01:00:02 +0100
commita1cf027a08f9dc1c0e769499e6f4fbddcf9cab93 (patch)
treedb78f5ac4621bb2d043b4f8c74e6b35e3f352b1d /cpu/ixp/npe/IxNpeDlImageMgr.c
parent63ebcc4615dd39926ccf61f1d5f3510262ef6564 (diff)
downloadu-boot-imx-a1cf027a08f9dc1c0e769499e6f4fbddcf9cab93.zip
u-boot-imx-a1cf027a08f9dc1c0e769499e6f4fbddcf9cab93.tar.gz
u-boot-imx-a1cf027a08f9dc1c0e769499e6f4fbddcf9cab93.tar.bz2
IXP: add dynamic microcode addr
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@jcrosoft.com> Acked-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'cpu/ixp/npe/IxNpeDlImageMgr.c')
-rw-r--r--cpu/ixp/npe/IxNpeDlImageMgr.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/cpu/ixp/npe/IxNpeDlImageMgr.c b/cpu/ixp/npe/IxNpeDlImageMgr.c
index c0e7349..75b42f2 100644
--- a/cpu/ixp/npe/IxNpeDlImageMgr.c
+++ b/cpu/ixp/npe/IxNpeDlImageMgr.c
@@ -140,6 +140,14 @@ static UINT32 *IxNpeMicroCodeImageLibrary = (UINT32 *)CONFIG_IXP4XX_NPE_EXT_UCOD
static UINT32 *IxNpeMicroCodeImageLibrary = (UINT32 *)IxNpeMicrocode_array;
#endif
+static UINT32* getIxNpeMicroCodeImageLibrary(void)
+{
+ char *s;
+ if ((s = getenv("npe_ucode")) != NULL)
+ return (UINT32*) simple_strtoul(s, NULL, 16);
+ else
+ return IxNpeMicroCodeImageLibrary;
+}
/*
* static function prototypes.
@@ -218,9 +226,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 +299,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 +316,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 +363,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 +642,7 @@ ixNpeDlImageMgrImageFind (
imageLibrary = ixNpeMicrocode_binaryArray;
}
#else
- imageLibrary = IxNpeMicroCodeImageLibrary;
+ imageLibrary = getIxNpeMicroCodeImageLibrary();
#endif /* IX_NPEDL_READ_MICROCODE_FROM_FILE */
}