J-Alves | 7581c38 | 2020-05-07 18:34:20 +0100 | [diff] [blame] | 1 | /* |
| 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-Alves | 8f08a05 | 2020-05-26 17:14:40 +0100 | [diff] [blame] | 10 | #include <ffa_svc.h> |
J-Alves | 7581c38 | 2020-05-07 18:34:20 +0100 | [diff] [blame] | 11 | #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-Alves | 5aecd98 | 2020-06-11 10:25:33 +0100 | [diff] [blame] | 17 | /* 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 | |
| 23 | typedef unsigned short ffa_vm_id_t; |
| 24 | typedef unsigned short ffa_vm_count_t; |
| 25 | typedef unsigned short ffa_vcpu_count_t; |
| 26 | |
J-Alves | 7581c38 | 2020-05-07 18:34:20 +0100 | [diff] [blame] | 27 | #ifndef __ASSEMBLY__ |
| 28 | |
| 29 | #include <stdint.h> |
| 30 | |
Max Shvetsov | c32f478 | 2020-06-23 09:41:15 +0100 | [diff] [blame^] | 31 | struct mailbox_buffers { |
| 32 | const void *recv; |
| 33 | void *send; |
| 34 | }; |
| 35 | |
| 36 | struct ffa_partition_info { |
| 37 | /** The ID of the VM the information is about */ |
| 38 | ffa_vm_id_t id; |
| 39 | /** The number of execution contexts implemented by the partition */ |
| 40 | uint16_t exec_context; |
| 41 | /** The Partition's properties, e.g. supported messaging methods */ |
| 42 | uint32_t properties; |
| 43 | }; |
| 44 | |
J-Alves | 5aecd98 | 2020-06-11 10:25:33 +0100 | [diff] [blame] | 45 | /* |
| 46 | * TODO: In the future this file should be placed in a common folder, and not |
| 47 | * under tftf. The functions in this file are also used by SPs for SPM tests. |
| 48 | */ |
Max Shvetsov | c17c1d3 | 2020-06-11 15:03:01 +0100 | [diff] [blame] | 49 | bool check_spmc_execution_level(void); |
J-Alves | 7581c38 | 2020-05-07 18:34:20 +0100 | [diff] [blame] | 50 | smc_ret_values ffa_msg_send_direct_req(uint32_t source_id, uint32_t dest_id, uint32_t message); |
| 51 | smc_ret_values ffa_msg_send_direct_req64(uint32_t source_id, uint32_t dest_id, uint64_t message); |
| 52 | smc_ret_values ffa_run(uint32_t dest_id, uint32_t vcpu_id); |
J-Alves | 8f08a05 | 2020-05-26 17:14:40 +0100 | [diff] [blame] | 53 | smc_ret_values ffa_version(uint32_t input_version); |
J-Alves | 5aecd98 | 2020-06-11 10:25:33 +0100 | [diff] [blame] | 54 | smc_ret_values ffa_id_get(void); |
| 55 | smc_ret_values ffa_msg_wait(void); |
| 56 | smc_ret_values ffa_msg_send_direct_resp(ffa_vm_id_t source_id, |
| 57 | ffa_vm_id_t dest_id, uint32_t message); |
| 58 | smc_ret_values ffa_error(int32_t error_code); |
Max Shvetsov | c17c1d3 | 2020-06-11 15:03:01 +0100 | [diff] [blame] | 59 | smc_ret_values ffa_features(uint32_t feature); |
Max Shvetsov | c32f478 | 2020-06-23 09:41:15 +0100 | [diff] [blame^] | 60 | smc_ret_values ffa_partition_info_get(const uint32_t uuid[4]); |
| 61 | smc_ret_values ffa_rx_release(void); |
J-Alves | 7581c38 | 2020-05-07 18:34:20 +0100 | [diff] [blame] | 62 | |
| 63 | #endif /* __ASSEMBLY__ */ |
| 64 | |
| 65 | #endif /* FFA_HELPERS_H */ |