Skip to content

Commit a85a35f

Browse files
committed
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 <[email protected]>
1 parent 6374de8 commit a85a35f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tools/power/x86/intel-speed-select/isst-config.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ static int force_online_offline;
4444
static int auto_mode;
4545
static int fact_enable_fail;
4646

47+
static int mbox_delay;
48+
4749
/* clos related */
4850
static int current_clos = -1;
4951
static int clos_epp = -1;
@@ -788,6 +790,9 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command,
788790
mbox_cmds.mbox_cmd[0].parameter = parameter;
789791
mbox_cmds.mbox_cmd[0].req_data = req_data;
790792

793+
if (mbox_delay)
794+
usleep(mbox_delay * 1000);
795+
791796
fd = open(pathname, O_RDWR);
792797
if (fd < 0)
793798
err(-1, "%s open failed", pathname);
@@ -2599,6 +2604,7 @@ static void usage(void)
25992604
printf("\t[-i|--info] : Print platform information\n");
26002605
printf("\t[-o|--out] : Output file\n");
26012606
printf("\t\t\tDefault : stderr\n");
2607+
printf("\t[-p|--pause] : Delay between two mail box commands in milliseconds\n");
26022608
printf("\t[-v|--version] : Print version\n");
26032609

26042610
printf("\nResult format\n");
@@ -2630,6 +2636,7 @@ static void print_version(void)
26302636
static void cmdline(int argc, char **argv)
26312637
{
26322638
const char *pathname = "/dev/isst_interface";
2639+
char *ptr;
26332640
FILE *fp;
26342641
int opt;
26352642
int option_index = 0;
@@ -2641,6 +2648,7 @@ static void cmdline(int argc, char **argv)
26412648
{ "format", required_argument, 0, 'f' },
26422649
{ "help", no_argument, 0, 'h' },
26432650
{ "info", no_argument, 0, 'i' },
2651+
{ "pause", required_argument, 0, 'p' },
26442652
{ "out", required_argument, 0, 'o' },
26452653
{ "version", no_argument, 0, 'v' },
26462654
{ 0, 0, 0, 0 }
@@ -2694,6 +2702,13 @@ static void cmdline(int argc, char **argv)
26942702
fclose(outf);
26952703
outf = fopen_or_exit(optarg, "w");
26962704
break;
2705+
case 'p':
2706+
ret = strtol(optarg, &ptr, 10);
2707+
if (!ret)
2708+
fprintf(stderr, "Invalid pause interval, ignore\n");
2709+
else
2710+
mbox_delay = ret;
2711+
break;
26972712
case 'v':
26982713
print_version();
26992714
break;

0 commit comments

Comments
 (0)