blob: 2cc2c4670b918fe214c2b718b7474bed55957d59 [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;
Manish Pandey6b3840a2020-09-15 22:31:58 +010026typedef uint32_t ffa_int_id_t;
J-Alves5aecd982020-06-11 10:25:33 +010027
J-Alves7581c382020-05-07 18:34:20 +010028#ifndef __ASSEMBLY__
29
30#include <stdint.h>
31
Max Shvetsovc32f4782020-06-23 09:41:15 +010032struct mailbox_buffers {
33 const void *recv;
34 void *send;
35};
36
37struct ffa_partition_info {
38 /** The ID of the VM the information is about */
39 ffa_vm_id_t id;
40 /** The number of execution contexts implemented by the partition */
41 uint16_t exec_context;
42 /** The Partition's properties, e.g. supported messaging methods */
43 uint32_t properties;
44};
45
J-Alves5aecd982020-06-11 10:25:33 +010046/*
47 * TODO: In the future this file should be placed in a common folder, and not
48 * under tftf. The functions in this file are also used by SPs for SPM tests.
49 */
Max Shvetsovc17c1d32020-06-11 15:03:01 +010050bool check_spmc_execution_level(void);
J-Alves7581c382020-05-07 18:34:20 +010051smc_ret_values ffa_msg_send_direct_req(uint32_t source_id, uint32_t dest_id, uint32_t message);
52smc_ret_values ffa_msg_send_direct_req64(uint32_t source_id, uint32_t dest_id, uint64_t message);
53smc_ret_values ffa_run(uint32_t dest_id, uint32_t vcpu_id);
J-Alves8f08a052020-05-26 17:14:40 +010054smc_ret_values ffa_version(uint32_t input_version);
J-Alves5aecd982020-06-11 10:25:33 +010055smc_ret_values ffa_id_get(void);
56smc_ret_values ffa_msg_wait(void);
57smc_ret_values ffa_msg_send_direct_resp(ffa_vm_id_t source_id,
58 ffa_vm_id_t dest_id, uint32_t message);
59smc_ret_values ffa_error(int32_t error_code);
Max Shvetsovc17c1d32020-06-11 15:03:01 +010060smc_ret_values ffa_features(uint32_t feature);
Max Shvetsovc32f4782020-06-23 09:41:15 +010061smc_ret_values ffa_partition_info_get(const uint32_t uuid[4]);
62smc_ret_values ffa_rx_release(void);
Ruari Phippsbd0a7e42020-07-17 16:42:21 +010063smc_ret_values ffa_rxtx_map(uintptr_t send, uintptr_t recv, uint32_t pages);
J-Alves7581c382020-05-07 18:34:20 +010064
65#endif /* __ASSEMBLY__ */
66
67#endif /* FFA_HELPERS_H */