diff options
-rw-r--r-- | src/Kconfig | 7 | ||||
-rw-r--r-- | src/lib/cbfs.c | 17 | ||||
-rw-r--r-- | src/lib/cbfs_core.c | 8 |
3 files changed, 24 insertions, 8 deletions
diff --git a/src/Kconfig b/src/Kconfig index d449b30..a6b09dc 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -664,6 +664,13 @@ config GDB_STUB If enabled, you will be able to set breakpoints for gdb debugging. See src/arch/x86/lib/c_start.S for details. +config DEBUG_CBFS + bool "Output verbose CBFS debug messages" + default n + depends on TPM + help + This option enables additional CBFS related debug messages. + config HAVE_DEBUG_RAM_SETUP def_bool n diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c index 33fa799..98672d4 100644 --- a/src/lib/cbfs.c +++ b/src/lib/cbfs.c @@ -30,8 +30,13 @@ #endif #define phys_to_virt(x) (void*)(x) #define virt_to_phys(x) (uint32_t)(x) -#define ERROR(x...) printk(BIOS_ERR, x) -#define LOG(x...) printk(BIOS_INFO, x) +#define ERROR(x...) printk(BIOS_ERR, "CBFS: " x) +#define LOG(x...) printk(BIOS_INFO, "CBFS: " x) +#if CONFIG_DEBUG_CBFS +#define DEBUG(x...) printk(BIOS_SPEW, "CBFS: " x) +#else +#define DEBUG(x...) +#endif // FIXME: romstart/romend are fine on x86, but not on ARM #define romstart() 0xffffffff #define romend() 0 @@ -100,7 +105,7 @@ void * cbfs_load_stage(const char *name) if (stage == NULL) return (void *) -1; - printk(BIOS_INFO, "Stage: loading %s @ 0x%x (%d bytes), entry @ 0x%llx\n", + LOG("loading stage %s @ 0x%x (%d bytes), entry @ 0x%llx\n", name, (u32) stage->load, stage->memlen, stage->entry); @@ -113,7 +118,7 @@ void * cbfs_load_stage(const char *name) stage->len)) return (void *) -1; - printk(BIOS_DEBUG, "Stage: done loading.\n"); + DEBUG("stage loaded.\n"); entry = stage->entry; // entry = ntohll(stage->entry); @@ -130,13 +135,13 @@ int cbfs_execute_stage(const char *name) return 1; if (ntohl(stage->compression) != CBFS_COMPRESS_NONE) { - printk(BIOS_INFO, "CBFS: Unable to run %s: Compressed file" + LOG("Unable to run %s: Compressed file" "Not supported for in-place execution\n", name); return 1; } /* FIXME: This isn't right */ - printk(BIOS_INFO, "CBFS: run @ %p\n", (void *) ntohl((u32) stage->entry)); + LOG("run @ %p\n", (void *) ntohl((u32) stage->entry)); return run_address((void *) (intptr_t)ntohll(stage->entry)); } diff --git a/src/lib/cbfs_core.c b/src/lib/cbfs_core.c index 4bf755b..15cb68e 100644 --- a/src/lib/cbfs_core.c +++ b/src/lib/cbfs_core.c @@ -40,6 +40,9 @@ * print an error message x (in printf format) * * LOG(x...) + * print a message x (in printf format) + * + * DEBUG(x...) * print a debug message x (in printf format) * * romstart() @@ -86,7 +89,7 @@ struct cbfs_file *cbfs_find(const char *name) struct cbfs_header *header = get_cbfs_header(); if (header == (void*)0xffffffff) return NULL; - LOG("Searching for %s\n", name); + LOG("Looking for '%s'\n", name); void *data, *dataend, *origdata; /* find first entry */ @@ -111,8 +114,9 @@ struct cbfs_file *cbfs_find(const char *name) data = phys_to_virt(CBFS_ALIGN_UP(virt_to_phys(data), align)); continue; } - LOG("Check %s\n", CBFS_NAME(file)); + DEBUG("Check '%s'\n", CBFS_NAME(file)); if (strcmp(CBFS_NAME(file), name) == 0) { + LOG("found.\n"); return file; } void *olddata = data; |