147cf5d3fSEtienne Carriere /* 247cf5d3fSEtienne Carriere * Copyright (c) 2017-2020, STMicroelectronics - All Rights Reserved 347cf5d3fSEtienne Carriere * 447cf5d3fSEtienne Carriere * SPDX-License-Identifier: BSD-3-Clause 547cf5d3fSEtienne Carriere */ 647cf5d3fSEtienne Carriere 747cf5d3fSEtienne Carriere #ifndef STM32MP_SHARED_RESOURCES_H 847cf5d3fSEtienne Carriere #define STM32MP_SHARED_RESOURCES_H 947cf5d3fSEtienne Carriere 1047cf5d3fSEtienne Carriere #include <stdbool.h> 11*0651b5b7SEtienne Carriere #include <stdint.h> 1247cf5d3fSEtienne Carriere 1368450c94SEtienne Carriere #ifdef STM32MP_SHARED_RESOURCES 1468450c94SEtienne Carriere enum stm32mp_shres; 1568450c94SEtienne Carriere 1647cf5d3fSEtienne Carriere /* Return true if @clock_id is shared by secure and non-secure worlds */ 1747cf5d3fSEtienne Carriere bool stm32mp_nsec_can_access_clock(unsigned long clock_id); 1847cf5d3fSEtienne Carriere 1947cf5d3fSEtienne Carriere /* Return true if and only if @reset_id relates to a non-secure peripheral */ 2047cf5d3fSEtienne Carriere bool stm32mp_nsec_can_access_reset(unsigned int reset_id); 2147cf5d3fSEtienne Carriere 2268450c94SEtienne Carriere /* Register a shared resource assigned to the secure world */ 2368450c94SEtienne Carriere void stm32mp_register_secure_periph(enum stm32mp_shres id); 2468450c94SEtienne Carriere 2568450c94SEtienne Carriere /* Register a shared resource assigned to the non-secure world */ 2668450c94SEtienne Carriere void stm32mp_register_non_secure_periph(enum stm32mp_shres id); 2768450c94SEtienne Carriere 28*0651b5b7SEtienne Carriere /* Register a peripheral as secure or non-secure based on IO base address */ 29*0651b5b7SEtienne Carriere void stm32mp_register_secure_periph_iomem(uintptr_t base); 30*0651b5b7SEtienne Carriere void stm32mp_register_non_secure_periph_iomem(uintptr_t base); 31*0651b5b7SEtienne Carriere 325f038ac6SEtienne Carriere /* Consolidate peripheral states and lock against new peripheral registering */ 335f038ac6SEtienne Carriere void stm32mp_lock_periph_registering(void); 34*0651b5b7SEtienne Carriere #else 35*0651b5b7SEtienne Carriere static inline void stm32mp_register_secure_periph_iomem(uintptr_t base __unused) 36*0651b5b7SEtienne Carriere { 37*0651b5b7SEtienne Carriere } 38*0651b5b7SEtienne Carriere 39*0651b5b7SEtienne Carriere static inline 40*0651b5b7SEtienne Carriere void stm32mp_register_non_secure_periph_iomem(uintptr_t base __unused) 41*0651b5b7SEtienne Carriere { 42*0651b5b7SEtienne Carriere } 4368450c94SEtienne Carriere #endif /* STM32MP_SHARED_RESOURCES */ 4447cf5d3fSEtienne Carriere #endif /* STM32MP_SHARED_RESOURCES_H */ 45