diff options
author | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2018-12-10 17:17:33 +0000 |
---|---|---|
committer | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2018-12-10 17:17:33 +0000 |
commit | 652d20a9e6fa0c4ca85bdb7341e98225c28eb61d (patch) | |
tree | 45d8f6dcbee5d803302cd9eef038bdd50ec085e4 /include | |
parent | 302d3d076fc41538850da09c318017f3e1ecb602 (diff) |
SPM: Test open and close handle
The tests request valid and invalid handles and close them.
Change-Id: Ie421507d8dd4793e635e82f74c206529d9ba59d0
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/common/test_helpers.h | 22 | ||||
-rw-r--r-- | include/runtime_services/spci_helpers.h | 30 |
2 files changed, 52 insertions, 0 deletions
diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h index 942e9f8..983aed3 100644 --- a/include/common/test_helpers.h +++ b/include/common/test_helpers.h @@ -9,6 +9,7 @@ #include <plat_topology.h> #include <psci.h> +#include <spci_svc.h> #include <tftf_lib.h> #include <trusted_os.h> #include <tsp.h> @@ -113,6 +114,27 @@ typedef test_result_t (*test_function_arg_t)(void *arg); version & MM_VERSION_MINOR_MASK); \ } while (0) +#define SKIP_TEST_IF_SPCI_VERSION_LESS_THAN(major, minor) \ + do { \ + smc_args version_smc = { SPCI_VERSION }; \ + smc_ret_values smc_ret = tftf_smc(&version_smc); \ + uint32_t version = smc_ret.ret0; \ + \ + if (version == SMC_UNKNOWN) { \ + tftf_testcase_printf("SPM not detected.\n"); \ + return TEST_RESULT_SKIPPED; \ + } \ + \ + if (version < SPCI_VERSION_FORM(major, minor)) { \ + tftf_testcase_printf("SPCI_VERSION returned %d.%d\n" \ + "The required version is %d.%d\n", \ + version >> SPCI_VERSION_MAJOR_SHIFT,\ + version & SPCI_VERSION_MINOR_MASK, \ + major, minor); \ + return TEST_RESULT_SKIPPED; \ + } \ + } while (0) + /* Helper macro to verify if system suspend API is supported */ #define is_psci_sys_susp_supported() \ (tftf_get_psci_feature_info(SMC_PSCI_SYSTEM_SUSPEND) \ diff --git a/include/runtime_services/spci_helpers.h b/include/runtime_services/spci_helpers.h new file mode 100644 index 0000000..fa7eeae --- /dev/null +++ b/include/runtime_services/spci_helpers.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2018, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef SPCI_HELPERS_H +#define SPCI_HELPERS_H + +#include <utils_def.h> + +/* This error code must be different to the ones used by SPCI */ +#define SPCI_TFTF_ERROR -42 + +/* Client ID used for SPCI calls */ +#define TFTF_SPCI_CLIENT_ID U(0x00007F7F) + +#ifndef __ASSEMBLY__ + +#include <stdint.h> +#include <types.h> + +int spci_service_handle_open(uint16_t client_id, uint16_t *handle, + uint32_t uuid1, uint32_t uuid2, + uint32_t uuid3, uint32_t uuid4); +int spci_service_handle_close(uint16_t client_id, uint16_t handle); + +#endif /* __ASSEMBLY__ */ + +#endif /* SPCI_HELPERS_H */ |