Skip to content

Commit

Permalink
xtest: stats: dump clock and regulator tree to secure console
Browse files Browse the repository at this point in the history
Add 'xtest --stats' options '--clocks' and '--regulators' to
respectively dump OP-TEE core clock tree and regulator tree to
the secure console.

Signed-off-by: Etienne Carriere <[email protected]>
  • Loading branch information
etienne-lms committed Dec 4, 2023
1 parent 39d0078 commit 0999e34
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions host/xtest/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,32 @@ static int stat_system_time(int argc, char *argv[])
return close_sess(&ctx, &sess);
}

static int stat_driver_info(int argc, int driver_type)
{
TEEC_Context ctx = { };
TEEC_Session sess = { };
TEEC_Result res = TEEC_ERROR_GENERIC;
uint32_t eo = 0;
TEEC_Operation op = { };

if (argc != 1)
return usage();

open_sess(&ctx, &sess);

op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
TEEC_NONE, TEEC_NONE, TEEC_NONE);
op.params[0].value.a = driver_type;

res = TEEC_InvokeCommand(&sess, STATS_CMD_PRINT_DRIVER_INFO, &op, &eo);
if (res != TEEC_SUCCESS)
errx(EXIT_FAILURE,
"TEEC_InvokeCommand(): res %#"PRIx32" err_orig %#"PRIx32,
res, eo);

return close_sess(&ctx, &sess);
}

int stats_runner_cmd_parser(int argc, char *argv[])
{
if (argc > 1) {
Expand All @@ -333,6 +359,12 @@ int stats_runner_cmd_parser(int argc, char *argv[])
return stat_loaded_ta(argc - 1, argv + 1);
if (!strcmp(argv[1], "--time"))
return stat_system_time(argc - 1, argv + 1);
if (!strcmp(argv[1], "--clocks"))
return stat_driver_info(argc - 1,
STATS_DRIVER_TYPE_CLOCK);
if (!strcmp(argv[1], "--regulators"))
return stat_driver_info(argc - 1,
STATS_DRIVER_TYPE_REGULATOR);
}

return usage();
Expand Down

0 comments on commit 0999e34

Please sign in to comment.