1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3 * Copyright (c) 2021, Arm Limited.
4 */
5 #ifndef __KERNEL_SPMC_SP_HANDLER_H
6 #define __KERNEL_SPMC_SP_HANDLER_H
7
8 #include <assert.h>
9 #include <kernel/secure_partition.h>
10 #include <kernel/user_mode_ctx_struct.h>
11 #include <tee_api_types.h>
12 #include <tee/entry_std.h>
13
14 #define FFA_DST(x) ((x) & UINT16_MAX)
15 #define FFA_SRC(x) (((x) >> 16) & UINT16_MAX)
16
17 void spmc_sp_thread_entry(uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3);
18 void spmc_sp_msg_handler(struct thread_smc_args *args,
19 struct sp_session *caller_sp);
20 bool ffa_mem_reclaim(struct thread_smc_args *args,
21 struct sp_session *caller_sp);
22
23 #ifdef CFG_SECURE_PARTITION
24 void spmc_sp_start_thread(struct thread_smc_args *args);
25 int spmc_sp_add_share(struct ffa_rxtx *rxtx,
26 size_t blen, uint64_t *global_handle,
27 struct sp_session *owner_sp);
28 #else
spmc_sp_start_thread(struct thread_smc_args * args __unused)29 static inline void spmc_sp_start_thread(struct thread_smc_args *args __unused)
30 {
31 }
32
spmc_sp_add_share(struct ffa_rxtx * rxtx __unused,size_t blen __unused,uint64_t * global_handle __unused,struct sp_session * owner_sp __unused)33 static inline int spmc_sp_add_share(struct ffa_rxtx *rxtx __unused,
34 size_t blen __unused,
35 uint64_t *global_handle __unused,
36 struct sp_session *owner_sp __unused)
37 {
38 return FFA_NOT_SUPPORTED;
39 }
40 #endif
41
42 #endif /* __KERNEL_SPMC_SP_HANDLER_H */
43