Skip to content

Commit

Permalink
pta: stats: add commands to print clock and regulator trees
Browse files Browse the repository at this point in the history
Add statistics PTA commands STATS_CMD_PRINT_DRIVERS_INFO to print
device drivers information on console. The implementation currently
allows to print the clock tree and the regulator tree to core console.

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
  • Loading branch information
etienne-lms committed Nov 22, 2023
1 parent cf9ffc2 commit e23616d
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions core/pta/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright (c) 2015, Linaro Limited
*/
#include <compiler.h>
#include <drivers/clk.h>
#include <drivers/regulator.h>
#include <kernel/pseudo_ta.h>
#include <kernel/tee_time.h>
#include <malloc.h>
Expand Down Expand Up @@ -51,6 +53,16 @@

#define STATS_NB_POOLS 4

/*
* STATS_CMD_PRINT_DRIVERS_INFO - Print device drivers information to console
*
* [in] value[0].a Target driver, one of STATS_DRIVER_TYPE_*
*/
#define STATS_CMD_PRINT_DRIVERS_INFO 5

#define STATS_DRIVER_TYPE_CLOCK 0
#define STATS_DRIVER_TYPE_REGULATOR 1

static TEE_Result get_alloc_stats(uint32_t type, TEE_Param p[TEE_NUM_PARAMS])
{
struct malloc_stats *stats;
Expand Down Expand Up @@ -209,6 +221,28 @@ static TEE_Result get_system_time(uint32_t type,
return TEE_SUCCESS;
}

static TEE_Result get_drivers_info(uint32_t type, TEE_Param p[TEE_NUM_PARAMS])
{
if (TEE_PARAM_TYPES(TEE_PARAM_TYPE_VALUE_INPUT,
TEE_PARAM_TYPE_NONE,
TEE_PARAM_TYPE_NONE,
TEE_PARAM_TYPE_NONE) != type)
return TEE_ERROR_BAD_PARAMETERS;

switch (p[0].value.a) {
case STATS_DRIVER_TYPE_CLOCK:
clk_print_tree();
break;
case STATS_DRIVER_TYPE_REGULATOR:
regulator_print_tree();
break;
default:
return TEE_ERROR_BAD_PARAMETERS;
}

return TEE_SUCCESS;
}

/*
* Trusted Application Entry Points
*/
Expand All @@ -228,6 +262,8 @@ static TEE_Result invoke_command(void *psess __unused,
return get_user_ta_stats(ptypes, params);
case STATS_CMD_GET_TIME:
return get_system_time(ptypes, params);
case STATS_CMD_PRINT_DRIVERS_INFO:
return get_drivers_info(ptypes, params);
default:
break;
}
Expand Down

0 comments on commit e23616d

Please sign in to comment.