diff options
author | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2020-07-01 14:27:18 -0700 |
---|---|---|
committer | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2020-07-16 10:17:42 -0700 |
commit | a85a35fc1d9be7984f052926e42291219ee5ef85 (patch) | |
tree | 089ee269b65776d179dd9eeeb507c6727faf9fcb /tools/power/x86 | |
parent | 6374de848966966bad9472ed3681a069a8db5a6f (diff) | |
download | linux-a85a35fc1d9be7984f052926e42291219ee5ef85.tar.bz2 |
tools/power/x86/intel-speed-select: Add option to delay mbox commands
Add option "p|--pause" to introduce delay between two mail box commands
for test purpose. This delay can be specified in milliseconds. By default
there is no delay between two mailbox commands.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Diffstat (limited to 'tools/power/x86')
-rw-r--r-- | tools/power/x86/intel-speed-select/isst-config.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c index 0a5c1744db95..c7b2e6afc7e8 100644 --- a/tools/power/x86/intel-speed-select/isst-config.c +++ b/tools/power/x86/intel-speed-select/isst-config.c @@ -44,6 +44,8 @@ static int force_online_offline; static int auto_mode; static int fact_enable_fail; +static int mbox_delay; + /* clos related */ static int current_clos = -1; static int clos_epp = -1; @@ -788,6 +790,9 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command, mbox_cmds.mbox_cmd[0].parameter = parameter; mbox_cmds.mbox_cmd[0].req_data = req_data; + if (mbox_delay) + usleep(mbox_delay * 1000); + fd = open(pathname, O_RDWR); if (fd < 0) err(-1, "%s open failed", pathname); @@ -2599,6 +2604,7 @@ static void usage(void) printf("\t[-i|--info] : Print platform information\n"); printf("\t[-o|--out] : Output file\n"); printf("\t\t\tDefault : stderr\n"); + printf("\t[-p|--pause] : Delay between two mail box commands in milliseconds\n"); printf("\t[-v|--version] : Print version\n"); printf("\nResult format\n"); @@ -2630,6 +2636,7 @@ static void print_version(void) static void cmdline(int argc, char **argv) { const char *pathname = "/dev/isst_interface"; + char *ptr; FILE *fp; int opt; int option_index = 0; @@ -2641,6 +2648,7 @@ static void cmdline(int argc, char **argv) { "format", required_argument, 0, 'f' }, { "help", no_argument, 0, 'h' }, { "info", no_argument, 0, 'i' }, + { "pause", required_argument, 0, 'p' }, { "out", required_argument, 0, 'o' }, { "version", no_argument, 0, 'v' }, { 0, 0, 0, 0 } @@ -2694,6 +2702,13 @@ static void cmdline(int argc, char **argv) fclose(outf); outf = fopen_or_exit(optarg, "w"); break; + case 'p': + ret = strtol(optarg, &ptr, 10); + if (!ret) + fprintf(stderr, "Invalid pause interval, ignore\n"); + else + mbox_delay = ret; + break; case 'v': print_version(); break; |