1 /*
2  * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef SPMC_SVC_H
8 #define SPMC_SVC_H
9 
10 #ifndef __ASSEMBLER__
11 #include <services/ffa_svc.h>
12 #include <stdint.h>
13 
14 #include <lib/utils_def.h>
15 
16 /*
17  * IDs defined for accessing services implemented by the Secure Partition
18  * Manager from the Secure Partition(s). These services enable a partition to
19  * handle delegated events and request privileged operations from the manager.
20  * They occupy the range 0x60-0x7f.
21  */
22 #define SP_EVENT_COMPLETE_AARCH64		U(0xC4000061)
23 #define SP_MEMORY_ATTRIBUTES_GET_AARCH64	U(0xC4000064)
24 #define SP_MEMORY_ATTRIBUTES_SET_AARCH64	U(0xC4000065)
25 
26 int spmc_setup(void);
27 void *spmc_get_config_addr(void);
28 
29 void spmc_set_config_addr(uintptr_t soc_fw_config);
30 
31 uint64_t spmc_smc_handler(uint32_t smc_fid,
32 			  bool secure_origin,
33 			  uint64_t x1,
34 			  uint64_t x2,
35 			  uint64_t x3,
36 			  uint64_t x4,
37 			  void *cookie,
38 			  void *handle,
39 			  uint64_t flags);
40 
41 #if SPMC_AT_EL3
is_spmc_at_el3(void)42 inline bool is_spmc_at_el3(void)
43 {
44 	return true;
45 }
46 #else
is_spmc_at_el3(void)47 inline bool is_spmc_at_el3(void)
48 {
49 	return false;
50 }
51 #endif /* SPMC_AT_EL3 */
52 
53 #endif /* __ASSEMBLER__ */
54 
55 #endif /* SPMC_SVC_H */
56