Revert "Change env_get_char from a global function ptr to a function."

This reverts commit c0559be371
which is known to break booting from dataflash and NAND.
master
Wolfgang Denk 17 years ago
parent 20e5ed1374
commit c9dca3c3f3
  1. 1
      api/api.c
  2. 3
      common/cmd_nvedit.c
  3. 19
      common/env_common.c
  4. 1
      common/env_eeprom.c
  5. 1
      common/env_nvram.c
  6. 2
      common/ft_build.c
  7. 1
      include/common.h

@ -40,6 +40,7 @@
/* U-Boot routines needed */ /* U-Boot routines needed */
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
extern uchar (*env_get_char)(int);
extern uchar *env_get_addr(int); extern uchar *env_get_addr(int);
/***************************************************************************** /*****************************************************************************

@ -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 */ /* Function that returns a pointer to a value from the environment */
/* (Only memory version supported / needed). */ /* (Only memory version supported / needed). */
extern uchar *env_get_addr(int); extern uchar *env_get_addr(int);

@ -50,6 +50,7 @@ extern void env_relocate_spec (void);
extern uchar env_get_char_spec(int); extern uchar env_get_char_spec(int);
static uchar env_get_char_init (int index); 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 * Default settings to be used when no valid environment is found
@ -181,19 +182,6 @@ uchar env_get_char_memory (int index)
} }
#endif #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) uchar *env_get_addr (int index)
{ {
if (gd->env_valid) { if (gd->env_valid) {
@ -227,6 +215,11 @@ void env_relocate (void)
DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr); DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
#endif #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 (gd->env_valid == 0) {
#if defined(CONFIG_GTH) || defined(CFG_ENV_IS_NOWHERE) /* Environment not changable */ #if defined(CONFIG_GTH) || defined(CFG_ENV_IS_NOWHERE) /* Environment not changable */
puts ("Using default environment\n\n"); puts ("Using default environment\n\n");

@ -38,6 +38,7 @@ env_t *env_ptr = NULL;
char * env_name_spec = "EEPROM"; char * env_name_spec = "EEPROM";
extern uchar (*env_get_char)(int);
extern uchar env_get_char_memory (int index); extern uchar env_get_char_memory (int index);

@ -63,6 +63,7 @@ char * env_name_spec = "NVRAM";
extern uchar default_environment[]; extern uchar default_environment[];
extern int default_environment_size; extern int default_environment_size;
extern uchar (*env_get_char)(int);
extern uchar env_get_char_memory (int index); extern uchar env_get_char_memory (int index);
#ifdef CONFIG_AMIGAONEG3SE #ifdef CONFIG_AMIGAONEG3SE

@ -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) void ft_setup(void *blob, bd_t * bd, ulong initrd_start, ulong initrd_end)
{ {

@ -227,7 +227,6 @@ extern ulong load_addr; /* Default Load Address */
/* common/cmd_nvedit.c */ /* common/cmd_nvedit.c */
int env_init (void); int env_init (void);
void env_relocate (void); void env_relocate (void);
uchar env_get_char (int);
int envmatch (uchar *, int); int envmatch (uchar *, int);
char *getenv (char *); char *getenv (char *);
int getenv_r (char *name, char *buf, unsigned len); int getenv_r (char *name, char *buf, unsigned len);

Loading…
Cancel
Save