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 /* Register a GPIO as secure or non-secure based on its bank and pin numbers */ 33 void stm32mp_register_secure_gpio(unsigned int bank, unsigned int pin); 34 void stm32mp_register_non_secure_gpio(unsigned int bank, unsigned int pin); 35 36 /* Consolidate peripheral states and lock against new peripheral registering */ 37 void stm32mp_lock_periph_registering(void); 38 #else stm32mp_register_secure_periph_iomem(uintptr_t base __unused)39static inline void stm32mp_register_secure_periph_iomem(uintptr_t base __unused) 40 { 41 } 42 43 static inline stm32mp_register_non_secure_periph_iomem(uintptr_t base __unused)44void stm32mp_register_non_secure_periph_iomem(uintptr_t base __unused) 45 { 46 } 47 stm32mp_register_secure_gpio(unsigned int bank __unused,unsigned int pin __unused)48static inline void stm32mp_register_secure_gpio(unsigned int bank __unused, 49 unsigned int pin __unused) 50 { 51 } 52 stm32mp_register_non_secure_gpio(unsigned int bank __unused,unsigned int pin __unused)53static inline void stm32mp_register_non_secure_gpio(unsigned int bank __unused, 54 unsigned int pin __unused) 55 { 56 } 57 #endif /* STM32MP_SHARED_RESOURCES */ 58 #endif /* STM32MP_SHARED_RESOURCES_H */ 59