summaryrefslogtreecommitdiffstats
path: root/common/meminfo.c
diff options
context:
space:
mode:
authorJan Luebbe <jlu@pengutronix.de>2012-09-05 17:52:12 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-06 12:43:36 +0200
commitef01e97f6c37fed9d75a8863911a6c786c716917 (patch)
tree46dcd0afda0928a56050739780d8304960dae0f1 /common/meminfo.c
parent25fc2ca049636274afcf65528ec07187d215cd27 (diff)
downloadbarebox-ef01e97f6c37fed9d75a8863911a6c786c716917.tar.gz
barebox-ef01e97f6c37fed9d75a8863911a6c786c716917.tar.xz
common: split out meminfo output and make it optional
Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/meminfo.c')
-rw-r--r--common/meminfo.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/common/meminfo.c b/common/meminfo.c
new file mode 100644
index 0000000000..06fce5afb4
--- /dev/null
+++ b/common/meminfo.c
@@ -0,0 +1,23 @@
+#include <common.h>
+#include <init.h>
+#include <memory.h>
+#include <asm-generic/memory_layout.h>
+
+static int display_meminfo(void)
+{
+ ulong mstart = mem_malloc_start();
+ ulong mend = mem_malloc_end();
+ ulong msize = mend - mstart + 1;
+
+ debug("barebox code: 0x%p -> 0x%p\n", _stext, _etext);
+ debug("bss segment: 0x%p -> 0x%p\n", __bss_start, __bss_stop);
+ printf("malloc space: 0x%08lx -> 0x%08lx (size %s)\n",
+ mstart, mend, size_human_readable(msize));
+#ifdef CONFIG_ARM
+ printf("stack space: 0x%08x -> 0x%08x (size %s)\n",
+ STACK_BASE, STACK_BASE + STACK_SIZE,
+ size_human_readable(STACK_SIZE));
+#endif
+ return 0;
+}
+late_initcall(display_meminfo);