Promote heap sizing to first-class Kconfig citizenship.

Changing the heap size is something that those, like me,
with large PCI device trees need to do.  Therefore heap
size should appear as a normal, user-answerable question
within the Kconfig build system.

Also change the malloc debug message to more clearly
indicate how much memory is left.

Signed-off-by: Joe Korty <[email protected]>

Index: trunk/src/Kconfig
===================================================================
--- trunk.orig/src/Kconfig      2010-05-14 10:24:35.000000000 -0400
+++ trunk/src/Kconfig   2010-05-14 10:25:00.000000000 -0400
@@ -80,6 +80,17 @@
          Enables the use of ccache for faster builds.
          Requires ccache in path.
 
+config HEAP_SIZE
+       hex "Heap size (in bytes)"
+       default 0x4000
+       help
+         The primary coreboot heap user is the PCI
+         bus walk.  Therefore heap size may need to be
+         increased on systems that have exceptionally
+         large and/or deep PCI device trees.
+
+         If unsure, use the default.
+
 endmenu
 
 source src/mainboard/Kconfig
@@ -124,10 +135,6 @@
        bool
        default n
 
-config HEAP_SIZE
-       hex
-       default 0x4000
-
 config DEBUG
        bool
        default n
Index: trunk/src/lib/malloc.c
===================================================================
--- trunk.orig/src/lib/malloc.c 2010-05-14 10:24:35.000000000 -0400
+++ trunk/src/lib/malloc.c      2010-05-14 10:25:00.000000000 -0400
@@ -14,7 +14,10 @@
 {
        void *p;
 
-       MALLOCDBG("%s Enter, size %ld, free_mem_ptr %p\n", __func__, size, 
free_mem_ptr);
+       MALLOCDBG("%s Enter, size %ld, %d of %d bytes available.\n",
+               __func__, size,
+               (int)(free_mem_end_ptr - free_mem_ptr),
+               (int)(&_eheap - &_heap));
 
        /* Checking arguments */
        if (size < 0)

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to