[coreboot-gerrit] Patch set updated for coreboot: lib: Add Kconfig to toggle boot state debugging

Leroy P Leahy (leroy.p.leahy@intel.com) gerrit at coreboot.org
Mon Feb 15 22:45:03 CET 2016


Leroy P Leahy (leroy.p.leahy at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13716

-gerrit

commit a11054a3b2529015727fe8189d1ffbe499773f32
Author: Lee Leahy <leroy.p.leahy at intel.com>
Date:   Sun Feb 14 17:01:40 2016 -0800

    lib: Add Kconfig to toggle boot state debugging
    
    Add the DEBUG_BOOT_STATE Kconfig value to enable boot state debugging.
    Update include/bootstate.h and lib/hardwaremain.c to honor this value.
    Add a dashed line which displays between the states.
    
    Testing on Galileo:
    * select DEBUG_BOOT_STATE in mainboard/intel/galileo/Kconfig
    * Build and run on Galileo
    
    Change-Id: I6e8a0085aa33c8a1394f31c030e67ab3d5bf7299
    Signed-off-by: Lee Leahy <leroy.p.leahy at intel.com>
---
 src/Kconfig             |  7 +++++++
 src/include/bootstate.h |  7 ++-----
 src/lib/hardwaremain.c  | 25 +++++++++++++------------
 3 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/src/Kconfig b/src/Kconfig
index 760fdf7..4cceb14 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -1149,3 +1149,10 @@ config CBFS_SIZE
 	  This is the part of the ROM actually managed by CBFS.  Set it to be
 	  equal to the full rom size if that hasn't been overridden by the
 	  chipset or mainboard.
+
+config DEBUG_BOOT_STATE
+	bool
+	default n
+	help
+	  Control debugging of the boot state machine.  When selected displays
+	  the state boundaries in ramstage.
diff --git a/src/include/bootstate.h b/src/include/bootstate.h
index 0889018..09178a5 100644
--- a/src/include/bootstate.h
+++ b/src/include/bootstate.h
@@ -25,9 +25,6 @@
 #include <main_decl.h>
 #endif
 
-/* Control debugging of the boot state machine. */
-#define BOOT_STATE_DEBUG 0
-
 /*
  * The boot state machine provides a mechanism for calls to be made through-
  * out the main boot process. The boot process is separated into discrete
@@ -119,12 +116,12 @@ struct boot_state_callback {
 	void (*callback)(void *arg);
 	/* For use internal to the boot state machine. */
 	struct boot_state_callback *next;
-#if BOOT_STATE_DEBUG
+#if IS_ENABLED(CONFIG_DEBUG_BOOT_STATE)
 	const char *location;
 #endif
 };
 
-#if BOOT_STATE_DEBUG
+#if IS_ENABLED(CONFIG_DEBUG_BOOT_STATE)
 #define BOOT_STATE_CALLBACK_LOC __FILE__ ":" STRINGIFY(__LINE__)
 #define BOOT_STATE_CALLBACK_INIT_DEBUG .location = BOOT_STATE_CALLBACK_LOC,
 #define INIT_BOOT_STATE_CALLBACK_DEBUG(bscb_) \
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index 34340a5..10ef96c 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -39,12 +39,6 @@
 #include <timestamp.h>
 #include <thread.h>
 
-#if BOOT_STATE_DEBUG
-#define BS_DEBUG_LVL BIOS_DEBUG
-#else
-#define BS_DEBUG_LVL BIOS_NEVER
-#endif
-
 static boot_state_t bs_pre_device(void *arg);
 static boot_state_t bs_dev_init_chips(void *arg);
 static boot_state_t bs_dev_enumerate(void *arg);
@@ -296,12 +290,11 @@ static void bs_call_callbacks(struct boot_state *state,
 			phase->callbacks = bscb->next;
 			bscb->next = NULL;
 
-#if BOOT_STATE_DEBUG
-			printk(BS_DEBUG_LVL, "BS: callback (%p) @ %s.\n",
-			       bscb, bscb->location);
+#if IS_ENABLED(CONFIG_DEBUG_BOOT_STATE)
+			printk(BIOS_DEBUG, "BS: callback (%p) @ %s.\n",
+				bscb, bscb->location);
 #endif
 			bscb->callback(bscb->arg);
-
 			continue;
 		}
 
@@ -341,7 +334,9 @@ static void bs_walk_state_machine(void)
 			break;
 		}
 
-		printk(BS_DEBUG_LVL, "BS: Entering %s state.\n", state->name);
+		if (IS_ENABLED(CONFIG_DEBUG_BOOT_STATE))
+			printk(BIOS_DEBUG, "BS: Entering %s state.\n",
+				state->name);
 
 		bs_run_timers(0);
 
@@ -359,12 +354,18 @@ static void bs_walk_state_machine(void)
 
 		next_id = state->run_state(state->arg);
 
-		printk(BS_DEBUG_LVL, "BS: Exiting %s state.\n", state->name);
+		if (IS_ENABLED(CONFIG_DEBUG_BOOT_STATE))
+			printk(BIOS_DEBUG, "BS: Exiting %s state.\n",
+			state->name);
 
 		bs_sample_time(state);
 
 		bs_call_callbacks(state, current_phase.seq);
 
+		if (IS_ENABLED(CONFIG_DEBUG_BOOT_STATE))
+			printk(BIOS_DEBUG,
+				"----------------------------------------\n");
+
 		/* Update the current phase with new state id and sequence. */
 		current_phase.state_id = next_id;
 		current_phase.seq = BS_ON_ENTRY;



More information about the coreboot-gerrit mailing list