From 52538b9b3e1fcaa96a1bb466c86a35199d4fea67 Mon Sep 17 00:00:00 2001 From: Jeenu Viswambharan Date: Fri, 28 Feb 2014 11:23:35 +0000 Subject: [PATCH] Implement standard calls for TSP This patch adds call count, UID and version information SMC calls for the Trusted OS, as specified by the SMC calling convention. Change-Id: I9a3e84ac1bb046051db975d853dcbe9612aba6a9 --- include/tsp.h | 19 +++++++++++++++++++ services/spd/tspd/tspd_main.c | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/include/tsp.h b/include/tsp.h index 69dda059..9d747d72 100644 --- a/include/tsp.h +++ b/include/tsp.h @@ -54,6 +54,25 @@ #define TSP_FID_MUL 0xf2002002 #define TSP_FID_DIV 0xf2002003 +/* + * Total number of function IDs implemented for services offered to NS clients. + * The function IDs are defined above + */ +#define TSP_NUM_FID 0x4 + +/* TSP implementation version numbers */ +#define TSP_VERSION_MAJOR 0x0 /* Major version */ +#define TSP_VERSION_MINOR 0x1 /* Minor version */ + +/* + * Standard Trusted OS Function IDs that fall under Trusted OS call range + * according to SMC calling convention + */ +#define TOS_CALL_COUNT 0xbf00ff00 /* Number of calls implemented */ +#define TOS_UID 0xbf00ff01 /* Implementation UID */ +/* 0xbf00ff02 is reserved */ +#define TOS_CALL_VERSION 0xbf00ff03 /* Trusted OS Call Version */ + /* Definitions to help the assembler access the SMC/ERET args structure */ #define TSP_ARGS_SIZE 0x40 #define TSP_ARG0 0x0 diff --git a/services/spd/tspd/tspd_main.c b/services/spd/tspd/tspd_main.c index ec287731..543266e9 100644 --- a/services/spd/tspd/tspd_main.c +++ b/services/spd/tspd/tspd_main.c @@ -51,6 +51,7 @@ #include #include #include +#include /******************************************************************************* * Single structure to hold information about the various entry points into the @@ -64,6 +65,11 @@ entry_info *tsp_entry_info; tsp_context tspd_sp_context[TSPD_CORE_COUNT]; +/* TSP UID */ +DEFINE_SVC_UUID(tsp_uuid, + 0x5b3056a0, 0x3291, 0x427b, 0x98, 0x11, + 0x71, 0x68, 0xca, 0x50, 0xf3, 0xfa); + int32_t tspd_init(meminfo *bl32_meminfo); @@ -340,6 +346,21 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, SMC_RET2(handle, read_ctx_reg(ns_gp_regs, CTX_GPREG_X1), read_ctx_reg(ns_gp_regs, CTX_GPREG_X2)); + case TOS_CALL_COUNT: + /* + * Return the number of service function IDs implemented to + * provide service to non-secure + */ + SMC_RET1(handle, TSP_NUM_FID); + + case TOS_UID: + /* Return TSP UID to the caller */ + SMC_UUID_RET(handle, tsp_uuid); + + case TOS_CALL_VERSION: + /* Return the version of current implementation */ + SMC_RET2(handle, TSP_VERSION_MAJOR, TSP_VERSION_MINOR); + default: break; } -- 2.30.2