[SeaBIOS] [PATCH 3/3] debug: Unify the SeaBIOS debug version banner.

Kevin O'Connor kevin at koconnor.net
Mon Jan 20 18:33:55 CET 2014


Introduce debug_banner() and use it in all the places SeaBIOS version
is displayed for debugging purposes.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/fw/coreboot.c | 2 +-
 src/fw/xen.c      | 4 ++--
 src/output.c      | 6 ++++++
 src/output.h      | 1 +
 src/post.c        | 2 +-
 5 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c
index 0f7bf8c..4ffc9b7 100644
--- a/src/fw/coreboot.c
+++ b/src/fw/coreboot.c
@@ -182,7 +182,7 @@ coreboot_preinit(void)
     struct cb_cbmem_ref *cbref = find_cb_subtable(cbh, CB_TAG_CBMEM_CONSOLE);
     if (cbref) {
         cbcon = (void*)(u32)cbref->cbmem_addr;
-        dprintf(1, "----- [ SeaBIOS %s ] -----\n", VERSION);
+        debug_banner();
         dprintf(1, "Found coreboot cbmem console @ %llx\n", cbref->cbmem_addr);
     }
 
diff --git a/src/fw/xen.c b/src/fw/xen.c
index d5f5ed3..dd8e8af 100644
--- a/src/fw/xen.c
+++ b/src/fw/xen.c
@@ -71,8 +71,8 @@ void xen_preinit(void)
         if (strcmp(signature, "XenVMMXenVMM") == 0) {
             /* Set debug_io_port first, so the following messages work. */
             DebugOutputPort = 0xe9;
-            dprintf(1, "SeaBIOS (version %s)\n\n", VERSION);
-            dprintf(1, "Found Xen hypervisor signature at %x\n", base);
+            debug_banner();
+            dprintf(1, "\nFound Xen hypervisor signature at %x\n", base);
             if ((eax - base) < 2)
                 panic("Insufficient Xen cpuid leaves. eax=%x at base %x\n",
                       eax, base);
diff --git a/src/output.c b/src/output.c
index 06d42a2..994a1d6 100644
--- a/src/output.c
+++ b/src/output.c
@@ -26,6 +26,12 @@ struct putcinfo {
  * Debug output
  ****************************************************************/
 
+void
+debug_banner(void)
+{
+    dprintf(1, "SeaBIOS (version %s)\n", VERSION);
+}
+
 // Write a character to debug port(s).
 static void
 debug_putc(struct putcinfo *action, char c)
diff --git a/src/output.h b/src/output.h
index 6601035..42a76b8 100644
--- a/src/output.h
+++ b/src/output.h
@@ -4,6 +4,7 @@
 #include "types.h" // u32
 
 // output.c
+void debug_banner(void);
 void panic(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2))) __noreturn;
 void printf(const char *fmt, ...)
diff --git a/src/post.c b/src/post.c
index ec3271e..b5cbdb8 100644
--- a/src/post.c
+++ b/src/post.c
@@ -319,7 +319,7 @@ handle_post(void)
         return;
 
     serial_debug_preinit();
-    dprintf(1, "Start bios (version %s)\n", VERSION);
+    debug_banner();
 
     // Check if we are running under Xen.
     xen_preinit();
-- 
1.8.3.1




More information about the SeaBIOS mailing list