[coreboot-gerrit] Change in coreboot[master]: cbmem_console: Improve 'cbmem -1' behavior for truncated pre...

Julius Werner (Code Review) gerrit at coreboot.org
Tue May 16 23:04:32 CEST 2017


Hello Aaron Durbin, Patrick Rudolph,

I'd like you to do a code review.  Please visit

    https://review.coreboot.org/19720

to review the following change.


Change subject: cbmem_console: Improve 'cbmem -1' behavior for truncated pre-CBMEM logs
......................................................................

cbmem_console: Improve 'cbmem -1' behavior for truncated pre-CBMEM logs

The 'cbmem -1' flag that cuts off console output before the last boot
will ignore content from earlier stages if it was truncated due to lack
of pre-CBMEM console space. This patch makes the "log truncated" message
more specific and adds it as an additional cut-off marker to 'cbmem -1'
to counteract that problem.

Also raise the log level of the coreboot banner one step to BIOS_NOTICE
to make it more likely to be included in the output for 'cbmem -1' to
find. (I believe NOTICE is reasonable but I wouldn't want to go as far
as WARN which should be reserved for actual problems. Of course this is
not ideal, but then again, our whole log-level system really isn't... it
would be better if we could make it always print a banner to the CBMEM
console without affecting the UART at the same time, but that would
require a larger amount of work.)

Change-Id: I58288593dfa757e14f4a9da4ffa7e27b0b66feb9
Signed-off-by: Julius Werner <jwerner at chromium.org>
---
M src/console/init.c
M src/lib/cbmem_console.c
M util/cbmem/cbmem.c
3 files changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/20/19720/1

diff --git a/src/console/init.c b/src/console/init.c
index 91d6492..1029e6b 100644
--- a/src/console/init.c
+++ b/src/console/init.c
@@ -71,6 +71,6 @@
 
 	console_hw_init();
 
-	printk(BIOS_INFO, "\n\ncoreboot-%s%s %s " ENV_STRING " starting...\n",
+	printk(BIOS_NOTICE, "\n\ncoreboot-%s%s %s " ENV_STRING " starting...\n",
 	       coreboot_version, coreboot_extra_version, coreboot_build);
 }
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index eb0cc93..b0008b1 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -156,8 +156,8 @@
 		return;
 
 	if (src_cons_p->cursor & OVERFLOW) {
-		const char overflow_warning[] = "\n*** Pre-CBMEM console "
-			"overflowed, log truncated ***\n";
+		const char overflow_warning[] = "\n*** Pre-CBMEM " ENV_STRING
+			" console overflowed, log truncated! ***\n";
 		for (c = 0; c < sizeof(overflow_warning) - 1; c++)
 			cbmemc_tx_byte(overflow_warning[c]);
 		for (c = src_cons_p->cursor & CURSOR_MASK;
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 48a1bc9..daa7b56 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -670,9 +670,12 @@
 	cursor = 0;
 	if (one_boot_only) {
 #define BANNER_REGEX(stage) "\n\ncoreboot-[^\n]* " stage " starting\\.\\.\\.\n"
+#define OVERFLOW_REGEX(stage) "\n*** Pre-CBMEM " stage " console overflowed"
 		const char *regex[] = { BANNER_REGEX("bootblock"),
 					BANNER_REGEX("romstage"),
-					BANNER_REGEX("ramstage")};
+					OVERFLOW_REGEX("romstage"),
+					BANNER_REGEX("ramstage"),
+					OVERFLOW_REGEX("ramstage") };
 		int i;
 
 		for (i = 0; !cursor && i < ARRAY_SIZE(regex); i++) {

-- 
To view, visit https://review.coreboot.org/19720
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I58288593dfa757e14f4a9da4ffa7e27b0b66feb9
Gerrit-PatchSet: 1
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Julius Werner <jwerner at chromium.org>
Gerrit-Reviewer: Aaron Durbin <adurbin at chromium.org>
Gerrit-Reviewer: Patrick Rudolph <siro at das-labor.org>



More information about the coreboot-gerrit mailing list