/*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2010
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
#endif
#ifdef CONFIG_FSL_ESDHC
unsigned long sdhc_clk;
-#endif
-#if 0
- unsigned long cpu_clk; /* CPU clock in Hz! */
- unsigned long bus_clk;
- phys_size_t ram_size; /* RAM size */
- unsigned long reset_status; /* reset status register at boot */
#endif
void **jt; /* jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
} gd_t;
/*
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
-#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")
void *fb_base; /* framebuffer address */
#endif
void **jt; /* jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
} gd_t;
/*
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buf has been initialized */
-#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm("r5")
*
* Copyright (c) 2005-2007 Analog Devices Inc.
*
- * (C) Copyright 2000-2004
+ * (C) Copyright 2000-2010
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
unsigned long post_init_f_time; /* When post_init_f started */
#endif
- void **jt; /* jump table */
+ void **jt; /* jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
} gd_t;
/*
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buf has been initialized */
-#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register gd_t * volatile gd asm ("P3")
/*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2010
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
phys_size_t ram_size; /* RAM size */
unsigned long reset_status; /* reset status register at boot */
void **jt; /* jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
} gd_t;
/*
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
-#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
extern gd_t *gd;
/*
- * (C) Copyright 2002 - 2003
+ * (C) Copyright 2002 - 2010
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
unsigned long board_type;
#endif
void **jt; /* Standalone app jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
} gd_t;
/*
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
-#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#if 0
extern gd_t *global_data;
unsigned long env_valid; /* Checksum of Environment valid? */
unsigned long fb_base; /* base address of frame buffer */
void **jt; /* jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
} gd_t;
/*
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
-#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r31")
/*
- * (C) Copyright 2002-2003
+ * (C) Copyright 2002-2010
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
unsigned long env_addr; /* Address of Environment struct */
unsigned long env_valid; /* Checksum of Environment valid? */
void **jt; /* jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
} gd_t;
/*
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buf has been initialized */
-#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("k0")
unsigned long post_init_f_time; /* When post_init_f started */
#endif
void **jt; /* Standalone app jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
} gd_t;
/* flags */
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
-#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("gp")
/*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2010
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
unsigned long long wdt_last; /* trace watch-dog triggering rate */
#endif
void **jt; /* jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
} gd_t;
/*
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
-#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
/*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2010
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* (C) Copyright 2007
unsigned long env_addr; /* Address of Environment struct */
unsigned long env_valid; /* Checksum of Environment valid */
void **jt; /* Standalone app jump table */
-}gd_t;
+ char env_buf[32]; /* buffer for getenv() before reloc. */
+} gd_t;
#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */
#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
-#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r13")
/*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2010
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* (C) Copyright 2007
#ifdef CONFIG_LWMON
unsigned long kbd_status;
#endif
- void **jt; /* jump table */
+ void **jt; /* jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
} gd_t;
/*
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
-#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("%g7")
char *getenv (char *name)
{
- int i, nxt;
+ if (gd->flags & GD_FLG_RELOC) { /* full C runtime after reloc */
+ int i, nxt;
- WATCHDOG_RESET();
+ WATCHDOG_RESET();
- for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
- int val;
+ for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
+ int val;
- for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
- if (nxt >= CONFIG_ENV_SIZE) {
- return (NULL);
+ for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
+ if (nxt >= CONFIG_ENV_SIZE) {
+ return (NULL);
+ }
}
+ if ((val=envmatch((uchar *)name, i)) < 0)
+ continue;
+ return ((char *)env_get_addr(val));
}
- if ((val=envmatch((uchar *)name, i)) < 0)
- continue;
- return ((char *)env_get_addr(val));
+
+ return (NULL);
}
- return (NULL);
+ /* restricted C runtime before reloc */
+
+ return ((getenv_f(name,gd->env_buf,sizeof(gd->env_buf)) > 0) ?
+ gd->env_buf : NULL);
}
int getenv_f(char *name, char *buf, unsigned len)