From e23616d230dfc26a398ca067daca68ecd45ef1d0 Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Fri, 17 Nov 2023 17:28:50 +0100 Subject: [PATCH] pta: stats: add commands to print clock and regulator trees 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 --- core/pta/stats.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/core/pta/stats.c b/core/pta/stats.c index 933d8e104b5..ceb09f1479e 100644 --- a/core/pta/stats.c +++ b/core/pta/stats.c @@ -3,6 +3,8 @@ * Copyright (c) 2015, Linaro Limited */ #include +#include +#include #include #include #include @@ -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; @@ -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 */ @@ -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; }