summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/cmd_bootm.c11
-rw-r--r--common/cmd_ide.c4
-rw-r--r--common/cmd_nvedit.c10
-rw-r--r--common/env_common.c19
-rw-r--r--common/env_eeprom.c3
-rw-r--r--common/env_nvram.c2
-rw-r--r--common/ft_build.c1
-rw-r--r--common/image.c18
-rw-r--r--common/main.c33
-rw-r--r--common/usb.c2
10 files changed, 35 insertions, 68 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 44f6b9f..0d67132 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -433,17 +433,6 @@ static int fit_check_kernel (const void *fit, int os_noffset, int verify)
}
show_boot_progress (105);
-#ifdef CONFIG_LOGBUFFER
-#ifndef CONFIG_ALT_LB_ADDR
- kbd=gd->bd;
- /* Prevent initrd from overwriting logbuffer */
- if (initrd_high < (kbd->bi_memsize-LOGBUFF_LEN-LOGBUFF_OVERHEAD))
- initrd_high = kbd->bi_memsize-LOGBUFF_LEN-LOGBUFF_OVERHEAD;
- debug ("## Logbuffer at 0x%08lX ", kbd->bi_memsize-LOGBUFF_LEN);
-#else
- debug ("## Logbuffer at 0x%08lX ", CONFIG_ALT_LB_ADDR);
-#endif
-#endif
if (!fit_image_check_target_arch (fit, os_noffset)) {
puts ("Unsupported Architecture\n");
show_boot_progress (-105);
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index ead7e10..cac99d5 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -52,10 +52,6 @@
# include <status_led.h>
#endif
-#ifndef __PPC__
-#include <asm/io.h>
-#endif
-
#ifdef CONFIG_IDE_8xx_DIRECT
DECLARE_GLOBAL_DATA_PTR;
#endif
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index dc05f68..9c5d1fc 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -68,16 +68,6 @@ DECLARE_GLOBAL_DATA_PTR;
/************************************************************************
************************************************************************/
-/* Function that returns a pointer to a value from the environment */
-/* (Only memory version supported / needed). */
-extern uchar *env_get_addr(int);
-
-/* Function that updates CRC of the enironment */
-extern void env_crc_update (void);
-
-/************************************************************************
-************************************************************************/
-
/*
* Table with supported baudrates (defined in config_xyz.h)
*/
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..9e1a201 100644
--- a/common/env_eeprom.c
+++ b/common/env_eeprom.c
@@ -38,9 +38,6 @@ env_t *env_ptr = NULL;
char * env_name_spec = "EEPROM";
-extern uchar env_get_char_memory (int index);
-
-
uchar env_get_char_spec (int index)
{
uchar c;
diff --git a/common/env_nvram.c b/common/env_nvram.c
index bfc8d02..fa77719 100644
--- a/common/env_nvram.c
+++ b/common/env_nvram.c
@@ -63,8 +63,6 @@ char * env_name_spec = "NVRAM";
extern uchar default_environment[];
extern int default_environment_size;
-extern uchar env_get_char_memory (int index);
-
#ifdef CONFIG_AMIGAONEG3SE
uchar env_get_char_spec (int index)
{
diff --git a/common/ft_build.c b/common/ft_build.c
index 0b6c2b7..b951178 100644
--- a/common/ft_build.c
+++ b/common/ft_build.c
@@ -396,7 +396,6 @@ void *ft_get_prop(void *bphp, const char *propname, int *szp)
/********************************************************************/
-
void ft_setup(void *blob, bd_t * bd, ulong initrd_start, ulong initrd_end)
{
u32 *p;
diff --git a/common/image.c b/common/image.c
index 4a024d4..67e594d 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
@@ -93,6 +88,7 @@ static table_entry_t uimage_arch[] = {
{ IH_ARCH_MIPS64, "mips64", "MIPS 64 Bit", },
{ IH_ARCH_NIOS, "nios", "NIOS", },
{ IH_ARCH_NIOS2, "nios2", "NIOS II", },
+ { IH_ARCH_PPC, "powerpc", "PowerPC", },
{ IH_ARCH_PPC, "ppc", "PowerPC", },
{ IH_ARCH_S390, "s390", "IBM S390", },
{ IH_ARCH_SH, "sh", "SuperH", },
@@ -241,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);
@@ -257,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;
diff --git a/common/main.c b/common/main.c
index 21e7afa..a17b60b 100644
--- a/common/main.c
+++ b/common/main.c
@@ -40,7 +40,7 @@
#include <post.h>
-#if defined(CONFIG_SILENT_CONSOLE) || defined(CONFIG_POST)
+#if defined(CONFIG_SILENT_CONSOLE) || defined(CONFIG_POST) || defined(CONFIG_CMDLINE_EDITING)
DECLARE_GLOBAL_DATA_PTR;
#endif
@@ -67,11 +67,9 @@ static int abortboot(int);
char console_buffer[CFG_CBSIZE]; /* console I/O buffer */
-#ifndef CONFIG_CMDLINE_EDITING
static char * delete_char (char *buffer, char *p, int *colp, int *np, int plen);
static char erase_seq[] = "\b \b"; /* erase sequence */
static char tab_seq[] = " "; /* used to expand TABs */
-#endif /* CONFIG_CMDLINE_EDITING */
#ifdef CONFIG_BOOT_RETRY_TIME
static uint64_t endtime = 0; /* must be set, default is instant timeout */
@@ -947,11 +945,26 @@ int readline_into_buffer (const char *const prompt, char * buffer)
initted = 1;
}
- puts (prompt);
- rc = cread_line(prompt, p, &len);
- return rc < 0 ? rc : len;
-#else
+ /*
+ * History uses a global array which is not
+ * writable until after relocation to RAM.
+ * Revert to non-history version if still
+ * running from flash.
+ */
+ if (gd->flags & GD_FLG_RELOC) {
+ if (!initted) {
+ hist_init();
+ initted = 1;
+ }
+
+ puts (prompt);
+
+ rc = cread_line(prompt, p, &len);
+ return rc < 0 ? rc : len;
+
+ } else {
+#endif /* CONFIG_CMDLINE_EDITING */
char * p_buf = p;
int n = 0; /* buffer index */
int plen = 0; /* prompt length */
@@ -1047,12 +1060,13 @@ int readline_into_buffer (const char *const prompt, char * buffer)
}
}
}
-#endif /* CONFIG_CMDLINE_EDITING */
+#ifdef CONFIG_CMDLINE_EDITING
+ }
+#endif
}
/****************************************************************************/
-#ifndef CONFIG_CMDLINE_EDITING
static char * delete_char (char *buffer, char *p, int *colp, int *np, int plen)
{
char *s;
@@ -1082,7 +1096,6 @@ static char * delete_char (char *buffer, char *p, int *colp, int *np, int plen)
(*np)--;
return (p);
}
-#endif /* CONFIG_CMDLINE_EDITING */
/****************************************************************************/
diff --git a/common/usb.c b/common/usb.c
index 4df01ea..2fa5254 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -1088,7 +1088,7 @@ int usb_hub_configure(struct usb_device *dev)
/* silence compiler warning if USB_BUFSIZ is > 256 [= sizeof(char)] */
i = descriptor->bLength;
if (i > USB_BUFSIZ) {
- USB_HUB_PRINTF("usb_hub_configure: failed to get hub descriptor - too long: %d\N",
+ USB_HUB_PRINTF("usb_hub_configure: failed to get hub descriptor - too long: %d\n",
descriptor->bLength);
return -1;
}