diff options
author | Vic Yang <victoryang@chromium.org> | 2012-12-10 14:42:16 +0800 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-12-10 23:06:39 -0800 |
commit | 73a0bb2ecfe4a8b2dbb5a2885ddcd06fa8e1424a (patch) | |
tree | 97c84b996e4b31127f3b67c24ce5253cddf0faaf | |
parent | ab727c4941ddd0112be0e0de61c2900ae60913e7 (diff) | |
download | chrome-ec-73a0bb2ecfe4a8b2dbb5a2885ddcd06fa8e1424a.tar.gz |
lm4: Postfix chip name when debug mode is enabled
This adds a '-debug' postfix to chip name when debug mode is enabled,
allowing us to probe debug mode from host.
BUG=chrome-os-partner:16700
TEST='mosys -k ec info' and see chip name postfixed with '-tm'
Test same thing on DVT and chip name is not postfixed.
BRANCH=link
Change-Id: Iade26f2009dd3bdb8ddbe92da0da8da5404c6e99
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39455
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | chip/lm4/system.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/chip/lm4/system.c b/chip/lm4/system.c index cbed522ce2..eac0c48b0a 100644 --- a/chip/lm4/system.c +++ b/chip/lm4/system.c @@ -405,7 +405,7 @@ static char to_hex(int x) return 'a' + x - 10; } -const char *system_get_raw_chip_name(void) +const char *system_get_chip_id_string(void) { static char str[15] = "Unknown-"; char *p = str + 8; @@ -423,7 +423,7 @@ const char *system_get_raw_chip_name(void) return (const char *)str; } -const char *system_get_chip_name(void) +const char *system_get_raw_chip_name(void) { if ((LM4_SYSTEM_DID1 & 0xffff0000) == 0x10e20000) { return "lm4fsxhh5bb"; @@ -436,7 +436,27 @@ const char *system_get_chip_name(void) } else if ((LM4_SYSTEM_DID1 & 0xffff0000) == 0x10ea0000) { return "lm4fs1gh5bb"; } else { - return system_get_raw_chip_name(); + return system_get_chip_id_string(); + } +} + +const char *system_get_chip_name(void) +{ + const char *postfix = "-tm"; /* test mode */ + static char str[20]; + const char *raw_chip_name = system_get_raw_chip_name(); + char *p = str; + + if (LM4REG(0x400fdff0)) { + /* Debug mode is enabled. Postfix chip name. */ + while (*raw_chip_name) + *(p++) = *(raw_chip_name++); + while (*postfix) + *(p++) = *(postfix++); + *p = '\0'; + return (const char *)str; + } else { + return raw_chip_name; } } |