summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2019-03-01 14:23:30 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-09 01:18:53 -0800
commit9e53b92e50165b777111f159daa2b4e3b3c8b355 (patch)
treebd354022acf50dafa0da42ca6e0f0590a0a2f3c9
parente20d92ab46a9a60925ede8892c59eba10b34c4d1 (diff)
downloadvboot-factory-atlas-11907.11.B.tar.gz
vboot_display: Add full_info parameter to VbExDisplayDebugInfo()factory-atlas-11907.Bfactory-atlas-11907.11.B
VbExDisplayDebugInfo() was invented for the TAB display that dumps a whole lot of possibly interesting debug data to the screen. Since some debug data is only available to the calling firmware, the convention has always been that the calling firmware is supposed to append any of its own debug data it thinks may be relevant to the output. Later, the function was reused to print small info messages that give the user a hint what went wrong when a Ctrl+U or Ctrl+L fails (unlocalized, of course, but better than nothing). The calling firmware is not aware of this new use case, so every time vboot prints a "WARNING: Ctrl+L not enabled" sort of message on the screen, depthcharge also dumps the firmware IDs and TPM state below it. This patch introduces a new parameter to the function to make the two differing use cases clear to the calling firmware. CQ-DEPEND=CL:1496903 BRANCH=None BUG=None TEST=with other patches Change-Id: I52a1e764189508130fea562ad6d53bcefb1fce64 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1497038
-rw-r--r--firmware/include/vboot_api.h14
-rw-r--r--firmware/lib/vboot_display.c2
-rw-r--r--firmware/lib/vboot_ui.c2
-rw-r--r--firmware/lib/vboot_ui_common.c4
-rw-r--r--firmware/lib/vboot_ui_menu.c4
-rw-r--r--firmware/stub/vboot_api_stub.c2
-rw-r--r--tests/vboot_display_tests.c2
7 files changed, 15 insertions, 15 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index 860a5fc9..fdb7615b 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -735,15 +735,15 @@ VbError_t VbExDisplayMenu(uint32_t screen_type, uint32_t locale,
* platform-dependent font. Should be able to handle newlines '\n' in the
* string. Firmware must support displaying at least 20 lines of text, where
* each line may be at least 80 characters long. If the firmware has its own
- * debug state, it may display it to the screen below this information.
+ * debug state, it may display it to the screen below this information if the
+ * full_info parameter is set.
*
- * NOTE: This is what we currently display when TAB is pressed. Some
- * information (HWID, recovery reason) is ours; some (CMOS breadcrumbs) is
- * platform-specific. If we decide to soft-render the HWID string
- * (chrome-os-partner:3693), we'll need to maintain our own fonts, so we'll
- * likely display it via VbExDisplayImage() above.
+ * @param info_str The debug string to display
+ * @param full_info 1 if firmware should append its own info, 0 if not
+ *
+ * @return VBERROR_SUCCESS or error code on error.
*/
-VbError_t VbExDisplayDebugInfo(const char *info_str);
+VbError_t VbExDisplayDebugInfo(const char *info_str, int full_info);
/**
* Write vendor data to read-only VPD
diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c
index 49c5331d..c7094254 100644
--- a/firmware/lib/vboot_display.c
+++ b/firmware/lib/vboot_display.c
@@ -405,7 +405,7 @@ VbError_t VbDisplayDebugInfo(struct vb2_context *ctx)
buf[DEBUG_INFO_SIZE - 1] = '\0';
VB2_DEBUG("[TAB] Debug Info:\n%s", buf);
- return VbExDisplayDebugInfo(buf);
+ return VbExDisplayDebugInfo(buf, 1);
}
#define MAGIC_WORD_LEN 5
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
index dea6e039..3fb2ce63 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -422,7 +422,7 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx)
VB2_DEBUG("dev_disable_boot is set\n");
VbDisplayScreen(ctx,
VB_SCREEN_DEVELOPER_TO_NORM, 0, NULL);
- VbExDisplayDebugInfo(dev_disable_msg);
+ VbExDisplayDebugInfo(dev_disable_msg, 0);
/* Ignore space in VbUserConfirms()... */
switch (VbUserConfirms(ctx, 0)) {
diff --git a/firmware/lib/vboot_ui_common.c b/firmware/lib/vboot_ui_common.c
index af9c4951..b15bf29d 100644
--- a/firmware/lib/vboot_ui_common.c
+++ b/firmware/lib/vboot_ui_common.c
@@ -35,7 +35,7 @@ void vb2_error_notify(const char *print_msg,
enum vb2_beep_type beep)
{
if (print_msg)
- VbExDisplayDebugInfo(print_msg);
+ VbExDisplayDebugInfo(print_msg, 0);
if (!log_msg)
log_msg = print_msg;
if (log_msg)
@@ -60,7 +60,7 @@ void vb2_error_no_altfw(void)
VB2_DEBUG("Legacy boot is disabled\n");
VbExDisplayDebugInfo("WARNING: Booting legacy BIOS has not been "
"enabled. Refer to the developer-mode "
- "documentation for details.\n");
+ "documentation for details.\n", 0);
vb2_error_beep(VB_BEEP_NOT_ALLOWED);
}
diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c
index 39b00d6f..96a24e0e 100644
--- a/firmware/lib/vboot_ui_menu.c
+++ b/firmware/lib/vboot_ui_menu.c
@@ -345,7 +345,7 @@ static VbError_t altfw_action(struct vb2_context *ctx)
vb2_run_altfw(current_menu_idx + 1);
vb2_flash_screen(ctx);
VB2_DEBUG(no_legacy);
- VbExDisplayDebugInfo(no_legacy);
+ VbExDisplayDebugInfo(no_legacy, 0);
return VBERROR_KEEP_LOOPING;
}
@@ -775,7 +775,7 @@ static VbError_t vb2_developer_menu(struct vb2_context *ctx)
/* Make sure user knows dev mode disabled */
if (disable_dev_boot)
- VbExDisplayDebugInfo(dev_disable_msg);
+ VbExDisplayDebugInfo(dev_disable_msg, 0);
switch (key) {
case VB_BUTTON_VOL_DOWN_LONG_PRESS:
diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c
index 599b80c7..3363aa4f 100644
--- a/firmware/stub/vboot_api_stub.c
+++ b/firmware/stub/vboot_api_stub.c
@@ -39,7 +39,7 @@ VbError_t VbExDisplayMenu(uint32_t screen_type, uint32_t locale,
return VBERROR_SUCCESS;
}
-VbError_t VbExDisplayDebugInfo(const char *info_str)
+VbError_t VbExDisplayDebugInfo(const char *info_str, int full_info)
{
return VBERROR_SUCCESS;
}
diff --git a/tests/vboot_display_tests.c b/tests/vboot_display_tests.c
index ef9d1466..2c7691e1 100644
--- a/tests/vboot_display_tests.c
+++ b/tests/vboot_display_tests.c
@@ -94,7 +94,7 @@ uint32_t VbExGetAltFwIdxMask() {
return mock_altfw_mask;
}
-VbError_t VbExDisplayDebugInfo(const char *info_str)
+VbError_t VbExDisplayDebugInfo(const char *info_str, int full_info)
{
strncpy(debug_info, info_str, sizeof(debug_info));
debug_info[sizeof(debug_info) - 1] = '\0';