stm32mp_shared_resources.h 1.8 KB

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