1 /*
2  * Copyright 2019 The Hafnium Authors.
3  *
4  * Use of this source code is governed by a BSD-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/BSD-3-Clause.
7  */
8 
9 #pragma once
10 
11 #include "hf/mpool.h"
12 #include "hf/vm.h"
13 
14 #include "vmapi/hf/ffa.h"
15 
16 bool is_ffa_hypervisor_retrieve_request(struct ffa_memory_region *request,
17 					struct vm_locked to_locked);
18 
19 bool ffa_memory_region_sanity_check(struct ffa_memory_region *memory_region,
20 				    enum ffa_version ffa_version,
21 				    uint32_t fragment_length,
22 				    bool send_transaction);
23 
24 struct ffa_value ffa_memory_send(struct vm_locked from_locked,
25 				 struct ffa_memory_region *memory_region,
26 				 uint32_t memory_share_length,
27 				 uint32_t fragment_length, uint32_t share_func,
28 				 struct mpool *page_pool);
29 struct ffa_value ffa_memory_send_continue(struct vm_locked from_locked,
30 					  void *fragment,
31 					  uint32_t fragment_length,
32 					  ffa_memory_handle_t handle,
33 					  struct mpool *page_pool);
34 struct ffa_value ffa_memory_retrieve(struct vm_locked to_locked,
35 				     struct ffa_memory_region *retrieve_request,
36 				     uint32_t retrieve_request_length,
37 				     struct mpool *page_pool);
38 struct ffa_value ffa_memory_retrieve_continue(struct vm_locked to_locked,
39 					      ffa_memory_handle_t handle,
40 					      uint32_t fragment_offset,
41 					      ffa_id_t sender_vm_id,
42 					      struct mpool *page_pool);
43 struct ffa_value ffa_memory_relinquish(
44 	struct vm_locked from_locked,
45 	struct ffa_mem_relinquish *relinquish_request, struct mpool *page_pool);
46 struct ffa_value ffa_memory_reclaim(struct vm_locked to_locked,
47 				    ffa_memory_handle_t handle,
48 				    ffa_memory_region_flags_t flags,
49 				    struct mpool *page_pool);
50