diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2019-08-20 17:49:34 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-08-20 17:49:34 +0000 |
commit | 267b36b7d03663a0e3e16044469fbced2825a2b8 (patch) | |
tree | c7034f5bc7c2ec49bd4dff3e420d13a0f2b52d9f | |
parent | f8fb40c0cfca59b4f459d76226c397cef6186d3b (diff) | |
parent | 33633386c35c9f1558e5f86a2d25dbf6a24fc773 (diff) | |
download | native-267b36b7d03663a0e3e16044469fbced2825a2b8.tar.gz |
Merge "Do not read the EMMC ext_csd register from dumpstate"
-rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 108 | ||||
-rw-r--r-- | cmds/dumpstate/dumpstate.h | 3 |
2 files changed, 0 insertions, 111 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 52cd831c16..e296eaaa0d 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -1256,7 +1256,6 @@ static Dumpstate::RunStatus dumpstate() { dump_dev_files("TRUSTY VERSION", "/sys/bus/platform/drivers/trusty", "trusty_version"); RunCommand("UPTIME", {"uptime"}); DumpBlockStatFiles(); - dump_emmc_ecsd("/d/mmc0/mmc0:0001/ext_csd"); DumpFile("MEMORY INFO", "/proc/meminfo"); RunCommand("CPU INFO", {"top", "-b", "-n", "1", "-H", "-s", "6", "-o", "pid,tid,user,pr,ni,%cpu,s,virt,res,pcy,cmd,name"}); @@ -3631,110 +3630,3 @@ time_t get_mtime(int fd, time_t default_mtime) { } return info.st_mtime; } - -void dump_emmc_ecsd(const char *ext_csd_path) { - // List of interesting offsets - struct hex { - char str[2]; - }; - static const size_t EXT_CSD_REV = 192 * sizeof(hex); - static const size_t EXT_PRE_EOL_INFO = 267 * sizeof(hex); - static const size_t EXT_DEVICE_LIFE_TIME_EST_TYP_A = 268 * sizeof(hex); - static const size_t EXT_DEVICE_LIFE_TIME_EST_TYP_B = 269 * sizeof(hex); - - std::string buffer; - if (!android::base::ReadFileToString(ext_csd_path, &buffer)) { - return; - } - - printf("------ %s Extended CSD ------\n", ext_csd_path); - - if (buffer.length() < (EXT_CSD_REV + sizeof(hex))) { - printf("*** %s: truncated content %zu\n\n", ext_csd_path, buffer.length()); - return; - } - - int ext_csd_rev = 0; - std::string sub = buffer.substr(EXT_CSD_REV, sizeof(hex)); - if (sscanf(sub.c_str(), "%2x", &ext_csd_rev) != 1) { - printf("*** %s: EXT_CSD_REV parse error \"%s\"\n\n", ext_csd_path, sub.c_str()); - return; - } - - static const char *ver_str[] = { - "4.0", "4.1", "4.2", "4.3", "Obsolete", "4.41", "4.5", "5.0" - }; - printf("rev 1.%d (MMC %s)\n", ext_csd_rev, - (ext_csd_rev < (int)(sizeof(ver_str) / sizeof(ver_str[0]))) ? ver_str[ext_csd_rev] - : "Unknown"); - if (ext_csd_rev < 7) { - printf("\n"); - return; - } - - if (buffer.length() < (EXT_PRE_EOL_INFO + sizeof(hex))) { - printf("*** %s: truncated content %zu\n\n", ext_csd_path, buffer.length()); - return; - } - - int ext_pre_eol_info = 0; - sub = buffer.substr(EXT_PRE_EOL_INFO, sizeof(hex)); - if (sscanf(sub.c_str(), "%2x", &ext_pre_eol_info) != 1) { - printf("*** %s: PRE_EOL_INFO parse error \"%s\"\n\n", ext_csd_path, sub.c_str()); - return; - } - - static const char *eol_str[] = { - "Undefined", - "Normal", - "Warning (consumed 80% of reserve)", - "Urgent (consumed 90% of reserve)" - }; - printf( - "PRE_EOL_INFO %d (MMC %s)\n", ext_pre_eol_info, - eol_str[(ext_pre_eol_info < (int)(sizeof(eol_str) / sizeof(eol_str[0]))) ? ext_pre_eol_info - : 0]); - - for (size_t lifetime = EXT_DEVICE_LIFE_TIME_EST_TYP_A; - lifetime <= EXT_DEVICE_LIFE_TIME_EST_TYP_B; - lifetime += sizeof(hex)) { - int ext_device_life_time_est; - static const char *est_str[] = { - "Undefined", - "0-10% of device lifetime used", - "10-20% of device lifetime used", - "20-30% of device lifetime used", - "30-40% of device lifetime used", - "40-50% of device lifetime used", - "50-60% of device lifetime used", - "60-70% of device lifetime used", - "70-80% of device lifetime used", - "80-90% of device lifetime used", - "90-100% of device lifetime used", - "Exceeded the maximum estimated device lifetime", - }; - - if (buffer.length() < (lifetime + sizeof(hex))) { - printf("*** %s: truncated content %zu\n", ext_csd_path, buffer.length()); - break; - } - - ext_device_life_time_est = 0; - sub = buffer.substr(lifetime, sizeof(hex)); - if (sscanf(sub.c_str(), "%2x", &ext_device_life_time_est) != 1) { - printf("*** %s: DEVICE_LIFE_TIME_EST_TYP_%c parse error \"%s\"\n", ext_csd_path, - (unsigned)((lifetime - EXT_DEVICE_LIFE_TIME_EST_TYP_A) / sizeof(hex)) + 'A', - sub.c_str()); - continue; - } - printf("DEVICE_LIFE_TIME_EST_TYP_%c %d (MMC %s)\n", - (unsigned)((lifetime - EXT_DEVICE_LIFE_TIME_EST_TYP_A) / sizeof(hex)) + 'A', - ext_device_life_time_est, - est_str[(ext_device_life_time_est < (int)(sizeof(est_str) / sizeof(est_str[0]))) - ? ext_device_life_time_est - : 0]); - } - - printf("\n"); -} - diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h index c0596410e5..82bf8219a2 100644 --- a/cmds/dumpstate/dumpstate.h +++ b/cmds/dumpstate/dumpstate.h @@ -584,9 +584,6 @@ bool is_dir(const char* pathname); /** Gets the last modification time of a file, or default time if file is not found. */ time_t get_mtime(int fd, time_t default_mtime); -/* Dumps eMMC Extended CSD data. */ -void dump_emmc_ecsd(const char *ext_csd_path); - /** Gets command-line arguments. */ void format_args(int argc, const char *argv[], std::string *args); |