summaryrefslogtreecommitdiff
path: root/common/panic_output.c
diff options
context:
space:
mode:
authorBrian J. Nemec <bnemec@chromium.org>2019-10-25 11:54:22 -0700
committerCommit Bot <commit-bot@chromium.org>2020-01-22 07:42:50 +0000
commit27220c0776a906201d5c49a244b56508643c03b0 (patch)
treeffa5c3b098f9652fc76186d7a7dd30af4de483cc /common/panic_output.c
parent491ee94be1f74876a37f396fffb4457692b5fdab (diff)
downloadchrome-ec-27220c0776a906201d5c49a244b56508643c03b0.tar.gz
servo: Adds logging of panic info to USB console
There is a console command to log the panic info data to the UART console. This change modifies it so after printing data to UART, it will also pass it to the USB console so the data can be easily logged by servod. BUG=chromium:1018008 BRANCH=servo TEST=Manual testing on Sweetberry, ServoV4, and ServoMicro 1) Unplug device to clean panic info, plug device in to USB 2) Request 'panicinfo' from the console interface 3) Response 'No saved panic data available.' 4) Trigger crash using commands like 'sysjump 0x100' or 'crash assert' 5) Reconnect console 6) Request 'panicinfo'. Fault registers are returned over USB console and UART console. The values match the correct addresses which is easily verified in the sysjump case. Change-Id: I5b0bb102296f5fcc967519bb3a59af49644e6f4b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1880579 Tested-by: Brian Nemec <bnemec@chromium.org> Commit-Queue: Brian Nemec <bnemec@chromium.org> Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Diffstat (limited to 'common/panic_output.c')
-rw-r--r--common/panic_output.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/panic_output.c b/common/panic_output.c
index 4c70b06679..1e8a602bd3 100644
--- a/common/panic_output.c
+++ b/common/panic_output.c
@@ -15,6 +15,7 @@
#include "task.h"
#include "timer.h"
#include "uart.h"
+#include "usb_console.h"
#include "util.h"
/* Panic data goes at the end of RAM. */
@@ -89,7 +90,13 @@ void panic_printf(const char *format, ...)
uart_flush_output();
va_start(args, format);
+ /* Send the message to the UART console */
vfnprintf(panic_txchar, NULL, format, args);
+#if defined(CONFIG_USB_CONSOLE) || defined(CONFIG_USB_CONSOLE_STREAM)
+ /* Send the message to the USB console on platforms which support it. */
+ usb_vprintf(format, args);
+#endif
+
va_end(args);
/* Flush the transmit FIFO */