diff options
author | Marc Bonnici <marc.bonnici@arm.com> | 2021-08-26 19:22:32 +0100 |
---|---|---|
committer | Marc Bonnici <marc.bonnici@arm.com> | 2021-10-07 12:34:59 +0100 |
commit | dac40ee1af503b90e3ab9518f20e7d57ce967ef3 (patch) | |
tree | 479aa09ee9d5f2f618e8631bf241b4c80ecdacf5 | |
parent | 89a0cddb59aeab48cdf14a7c277589e0614e9e3f (diff) | |
download | arm-trusted-firmware-dac40ee1af503b90e3ab9518f20e7d57ce967ef3.tar.gz |
spmc: Support FFA_VERSION
Enable reporting of the FFA Version supported by the SPMC.
Change-Id: I9df91e810f5d27ed5634cba3d7e354e3e988afd9
Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
-rw-r--r-- | services/std_svc/spm/spmc/spmc_main.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/services/std_svc/spm/spmc/spmc_main.c b/services/std_svc/spm/spmc/spmc_main.c index 40d6ba2fd..ef27c440b 100644 --- a/services/std_svc/spm/spmc/spmc_main.c +++ b/services/std_svc/spm/spmc/spmc_main.c @@ -771,6 +771,7 @@ static uint64_t ffa_features_handler(uint32_t smc_fid, case FFA_SUCCESS_SMC32: case FFA_SUCCESS_SMC64: case FFA_FEATURES: + case FFA_VERSION: case FFA_MSG_SEND_DIRECT_REQ_SMC64: case FFA_MSG_SEND_DIRECT_RESP_SMC64: case FFA_PARTITION_INFO_GET: @@ -790,6 +791,33 @@ static uint64_t ffa_features_handler(uint32_t smc_fid, return spmc_ffa_error_return(handle, FFA_ERROR_INVALID_PARAMETER); } +static uint64_t ffa_version_handler(uint32_t smc_fid, + bool secure_origin, + uint64_t x1, + uint64_t x2, + uint64_t x3, + uint64_t x4, + void *cookie, + void *handle, + uint64_t flags) +{ + /* + * Ensure that both major and minor revision representation occupies at + * most 15 bits. + */ + assert(0x8000 > FFA_VERSION_MAJOR); + assert(0x10000 > FFA_VERSION_MINOR); + + if (x1 & FFA_VERSION_BIT31_MASK) { + /* Invalid encoding, return an error. */ + return spmc_ffa_error_return(handle, FFA_ERROR_INVALID_PARAMETER); + } + + SMC_RET1(handle, + FFA_VERSION_MAJOR << FFA_VERSION_MAJOR_SHIFT | + FFA_VERSION_MINOR); +} + /******************************************************************************* * SPMC Helper Functions ******************************************************************************/ @@ -879,6 +907,9 @@ uint64_t spmc_smc_handler(uint32_t smc_fid, switch (smc_fid) { case FFA_FEATURES: return ffa_features_handler(smc_fid, secure_origin, x1, x2, x3, x4, cookie, handle, flags); + case FFA_VERSION: + return ffa_version_handler(smc_fid, secure_origin, x1, x2, x3, x4, cookie, handle, flags); + case FFA_MSG_SEND_DIRECT_REQ_SMC64: return direct_req_smc_handler(smc_fid, secure_origin, x1, x2, x3, x4, cookie, handle, flags); |