summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8295e32)
raw | patch | inline | side by side (parent: 8295e32)
author | Lokesh Vutla <lokeshvutla@ti.com> | |
Fri, 23 Aug 2019 09:44:12 +0000 (15:14 +0530) | ||
committer | Lokesh Vutla <lokeshvutla@ti.com> | |
Mon, 26 Aug 2019 03:55:11 +0000 (09:25 +0530) |
Add support for --cpuinfo argument that prints the host processor
info and the running frequency.
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
info and the running frequency.
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
common/cmd_dump.c | patch | blob | history | |
common/help.c | patch | blob | history | |
common/k3conf.c | patch | blob | history | |
include/k3conf.h | patch | blob | history |
diff --git a/common/cmd_dump.c b/common/cmd_dump.c
index 4e662aedd0f43d0450cf0e548fa9a0f6fb59ba33..518a7186b51d5f18b8cbebf3f8413aeb409ed9d8 100644 (file)
--- a/common/cmd_dump.c
+++ b/common/cmd_dump.c
#include <autoadjust_table.h>
#include <k3conf.h>
+int dump_cpu_info(void)
+{
+ struct ti_sci_processors_info *p = soc_info.sci_info.processors_info;
+ char table[TABLE_MAX_ROW][TABLE_MAX_COL][TABLE_MAX_ELT_LEN];
+ uint32_t row = 0, found = 0;
+ uint64_t freq;
+
+ autoadjust_table_init(table);
+ strncpy(table[row][0], "Processor Name", TABLE_MAX_ELT_LEN);
+ strncpy(table[row][1], "Processor State", TABLE_MAX_ELT_LEN);
+ strncpy(table[row][2], "Processor Frequency", TABLE_MAX_ELT_LEN);
+
+ for (row = 0; row < soc_info.sci_info.num_processors; row++) {
+ if (strncmp(p[row].name, "A", 1))
+ continue;
+ strncpy(table[found + 1][0], p[row].name, TABLE_MAX_ELT_LEN);
+ /* ToDo: Should we get the state from proc ops */
+ snprintf(table[found + 1][1], TABLE_MAX_ELT_LEN, "%s",
+ ti_sci_cmd_get_device_status(p[row].dev_id));
+ ti_sci_cmd_get_clk_freq(p[row].dev_id, p[row].clk_id, &freq);
+ snprintf(table[found + 1][2], TABLE_MAX_ELT_LEN, "%lu", freq);
+ found++;
+ }
+
+ return autoadjust_table_print(table, found + 1, 3);
+}
+
int dump_clocks_info(int argc, char *argv[])
{
struct ti_sci_clocks_info *c = soc_info.sci_info.clocks_info;
diff --git a/common/help.c b/common/help.c
index 9224f982fe90e7f29408b2aa2bfe90cc36665f30..e1bbfed5280bcefef49ae870de7d786fd840f77e 100644 (file)
--- a/common/help.c
+++ b/common/help.c
printf("\tk3conf - TI K3 Configuration Diagnostic Tool\n");
printf("\nSYNOPSIS\n");
- printf("\tk3conf [--version] [--help] <command> [<args>]\n");
+ printf("\tk3conf [--version] [--help] [--cpuinfo] <command> [<args>]\n");
if (cat == HELP_USAGE)
printf("\n\tSee 'k3conf --help' for more information.\n\n");
}
printf("\n\t--version\n");
printf("\t Print k3conf version.\n");
+
+ printf("\n\t--cpuinfo\n");
+ printf("\t Print the host processor information.\n");
}
if (cat != HELP_USAGE)
diff --git a/common/k3conf.c b/common/k3conf.c
index 0ab0e72d222e906fd3d7ca36a7fd95064ec8079e..af57dfb7a84480d3ad076f410f530fda2c359cd7 100644 (file)
--- a/common/k3conf.c
+++ b/common/k3conf.c
} else if (!strcmp(argv[0], "--version")) {
k3conf_print_version(stdout);
goto main_exit;
+ } else if (!strcmp(argv[0], "--cpuinfo")) {
+ k3conf_print_version(stdout);
+ dump_cpu_info();
+ goto main_exit;
} else if (!strcmp(argv[0], "show")) {
argc--;
argv++;
diff --git a/include/k3conf.h b/include/k3conf.h
index 66cf44fd30d5d35648976323c12c5b411922b16f..03c66cfbdb6ab867686e6c392ec66ca869d4bfa6 100644 (file)
--- a/include/k3conf.h
+++ b/include/k3conf.h
int process_dump_command(int argc, char *argv[]);
int dump_clocks_info(int argc, char *argv[]);
int dump_devices_info(int argc, char *argv[]);
+int dump_cpu_info(void);
#endif