blob: 1a49fa87c3c1e2a4896fd21f76b63f68c74942c8 [file] [log] [blame]
J-Alves7581c382020-05-07 18:34:20 +01001/*
2 * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef FFA_HELPERS_H
8#define FFA_HELPERS_H
9
J-Alves8f08a052020-05-26 17:14:40 +010010#include <ffa_svc.h>
J-Alves7581c382020-05-07 18:34:20 +010011#include <tftf_lib.h>
12#include <utils_def.h>
13
14/* This error code must be different to the ones used by FFA */
15#define FFA_TFTF_ERROR -42
16
J-Alves5aecd982020-06-11 10:25:33 +010017/* Hypervisor ID at physical FFA instance */
18#define HYP_ID (0)
19
20/* By convention, SP IDs (as opposed to VM IDs) have bit 15 set */
21#define SP_ID(x) ((x) | (1 << 15))
22
23typedef unsigned short ffa_vm_id_t;
24typedef unsigned short ffa_vm_count_t;
25typedef unsigned short ffa_vcpu_count_t;
26
J-Alves7581c382020-05-07 18:34:20 +010027#ifndef __ASSEMBLY__
28
29#include <stdint.h>
30
J-Alves5aecd982020-06-11 10:25:33 +010031/*
32 * TODO: In the future this file should be placed in a common folder, and not
33 * under tftf. The functions in this file are also used by SPs for SPM tests.
34 */
Max Shvetsovc17c1d32020-06-11 15:03:01 +010035bool check_spmc_execution_level(void);
J-Alves7581c382020-05-07 18:34:20 +010036smc_ret_values ffa_msg_send_direct_req(uint32_t source_id, uint32_t dest_id, uint32_t message);
37smc_ret_values ffa_msg_send_direct_req64(uint32_t source_id, uint32_t dest_id, uint64_t message);
38smc_ret_values ffa_run(uint32_t dest_id, uint32_t vcpu_id);
J-Alves8f08a052020-05-26 17:14:40 +010039smc_ret_values ffa_version(uint32_t input_version);
J-Alves5aecd982020-06-11 10:25:33 +010040smc_ret_values ffa_id_get(void);
41smc_ret_values ffa_msg_wait(void);
42smc_ret_values ffa_msg_send_direct_resp(ffa_vm_id_t source_id,
43 ffa_vm_id_t dest_id, uint32_t message);
44smc_ret_values ffa_error(int32_t error_code);
Max Shvetsovc17c1d32020-06-11 15:03:01 +010045smc_ret_values ffa_features(uint32_t feature);
J-Alves7581c382020-05-07 18:34:20 +010046
47#endif /* __ASSEMBLY__ */
48
49#endif /* FFA_HELPERS_H */