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>
This commit is contained in:
Brian J. Nemec 2019-10-25 11:54:22 -07:00 committed by Commit Bot
parent 491ee94be1
commit 27220c0776
1 changed files with 7 additions and 0 deletions

View File

@ -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 */