diff --git a/core/pta/stats.c b/core/pta/stats.c index 93a3c1056da..383c0f9886a 100644 --- a/core/pta/stats.c +++ b/core/pta/stats.c @@ -15,6 +15,7 @@ #include #include #include +#include #include static TEE_Result get_alloc_stats(uint32_t type, TEE_Param p[TEE_NUM_PARAMS]) @@ -52,6 +53,7 @@ static TEE_Result get_alloc_stats(uint32_t type, TEE_Param p[TEE_NUM_PARAMS]) } p[1].memref.size = size_to_retrieve; stats = p[1].memref.buffer; + memset(stats, 0, size_to_retrieve); for (i = ALLOC_ID_HEAP; i <= STATS_NB_POOLS; i++) { if (pool_id != ALLOC_ID_ALL && i != pool_id) @@ -83,6 +85,15 @@ static TEE_Result get_alloc_stats(uint32_t type, TEE_Param p[TEE_NUM_PARAMS]) nex_malloc_reset_stats(); break; #endif + case ALLOC_ID_RPMB: + if (rpmb_mem_stats(stats, p[0].value.b)) + strlcpy(stats->desc, + "RPMB secure storage (no data)", + sizeof(stats->desc)); + else + strlcpy(stats->desc, "RPMB secure storage", + sizeof(stats->desc)); + break; default: EMSG("Wrong pool id"); break; diff --git a/lib/libutee/include/pta_stats.h b/lib/libutee/include/pta_stats.h index f95d3acb8c6..d2c378ab963 100644 --- a/lib/libutee/include/pta_stats.h +++ b/lib/libutee/include/pta_stats.h @@ -38,6 +38,7 @@ #define ALLOC_ID_PUBLIC_DDR 2 /* Public DDR allocator (deprecated) */ #define ALLOC_ID_TA_RAM 3 /* TA_RAM allocator */ #define ALLOC_ID_NEXUS_HEAP 4 /* Nexus heap allocator */ +#define ALLOC_ID_RPMB 5 /* RPMB secure storage */ #define STATS_NB_POOLS 5 #define TEE_ALLOCATOR_DESC_LENGTH 32