From dc38d9bbb22f826b8122d371b74e7f338dc3aba4 Mon Sep 17 00:00:00 2001 From: "Brian J. Nemec" Date: Fri, 25 Oct 2019 11:54:22 -0700 Subject: 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 Commit-Queue: Brian Nemec Reviewed-by: Ruben Rodriguez Buchillon (cherry picked from commit 27220c0776a906201d5c49a244b56508643c03b0) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2044708 Reviewed-by: Brian Nemec Commit-Queue: Brian Nemec Tested-by: Brian Nemec --- common/panic_output.c | 7 +++++++ 1 file changed, 7 insertions(+) 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 */ -- cgit v1.2.1