summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2008-05-12 00:40:58 +0200
committerWolfgang Denk <wd@denx.de>2008-05-12 00:40:58 +0200
commitc9dca3c3f37d2647aec4509b24b16d15882ae3e4 (patch)
treedd61ab9cd4695c9ae3ae9dee5a58320526abf1a4 /common
parent20e5ed137483823aaea5178169f3b144c7a4d9e0 (diff)
downloadu-boot-imx-c9dca3c3f37d2647aec4509b24b16d15882ae3e4.zip
u-boot-imx-c9dca3c3f37d2647aec4509b24b16d15882ae3e4.tar.gz
u-boot-imx-c9dca3c3f37d2647aec4509b24b16d15882ae3e4.tar.bz2
Revert "Change env_get_char from a global function ptr to a function."
This reverts commit c0559be371b2a64b1a817088c3308688e2182f93 which is known to break booting from dataflash and NAND.
Diffstat (limited to 'common')
-rw-r--r--common/cmd_nvedit.c3
-rw-r--r--common/env_common.c19
-rw-r--r--common/env_eeprom.c1
-rw-r--r--common/env_nvram.c1
-rw-r--r--common/ft_build.c2
5 files changed, 13 insertions, 13 deletions
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index dc05f68..cab727f 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -68,6 +68,9 @@ DECLARE_GLOBAL_DATA_PTR;
/************************************************************************
************************************************************************/
+/* Function that returns a character from the environment */
+extern uchar (*env_get_char)(int);
+
/* Function that returns a pointer to a value from the environment */
/* (Only memory version supported / needed). */
extern uchar *env_get_addr(int);
diff --git a/common/env_common.c b/common/env_common.c
index f366fdb..a494812 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -50,6 +50,7 @@ extern void env_relocate_spec (void);
extern uchar env_get_char_spec(int);
static uchar env_get_char_init (int index);
+uchar (*env_get_char)(int) = env_get_char_init;
/************************************************************************
* Default settings to be used when no valid environment is found
@@ -181,19 +182,6 @@ uchar env_get_char_memory (int index)
}
#endif
-uchar env_get_char (int index)
-{
- uchar c;
-
- /* if relocated to RAM */
- if (gd->flags & GD_FLG_RELOC)
- c = env_get_char_memory(index);
- else
- c = env_get_char_init(index);
-
- return (c);
-}
-
uchar *env_get_addr (int index)
{
if (gd->env_valid) {
@@ -227,6 +215,11 @@ void env_relocate (void)
DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
#endif
+ /*
+ * After relocation to RAM, we can always use the "memory" functions
+ */
+ env_get_char = env_get_char_memory;
+
if (gd->env_valid == 0) {
#if defined(CONFIG_GTH) || defined(CFG_ENV_IS_NOWHERE) /* Environment not changable */
puts ("Using default environment\n\n");
diff --git a/common/env_eeprom.c b/common/env_eeprom.c
index fae87ca..2adc129 100644
--- a/common/env_eeprom.c
+++ b/common/env_eeprom.c
@@ -38,6 +38,7 @@ env_t *env_ptr = NULL;
char * env_name_spec = "EEPROM";
+extern uchar (*env_get_char)(int);
extern uchar env_get_char_memory (int index);
diff --git a/common/env_nvram.c b/common/env_nvram.c
index bfc8d02..7c18896 100644
--- a/common/env_nvram.c
+++ b/common/env_nvram.c
@@ -63,6 +63,7 @@ char * env_name_spec = "NVRAM";
extern uchar default_environment[];
extern int default_environment_size;
+extern uchar (*env_get_char)(int);
extern uchar env_get_char_memory (int index);
#ifdef CONFIG_AMIGAONEG3SE
diff --git a/common/ft_build.c b/common/ft_build.c
index 0b6c2b7..0e5699a 100644
--- a/common/ft_build.c
+++ b/common/ft_build.c
@@ -396,6 +396,8 @@ void *ft_get_prop(void *bphp, const char *propname, int *szp)
/********************************************************************/
+/* Function that returns a character from the environment */
+extern uchar(*env_get_char) (int);
void ft_setup(void *blob, bd_t * bd, ulong initrd_start, ulong initrd_end)
{