1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2021, Arm Limited.
4  */
5 #ifndef __KERNEL_THREAD_SPMC_H
6 #define __KERNEL_THREAD_SPMC_H
7 
8 #include <ffa.h>
9 #include <kernel/thread.h>
10 
11 /* FF-A endpoint base ID when OP-TEE is used as a S-EL1 endpoint */
12 #define SPMC_ENDPOINT_ID        0x8001
13 
14 struct ffa_rxtx {
15 	void *rx;
16 	void *tx;
17 	unsigned int size;
18 	unsigned int spinlock;
19 	bool tx_is_mine;
20 };
21 
22 void spmc_handle_rxtx_map(struct thread_smc_args *args, struct ffa_rxtx *buf);
23 void spmc_handle_rxtx_unmap(struct thread_smc_args *args, struct ffa_rxtx *buf);
24 void spmc_handle_rx_release(struct thread_smc_args *args, struct ffa_rxtx *buf);
25 void spmc_handle_version(struct thread_smc_args *args);
26 
27 void spmc_set_args(struct thread_smc_args *args, uint32_t fid, uint32_t src_dst,
28 		   uint32_t w2, uint32_t w3, uint32_t w4, uint32_t w5);
29 void spmc_handle_partition_info_get(struct thread_smc_args *args,
30 				    struct ffa_rxtx *rxtx);
31 void spmc_fill_partition_entry(struct ffa_partition_info *fpi,
32 			       uint16_t endpoint_id,
33 			       uint16_t execution_context);
34 #if defined(CFG_CORE_SEL2_SPMC)
35 struct mobj_ffa *thread_spmc_populate_mobj_from_rx(uint64_t cookie);
36 void thread_spmc_relinquish(uint64_t memory_region_handle);
37 #endif
38 
39 #endif /* __KERNEL_THREAD_SPMC_H */
40