xref: /rk3399_ARM-atf/plat/st/common/include/stm32mp_shared_resources.h (revision 0651b5b77ab3dcf526f6979ec631eb7781d4dad5)
1 /*
2  * Copyright (c) 2017-2020, STMicroelectronics - All Rights Reserved
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef STM32MP_SHARED_RESOURCES_H
8 #define STM32MP_SHARED_RESOURCES_H
9 
10 #include <stdbool.h>
11 #include <stdint.h>
12 
13 #ifdef STM32MP_SHARED_RESOURCES
14 enum stm32mp_shres;
15 
16 /* Return true if @clock_id is shared by secure and non-secure worlds */
17 bool stm32mp_nsec_can_access_clock(unsigned long clock_id);
18 
19 /* Return true if and only if @reset_id relates to a non-secure peripheral */
20 bool stm32mp_nsec_can_access_reset(unsigned int reset_id);
21 
22 /* Register a shared resource assigned to the secure world */
23 void stm32mp_register_secure_periph(enum stm32mp_shres id);
24 
25 /* Register a shared resource assigned to the non-secure world */
26 void stm32mp_register_non_secure_periph(enum stm32mp_shres id);
27 
28 /* Register a peripheral as secure or non-secure based on IO base address */
29 void stm32mp_register_secure_periph_iomem(uintptr_t base);
30 void stm32mp_register_non_secure_periph_iomem(uintptr_t base);
31 
32 /* Consolidate peripheral states and lock against new peripheral registering */
33 void stm32mp_lock_periph_registering(void);
34 #else
35 static inline void stm32mp_register_secure_periph_iomem(uintptr_t base __unused)
36 {
37 }
38 
39 static inline
40 void stm32mp_register_non_secure_periph_iomem(uintptr_t base __unused)
41 {
42 }
43 #endif /* STM32MP_SHARED_RESOURCES */
44 #endif /* STM32MP_SHARED_RESOURCES_H */
45