Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Dave Gerlach | cdd1737 | 2017-01-12 14:52:18 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Defines for the SRAM driver |
Dave Gerlach | cdd1737 | 2017-01-12 14:52:18 -0600 | [diff] [blame] | 4 | */ |
| 5 | #ifndef __SRAM_H |
| 6 | #define __SRAM_H |
| 7 | |
| 8 | struct sram_partition { |
| 9 | void __iomem *base; |
| 10 | |
| 11 | struct gen_pool *pool; |
| 12 | struct bin_attribute battr; |
| 13 | struct mutex lock; |
| 14 | struct list_head list; |
| 15 | }; |
| 16 | |
| 17 | struct sram_dev { |
| 18 | struct device *dev; |
| 19 | void __iomem *virt_base; |
| 20 | |
| 21 | struct gen_pool *pool; |
| 22 | struct clk *clk; |
| 23 | |
| 24 | struct sram_partition *partition; |
| 25 | u32 partitions; |
| 26 | }; |
| 27 | |
| 28 | struct sram_reserve { |
| 29 | struct list_head list; |
| 30 | u32 start; |
| 31 | u32 size; |
| 32 | bool export; |
| 33 | bool pool; |
Dave Gerlach | 37afff0 | 2017-01-12 14:52:20 -0600 | [diff] [blame] | 34 | bool protect_exec; |
Dave Gerlach | cdd1737 | 2017-01-12 14:52:18 -0600 | [diff] [blame] | 35 | const char *label; |
| 36 | }; |
Dave Gerlach | 728bbe7 | 2017-01-12 14:52:19 -0600 | [diff] [blame] | 37 | |
| 38 | #ifdef CONFIG_SRAM_EXEC |
| 39 | int sram_check_protect_exec(struct sram_dev *sram, struct sram_reserve *block, |
| 40 | struct sram_partition *part); |
| 41 | int sram_add_protect_exec(struct sram_partition *part); |
| 42 | #else |
| 43 | static inline int sram_check_protect_exec(struct sram_dev *sram, |
| 44 | struct sram_reserve *block, |
| 45 | struct sram_partition *part) |
| 46 | { |
| 47 | return -ENODEV; |
| 48 | } |
| 49 | |
| 50 | static inline int sram_add_protect_exec(struct sram_partition *part) |
| 51 | { |
| 52 | return -ENODEV; |
| 53 | } |
| 54 | #endif /* CONFIG_SRAM_EXEC */ |
Dave Gerlach | cdd1737 | 2017-01-12 14:52:18 -0600 | [diff] [blame] | 55 | #endif /* __SRAM_H */ |