summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/misc.c28
-rw-r--r--common/startup.c19
-rw-r--r--include/mem_malloc.h3
3 files changed, 36 insertions, 14 deletions
diff --git a/common/misc.c b/common/misc.c
index 6171598c14..35fd8eb1ec 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -26,26 +26,36 @@
/*
* Begin and End of memory area for malloc(), and current "brk"
*/
-static ulong mem_malloc_start = 0;
-static ulong mem_malloc_end = 0;
-static ulong mem_malloc_brk = 0;
+static ulong malloc_start = 0;
+static ulong malloc_end = 0;
+static ulong malloc_brk = 0;
+
+ulong mem_malloc_start(void)
+{
+ return malloc_start;
+}
+
+ulong mem_malloc_end(void)
+{
+ return malloc_end;
+}
void mem_malloc_init (void *start, void *end)
{
- mem_malloc_start = (ulong)start;
- mem_malloc_end = (ulong)end;
- mem_malloc_brk = mem_malloc_start;
+ malloc_start = (ulong)start;
+ malloc_end = (ulong)end;
+ malloc_brk = malloc_start;
}
void *sbrk_no_zero(ptrdiff_t increment)
{
- ulong old = mem_malloc_brk;
+ ulong old = malloc_brk;
ulong new = old + increment;
- if ((new < mem_malloc_start) || (new > mem_malloc_end))
+ if ((new < malloc_start) || (new > malloc_end))
return NULL;
- mem_malloc_brk = new;
+ malloc_brk = new;
return (void *)old;
}
diff --git a/common/startup.c b/common/startup.c
index 0f63271880..76ced6275c 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -46,14 +46,22 @@ extern initcall_t __u_boot_initcalls_start[], __u_boot_early_initcalls_end[], __
const char version_string[] =
"U-Boot " UTS_RELEASE " (" __DATE__ " - " __TIME__ ")"CONFIG_IDENT_STRING;
-static int display_banner (void)
+static void display_banner (void)
{
printf (RELOC("\n\n%s\n\n"), RELOC_VAR(version_string));
- debug (RELOC("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n"),
- RELOC_VAR(_u_boot_start), RELOC_VAR(_bss_start), RELOC_VAR(_bss_end));
printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
+}
- return 0;
+static void display_meminfo(void)
+{
+ ulong mstart = mem_malloc_start();
+ ulong mend = mem_malloc_end();
+ ulong msize = mend - mstart + 1;
+
+ debug ("U-Boot code: 0x%08lX -> 0x%08lX BSS: -> 0x%08lX\n",
+ _u_boot_start, _bss_start, _bss_end);
+ printf("Malloc Space: 0x%08lx -> 0x%08lx (size %s)\n",
+ mstart, mend, size_human_readable(msize));
}
#ifdef CONFIG_HAS_EARLY_INIT
@@ -122,11 +130,12 @@ void start_uboot (void)
#ifndef CONFIG_HAS_EARLY_INIT
display_banner();
#endif
+ display_meminfo();
register_default_env();
mount("none", "ramfs", "/");
- mkdir("/dev",0);
+ mkdir("/dev", 0);
mount("none", "devfs", "/dev");
#ifdef CONFIG_CMD_ENVIRONMENT
diff --git a/include/mem_malloc.h b/include/mem_malloc.h
index dc76454514..097335894d 100644
--- a/include/mem_malloc.h
+++ b/include/mem_malloc.h
@@ -6,4 +6,7 @@
void mem_malloc_init(void *start, void *end);
void *sbrk_no_zero(ptrdiff_t increment);
+ulong mem_malloc_start(void);
+ulong mem_malloc_end(void);
+
#endif