From 7e59da99a2e76c1094b8bce675fb42ca384e7988 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Sun, 11 Jun 2017 17:51:28 -0700 Subject: [PATCH] panic: Provide declarations for chip panic data backup/restore Provide APIs that allow chips to implement their own version of backing up/restoring panic data to persistent storage. BUG=b:62076222 BRANCH=None TEST=make -j buildall Change-Id: Idda2d55703d4fe7e0a8d6305695fbf4e193b596b Signed-off-by: Furquan Shaikh Reviewed-on: https://chromium-review.googlesource.com/530196 Reviewed-by: Mulin Chao Reviewed-by: Nicolas Boichat --- include/config.h | 9 +++++++++ include/panic.h | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/config.h b/include/config.h index 6ec29586cd..6c95fb34e3 100644 --- a/include/config.h +++ b/include/config.h @@ -745,6 +745,15 @@ */ #undef CONFIG_SOFTWARE_PANIC +/* + * Certain platforms(e.g. eve, poppy) cannot retain panic info in data ram since + * VCC is powered down on EC reset. On such platforms, panic data needs to be + * saved/restored to persistent storage by using chip specific + * implementations. This option can be enabled by those platforms that have and + * wish to use chip-implemented panic backup/restore functions. + */ +#undef CONFIG_CHIP_PANIC_BACKUP + /* * Provide the default GPIO abstraction layer. * You want this unless you are doing a really tiny firmware. diff --git a/include/panic.h b/include/panic.h index a4fbf24b92..57eaf6788f 100644 --- a/include/panic.h +++ b/include/panic.h @@ -170,4 +170,14 @@ void ignore_bus_fault(int ignored); */ struct panic_data *panic_get_data(void); +/** + * Chip-specific implementation for backing up panic data to persistent + * storage. This function is used to ensure that the panic data can survive loss + * of VCC power rail. + * + * There is no generic restore function provided since every chip can decide + * when it is safe to restore panic data during the system initialization step. + */ +void chip_panic_data_backup(void); + #endif /* __CROS_EC_PANIC_H */