diff options
author | Simon Glass <sjg@chromium.org> | 2021-01-21 10:57:32 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-22 22:53:15 +0000 |
commit | fcadc1fba2352a8ce904d3b575d0136f6c2e5796 (patch) | |
tree | f8617fd2151bd5383708fee0b226c591a6a3e964 | |
parent | 78acb0eeac7e3e42dae13f907440d92d3e6c1aac (diff) | |
download | chrome-ec-fcadc1fba2352a8ce904d3b575d0136f6c2e5796.tar.gz |
zephyr: Add support for CMD_AP_RESET_LOG
Add the options for this along with the the host command that presses it
into service.
BUG=b:178104134
BRANCH=none
TEST=build for zephyr
See that host command 121 is processed without error now:
21-01-21 12:14:50.829 [7.981900 HC 0x121]
Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: I63b8586a6e2065cbfba8de81d3690cd2f7082c9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2643617
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r-- | common/chipset.c | 5 | ||||
-rw-r--r-- | zephyr/CMakeLists.txt | 3 | ||||
-rw-r--r-- | zephyr/Kconfig | 16 | ||||
-rw-r--r-- | zephyr/app/ec/main.c | 9 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 10 |
5 files changed, 42 insertions, 1 deletions
diff --git a/common/chipset.c b/common/chipset.c index 209334add5..d53a8157a7 100644 --- a/common/chipset.c +++ b/common/chipset.c @@ -60,7 +60,7 @@ DECLARE_HOST_COMMAND(EC_CMD_AP_RESET, #endif #ifdef CONFIG_CMD_AP_RESET_LOG -static struct mutex reset_log_mutex; +static mutex_t reset_log_mutex; static int next_reset_log __preserved_logs(next_reset_log); static uint32_t ap_resets_since_ec_boot; /* keep reset_logs size a power of 2 */ @@ -83,6 +83,9 @@ void init_reset_log(void) next_reset_log = 0; memset(&reset_logs, 0, sizeof(reset_logs)); } +#ifdef CONFIG_ZEPHYR + (void)k_mutex_init(&reset_log_mutex); +#endif } void report_ap_reset(enum chipset_shutdown_reason reason) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 2870611b64..e94af76986 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -117,6 +117,9 @@ zephyr_sources_ifdef(CONFIG_PLATFORM_EC_FLASH "${PLATFORM_EC}/common/flash.c" "${PLATFORM_EC}/common/spi_flash_reg.c") zephyr_sources_ifdef(CONFIG_PLATFORM_EC_HOSTCMD "${PLATFORM_EC}/common/host_command.c") zephyr_sources_ifdef(CONFIG_PLATFORM_EC_HOSTCMD "${PLATFORM_EC}/common/host_event_commands.c") +zephyr_sources_ifdef(CONFIG_PLATFORM_EC_HOSTCMD_GET_UPTIME_INFO + "${PLATFORM_EC}/common/uptime.c") + zephyr_sources_ifdef(CONFIG_PLATFORM_EC_I2C "${PLATFORM_EC}/common/i2c_controller.c") zephyr_sources_ifdef(CONFIG_PLATFORM_EC_KEYBOARD "${PLATFORM_EC}/common/keyboard_scan.c") diff --git a/zephyr/Kconfig b/zephyr/Kconfig index d83f53c884..a1d2d142e5 100644 --- a/zephyr/Kconfig +++ b/zephyr/Kconfig @@ -66,6 +66,22 @@ config PLATFORM_EC_ACPI Enable shimming the ACPI handler, which will handle the Host data from the ACPI I/O port for X86 AP. +config PLATFORM_EC_HOSTCMD_GET_UPTIME_INFO + bool "Host command: EC_CMD_GET_UPTIME_INFO" + default PLATFORM_EC_HOSTCMD + help + Enable the EC_CMD_GET_UPTIME_INFO host command which reports the time + the EC has been powered up, the number of AP resets, an optional log + of AP-reset events and some flags. + +config PLATFORM_EC_AP_RESET_LOG + bool "Enable the Application Processor reset log" + depends on PLATFORM_EC_HOSTCMD_GET_UPTIME_INFO + default y if PLATFORM_EC_POWERSEQ + help + Enable logging of AP reset events. This information is provided in + response to the EC_CMD_GET_UPTIME_INFO host command. + config PLATFORM_EC_BOARD_RESET_AFTER_POWER_ON bool "Work around H1 reset issue" default y diff --git a/zephyr/app/ec/main.c b/zephyr/app/ec/main.c index d8296e6409..2a1c6ac9b8 100644 --- a/zephyr/app/ec/main.c +++ b/zephyr/app/ec/main.c @@ -17,6 +17,15 @@ void main(void) printk(" BOARD=%s\n", CONFIG_BOARD); printk(" ACTIVE_COPY=%s\n", CONFIG_CROS_EC_ACTIVE_COPY); + /* + * Initialize reset logs. This needs to be done before any updates of + * reset logs because we need to verify if the values remain the same + * after every EC reset. + */ + if (IS_ENABLED(CONFIG_CMD_AP_RESET_LOG)) { + init_reset_log(); + } + if (IS_ENABLED(HAS_TASK_KEYSCAN)) { keyboard_scan_init(); } diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index f683e46dad..c5a6fc6934 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -696,4 +696,14 @@ enum battery_type { #endif /* CONFIG_PLATFORM_EC_MOTIONSENSE */ +#undef CONFIG_HOSTCMD_GET_UPTIME_INFO +#ifdef CONFIG_PLATFORM_EC_HOSTCMD_GET_UPTIME_INFO +#define CONFIG_HOSTCMD_GET_UPTIME_INFO +#endif + +#undef CONFIG_CMD_AP_RESET_LOG +#ifdef CONFIG_PLATFORM_EC_AP_RESET_LOG +#define CONFIG_CMD_AP_RESET_LOG +#endif + #endif /* __CROS_EC_CONFIG_CHIP_H */ |