summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/api.c3
-rw-r--r--common/cmd_log.c8
-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
-rw-r--r--common/image.c20
-rw-r--r--include/common.h1
-rw-r--r--include/logbuff.h1
-rw-r--r--lib_ppc/board.c5
11 files changed, 20 insertions, 44 deletions
diff --git a/api/api.c b/api/api.c
index c1b2b60aeb..1ee7c68f7a 100644
--- a/api/api.c
+++ b/api/api.c
@@ -40,6 +40,7 @@
/* U-Boot routines needed */
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);
/*****************************************************************************
@@ -582,7 +583,7 @@ int syscall(int call, int *retval, ...)
va_list ap;
int rv;
- if (call < 0 || call >= calls_no || calls_table[call] == NULL) {
+ if (call < 0 || call >= calls_no) {
debugf("invalid call #%d\n", call);
return 0;
}
diff --git a/common/cmd_log.c b/common/cmd_log.c
index 8e04941d61..b9f9ba0342 100644
--- a/common/cmd_log.c
+++ b/common/cmd_log.c
@@ -66,12 +66,6 @@ static logbuff_t *log;
#endif
static char *lbuf;
-unsigned long __logbuffer_base(void)
-{
- return CFG_SDRAM_BASE + gd->bd->bi_memsize - LOGBUFF_LEN;
-}
-unsigned long logbuffer_base (void) __attribute__((weak, alias("__logbuffer_base")));
-
void logbuff_init_ptrs (void)
{
unsigned long tag, post_word;
@@ -81,7 +75,7 @@ void logbuff_init_ptrs (void)
log = (logbuff_t *)CONFIG_ALT_LH_ADDR;
lbuf = (char *)CONFIG_ALT_LB_ADDR;
#else
- log = (logbuff_t *)(logbuffer_base ()) - 1;
+ log = (logbuff_t *)(gd->bd->bi_memsize-LOGBUFF_LEN) - 1;
lbuf = (char *)log->buf;
#endif
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index dc05f68bfe..cab727f76c 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 f366fdbeb2..a49481244e 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 fae87ca33f..2adc129c67 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 bfc8d02f85..7c18896cb0 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 0b6c2b7334..0e5699a95b 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)
{
diff --git a/common/image.c b/common/image.c
index f7faf504d4..67e594df69 100644
--- a/common/image.c
+++ b/common/image.c
@@ -23,7 +23,6 @@
* MA 02111-1307 USA
*/
-
#ifndef USE_HOSTCC
#include <common.h>
#include <watchdog.h>
@@ -36,10 +35,6 @@
#include <dataflash.h>
#endif
-#ifdef CONFIG_LOGBUFFER
-#include <logbuff.h>
-#endif
-
#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
#include <rtc.h>
#endif
@@ -242,7 +237,7 @@ void image_multi_getimg (image_header_t *hdr, ulong idx,
{
int i;
uint32_t *size;
- ulong offset, tail, count, img_data;
+ ulong offset, count, img_data;
/* get number of component */
count = image_multi_count (hdr);
@@ -258,19 +253,15 @@ void image_multi_getimg (image_header_t *hdr, ulong idx,
if (idx < count) {
*len = uimage_to_cpu (size[idx]);
offset = 0;
- tail = 0;
/* go over all indices preceding requested component idx */
for (i = 0; i < idx; i++) {
- /* add up i-th component size */
- offset += uimage_to_cpu (size[i]);
-
- /* add up alignment for i-th component */
- tail += (4 - uimage_to_cpu (size[i]) % 4);
+ /* add up i-th component size, rounding up to 4 bytes */
+ offset += (uimage_to_cpu (size[i]) + 3) & ~3 ;
}
/* calculate idx-th component data address */
- *data = img_data + offset + tail;
+ *data = img_data + offset;
} else {
*len = 0;
*data = 0;
@@ -1022,9 +1013,6 @@ int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
initrd_high = ~0;
}
- /* Prevent initrd from overwriting logbuffer */
- lmb_reserve(lmb, logbuffer_base() - LOGBUFF_OVERHEAD, LOGBUFF_RESERVE);
-
debug ("## initrd_high = 0x%08lx, copy_to_ram = %d\n",
initrd_high, initrd_copy_to_ram);
diff --git a/include/common.h b/include/common.h
index a6c966cde3..d0f57040ee 100644
--- a/include/common.h
+++ b/include/common.h
@@ -227,7 +227,6 @@ extern ulong load_addr; /* Default Load Address */
/* common/cmd_nvedit.c */
int env_init (void);
void env_relocate (void);
-uchar env_get_char (int);
int envmatch (uchar *, int);
char *getenv (char *);
int getenv_r (char *name, char *buf, unsigned len);
diff --git a/include/logbuff.h b/include/logbuff.h
index f117c66e37..d415729053 100644
--- a/include/logbuff.h
+++ b/include/logbuff.h
@@ -60,7 +60,6 @@ int drv_logbuff_init (void);
void logbuff_init_ptrs (void);
void logbuff_log(char *msg);
void logbuff_reset (void);
-unsigned long logbuffer_base (void);
#endif /* CONFIG_LOGBUFFER */
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index bc49ea1284..4956403cce 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -398,11 +398,6 @@ ulong get_effective_memsize(void)
************************************************************************
*/
-unsigned long logbuffer_base(void)
-{
- return CFG_SDRAM_BASE + get_effective_memsize() - LOGBUFF_LEN;
-}
-
void board_init_f (ulong bootflag)
{
bd_t *bd;