From patchwork Tue Oct 12 00:03:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Debugging facility improvements Date: Tue, 12 Oct 2010 00:03:40 -0000 From: Uwe Hermann X-Patchwork-Id: 2097 Message-Id: <20101012000339.GW3256@greenwood> To: coreboot@coreboot.org See patch. Uwe. Debugging facility improvements. - Hook up malloc() debug code via CONFIG_DEBUG_MALLOC. - Get rid of a custom "debug" macro, use printk() as usual. Signed-off-by: Uwe Hermann Index: src/Kconfig =================================================================== --- src/Kconfig (Revision 5940) +++ src/Kconfig (Arbeitskopie) @@ -553,6 +553,16 @@ If unsure, say N. +config DEBUG_MALLOC + bool "Output verbose malloc debug messages" + default n + help + This option enables additional malloc related debug messages. + + Note: This option will increase the size of the coreboot image. + + If unsure, say N. + config REALMODE_DEBUG bool "Enable debug messages for option ROM execution" default n Index: src/lib/malloc.c =================================================================== --- src/lib/malloc.c (Revision 5940) +++ src/lib/malloc.c (Arbeitskopie) @@ -1,11 +1,12 @@ #include #include -#if 0 +#if CONFIG_DEBUG_MALLOC +#define MALLOCDBG(x...) printk(BIOS_SPEW, x) +#else #define MALLOCDBG(x) -#else -#define MALLOCDBG(x...) printk(BIOS_SPEW, x) #endif + extern unsigned char _heap, _eheap; static void *free_mem_ptr = &_heap; /* Start of heap */ static void *free_mem_end_ptr = &_eheap; /* End of heap */ Index: src/lib/cbmem.c =================================================================== --- src/lib/cbmem.c (Revision 5940) +++ src/lib/cbmem.c (Arbeitskopie) @@ -22,12 +22,6 @@ #include #include -#if 1 -#define debug(x...) printk(BIOS_DEBUG, x) -#else -#define debug(x...) -#endif - // The CBMEM TOC reserves 512 bytes to keep // the other entries somewhat aligned. // Increase if MAX_CBMEM_ENTRIES exceeds 21 @@ -68,10 +62,11 @@ bss_cbmem_toc = cbmem_toc; #endif - debug("Initializing CBMEM area to 0x%llx (%lld bytes)\n", baseaddr, size); + printk(BIOS_DEBUG, "Initializing CBMEM area to 0x%llx (%lld bytes)\n", + baseaddr, size); if (size < (64 * 1024)) { - debug("Increase CBMEM size!!\n"); + printk(BIOS_DEBUG, "Increase CBMEM size!\n"); for (;;) ; } @@ -90,7 +85,9 @@ struct cbmem_entry *cbmem_toc; cbmem_toc = (struct cbmem_entry *)(unsigned long)baseaddr; - debug("Re-Initializing CBMEM area to 0x%lx\n", (unsigned long)baseaddr); + printk(BIOS_DEBUG, "Re-Initializing CBMEM area to 0x%lx\n", + (unsigned long)baseaddr); + #ifndef __PRE_RAM__ bss_cbmem_toc = cbmem_toc; #endif @@ -135,7 +132,7 @@ return NULL; } - debug("Adding CBMEM entry as no. %d\n", i); + printk(BIOS_DEBUG, "Adding CBMEM entry as no. %d\n", i); cbmem_toc[i] = (struct cbmem_entry) { .magic = CBMEM_MAGIC,