sram.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Defines for the SRAM driver
  4. */
  5. #ifndef __SRAM_H
  6. #define __SRAM_H
  7. struct sram_config {
  8. int (*init)(void);
  9. bool map_only_reserved;
  10. };
  11. struct sram_partition {
  12. void __iomem *base;
  13. struct gen_pool *pool;
  14. struct bin_attribute battr;
  15. struct mutex lock;
  16. struct list_head list;
  17. };
  18. struct sram_dev {
  19. const struct sram_config *config;
  20. struct device *dev;
  21. void __iomem *virt_base;
  22. bool no_memory_wc;
  23. struct gen_pool *pool;
  24. struct sram_partition *partition;
  25. u32 partitions;
  26. };
  27. struct sram_reserve {
  28. struct list_head list;
  29. u32 start;
  30. u32 size;
  31. struct resource res;
  32. bool export;
  33. bool pool;
  34. bool protect_exec;
  35. const char *label;
  36. };
  37. #ifdef CONFIG_SRAM_EXEC
  38. int sram_check_protect_exec(struct sram_dev *sram, struct sram_reserve *block,
  39. struct sram_partition *part);
  40. int sram_add_protect_exec(struct sram_partition *part);
  41. #else
  42. static inline int sram_check_protect_exec(struct sram_dev *sram,
  43. struct sram_reserve *block,
  44. struct sram_partition *part)
  45. {
  46. return -ENODEV;
  47. }
  48. static inline int sram_add_protect_exec(struct sram_partition *part)
  49. {
  50. return -ENODEV;
  51. }
  52. #endif /* CONFIG_SRAM_EXEC */
  53. #endif /* __SRAM_H */