summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYilun Lin <yllin@google.com>2019-03-11 17:41:17 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-04-18 19:52:06 -0700
commit2b452718a0b2e08fad8e0a830b443db862bf806c (patch)
tree43eb5a122ecdab194707e5fd8c7d2205d071ab31 /util
parent521db7dfbff864bf4fd2442a6129872b6b4ea873 (diff)
downloadchrome-ec-2b452718a0b2e08fad8e0a830b443db862bf806c.tar.gz
util/ectool, common/system: Share sysmbol reset_flag_desc.
There were two symbols reset_flag_desc and reset_flag_strings used in two separated places: host binary ectool and device. This CL combines these two symbols to reduce maintance efforts. TEST=make buildall -j BRANCH=None BUG=None Change-Id: I3b5731ab08804f46629d6e43466dce963bd86a69 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1514395 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/ectool.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/util/ectool.c b/util/ectool.c
index 9d51cc7bc4..1717ae1850 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -843,33 +843,14 @@ static const char *reset_cause_to_str(uint16_t cause)
int cmd_uptimeinfo(int argc, char *argv[])
{
- static const char * const reset_flag_strings[] = {
- "other",
- "reset-pin",
- "brownout",
- "power-on",
- "watchdog",
- "soft",
- "hibernate",
- "rtc-alarm",
- "wake-pin",
- "low-battery",
- "sysjump",
- "hard",
- "ap-off",
- "preserved",
- "usb-resume",
- "rdd",
- "rbox",
- "security",
- "ap-watchdog"
- };
-
struct ec_response_uptime_info r;
int rv;
int i;
int flag_count;
uint32_t flag;
+ static const char * const reset_flag_descs[] = {
+ #include "reset_flag_desc.inc"
+ };
if (argc != 1) {
fprintf(stderr, "uptimeinfo takes no arguments");
@@ -901,15 +882,27 @@ int cmd_uptimeinfo(int argc, char *argv[])
}
printf("EC reset flags at last EC boot: ");
+
+ if (!r.ec_reset_flags) {
+ printf("unknown\n");
+ return 0;
+ }
+
flag_count = 0;
- for (flag = 0; flag != ARRAY_SIZE(reset_flag_strings); ++flag) {
+ for (flag = 0; flag < ARRAY_SIZE(reset_flag_descs); ++flag) {
if ((r.ec_reset_flags & BIT(flag)) != 0) {
if (flag_count)
printf(" | ");
- printf(reset_flag_strings[flag]);
+ printf(reset_flag_descs[flag]);
flag_count++;
}
}
+
+ if (r.ec_reset_flags >= BIT(flag)) {
+ if (flag_count)
+ printf(" | ");
+ printf("no-desc");
+ }
printf("\n");
return 0;
}