1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2014, STMicroelectronics International N.V.
4  */
5 #ifndef TEE_L2CC_MUTEX_H
6 #define TEE_L2CC_MUTEX_H
7 #include <inttypes.h>
8 #include <tee_api_types.h>
9 #include <tee_api_defines.h>
10 #include <compiler.h>
11 
12 #if defined(CFG_PL310)
13 TEE_Result tee_enable_l2cc_mutex(void);
14 TEE_Result tee_disable_l2cc_mutex(void);
15 TEE_Result tee_get_l2cc_mutex(paddr_t *mutex);
16 TEE_Result tee_set_l2cc_mutex(paddr_t *mutex);
17 void tee_l2cc_mutex_lock(void);
18 void tee_l2cc_mutex_unlock(void);
19 
20 /*
21  * Store the pa of a mutex used for l2cc
22  * It is allocated from the boot
23  */
24 void tee_l2cc_store_mutex_boot_pa(uint32_t pa);
25 
26 #else
27 static TEE_Result tee_enable_l2cc_mutex(void);
28 static TEE_Result tee_disable_l2cc_mutex(void);
29 static TEE_Result tee_get_l2cc_mutex(paddr_t *mutex);
30 static TEE_Result tee_set_l2cc_mutex(paddr_t *mutex);
31 
tee_enable_l2cc_mutex(void)32 static inline TEE_Result tee_enable_l2cc_mutex(void)
33 {
34 	return TEE_ERROR_NOT_SUPPORTED;
35 }
tee_disable_l2cc_mutex(void)36 static inline TEE_Result tee_disable_l2cc_mutex(void)
37 {
38 	return TEE_ERROR_NOT_SUPPORTED;
39 }
tee_get_l2cc_mutex(paddr_t * mutex __unused)40 static inline TEE_Result tee_get_l2cc_mutex(paddr_t *mutex __unused)
41 {
42 	return TEE_ERROR_NOT_SUPPORTED;
43 }
tee_set_l2cc_mutex(paddr_t * mutex __unused)44 static inline TEE_Result tee_set_l2cc_mutex(paddr_t *mutex __unused)
45 {
46 	return TEE_ERROR_NOT_SUPPORTED;
47 }
48 #endif
49 
50 #endif /* TEE_L2CC_MUTEX_H */
51