From 12b71fcbb0a90552f3124c2e776e9d61e3075bba Mon Sep 17 00:00:00 2001 From: Mary Ruthven Date: Wed, 16 May 2018 15:10:30 -0700 Subject: [PATCH] cr50: include sleepmask in all images sleepmask is really useful for debugging sleep issues. Add a read only version of sleepmask to non-DBG images. It will only be accessible once the console is unlocked. BUG=none BRANCH=cr50 TEST=make sure sleepmask can be modified in DBG images and can only be read in prod images. Change-Id: I31ef966f6302d4a7602a014cb08c9b972d13f41e Signed-off-by: Mary Ruthven Reviewed-on: https://chromium-review.googlesource.com/1062804 Commit-Ready: Mary Ruthven Tested-by: Mary Ruthven Reviewed-by: Vadim Bendebury --- board/cr50/board.h | 2 +- common/system.c | 9 +++++---- include/config.h | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/board/cr50/board.h b/board/cr50/board.h index edbfe263f2..e0c38c6b2e 100644 --- a/board/cr50/board.h +++ b/board/cr50/board.h @@ -31,7 +31,7 @@ #undef CONFIG_CMD_CRASH #undef CONFIG_CMD_MD #undef CONFIG_CMD_RW -#undef CONFIG_CMD_SLEEPMASK +#undef CONFIG_CMD_SLEEPMASK_SET #undef CONFIG_CMD_WAITMS #undef CONFIG_FLASH #endif diff --git a/common/system.c b/common/system.c index 65c1d16681..64bfabbbc2 100644 --- a/common/system.c +++ b/common/system.c @@ -1224,6 +1224,7 @@ DECLARE_SAFE_CONSOLE_COMMAND(syslock, command_system_lock, */ static int command_sleepmask(int argc, char **argv) { +#ifdef CONFIG_CMD_SLEEPMASK_SET int v; if (argc >= 2) { @@ -1242,14 +1243,14 @@ static int command_sleepmask(int argc, char **argv) sleep_mask = v; } } - +#endif ccprintf("sleep mask: %08x\n", sleep_mask); return EC_SUCCESS; } -DECLARE_CONSOLE_COMMAND(sleepmask, command_sleepmask, - "[ on | off | ]", - "Display/force sleep mask"); +DECLARE_SAFE_CONSOLE_COMMAND(sleepmask, command_sleepmask, + "[ on | off | ]", + "Display/force sleep mask"); #endif #ifdef CONFIG_CMD_JUMPTAGS diff --git a/include/config.h b/include/config.h index 1c1a56af1c..4511fb39ea 100644 --- a/include/config.h +++ b/include/config.h @@ -876,6 +876,7 @@ #define CONFIG_CMD_SHMEM #undef CONFIG_CMD_SLEEP #define CONFIG_CMD_SLEEPMASK +#define CONFIG_CMD_SLEEPMASK_SET #undef CONFIG_CMD_SPI_FLASH #undef CONFIG_CMD_SPI_NOR #undef CONFIG_CMD_SPI_XFER