diff options
-rw-r--r-- | arch/arm/mach-omap2/include/mach/omap-secure.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap-secure.c | 29 | ||||
-rw-r--r-- | arch/arm/plat-omap/common.c | 3 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap-secure.h | 13 |
4 files changed, 48 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/include/mach/omap-secure.h b/arch/arm/mach-omap2/include/mach/omap-secure.h index 26e7bcc49adc..29f60cae45e9 100644 --- a/arch/arm/mach-omap2/include/mach/omap-secure.h +++ b/arch/arm/mach-omap2/include/mach/omap-secure.h | |||
@@ -26,6 +26,8 @@ | |||
26 | #define FLAG_FIQ_ENABLE 0x1 | 26 | #define FLAG_FIQ_ENABLE 0x1 |
27 | #define NO_FLAG 0x0 | 27 | #define NO_FLAG 0x0 |
28 | 28 | ||
29 | /* Maximum Secure memory storage size */ | ||
30 | #define OMAP_SECURE_RAM_STORAGE (88 * SZ_1K) | ||
29 | 31 | ||
30 | /* Secure low power HAL API index */ | 32 | /* Secure low power HAL API index */ |
31 | #define OMAP4_HAL_SAVESECURERAM_INDEX 0x1a | 33 | #define OMAP4_HAL_SAVESECURERAM_INDEX 0x1a |
@@ -36,5 +38,6 @@ | |||
36 | extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, | 38 | extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, |
37 | u32 arg1, u32 arg2, u32 arg3, u32 arg4); | 39 | u32 arg1, u32 arg2, u32 arg3, u32 arg4); |
38 | extern u32 omap_smc2(u32 id, u32 falg, u32 pargs); | 40 | extern u32 omap_smc2(u32 id, u32 falg, u32 pargs); |
41 | extern phys_addr_t omap_secure_ram_mempool_base(void); | ||
39 | 42 | ||
40 | #endif /* OMAP_ARCH_OMAP_SECURE_H */ | 43 | #endif /* OMAP_ARCH_OMAP_SECURE_H */ |
diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c index e5a606e59b1e..69f3c72d959b 100644 --- a/arch/arm/mach-omap2/omap-secure.c +++ b/arch/arm/mach-omap2/omap-secure.c | |||
@@ -13,11 +13,14 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/memblock.h> | ||
16 | 17 | ||
17 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
18 | 19 | ||
19 | #include <mach/omap-secure.h> | 20 | #include <mach/omap-secure.h> |
20 | 21 | ||
22 | static phys_addr_t omap_secure_memblock_base; | ||
23 | |||
21 | /** | 24 | /** |
22 | * omap_sec_dispatcher: Routine to dispatch low power secure | 25 | * omap_sec_dispatcher: Routine to dispatch low power secure |
23 | * service routines | 26 | * service routines |
@@ -50,3 +53,29 @@ u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, u32 arg1, u32 arg2, | |||
50 | 53 | ||
51 | return ret; | 54 | return ret; |
52 | } | 55 | } |
56 | |||
57 | /* Allocate the memory to save secure ram */ | ||
58 | int __init omap_secure_ram_reserve_memblock(void) | ||
59 | { | ||
60 | phys_addr_t paddr; | ||
61 | u32 size = OMAP_SECURE_RAM_STORAGE; | ||
62 | |||
63 | size = ALIGN(size, SZ_1M); | ||
64 | paddr = memblock_alloc(size, SZ_1M); | ||
65 | if (!paddr) { | ||
66 | pr_err("%s: failed to reserve %x bytes\n", | ||
67 | __func__, size); | ||
68 | return -ENOMEM; | ||
69 | } | ||
70 | memblock_free(paddr, size); | ||
71 | memblock_remove(paddr, size); | ||
72 | |||
73 | omap_secure_memblock_base = paddr; | ||
74 | |||
75 | return 0; | ||
76 | } | ||
77 | |||
78 | phys_addr_t omap_secure_ram_mempool_base(void) | ||
79 | { | ||
80 | return omap_secure_memblock_base; | ||
81 | } | ||
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c index 2ee6341fffdb..06383b51e655 100644 --- a/arch/arm/plat-omap/common.c +++ b/arch/arm/plat-omap/common.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <plat/vram.h> | 22 | #include <plat/vram.h> |
23 | #include <plat/dsp.h> | 23 | #include <plat/dsp.h> |
24 | 24 | ||
25 | #include <plat/omap-secure.h> | ||
26 | |||
25 | 27 | ||
26 | #define NO_LENGTH_CHECK 0xffffffff | 28 | #define NO_LENGTH_CHECK 0xffffffff |
27 | 29 | ||
@@ -66,6 +68,7 @@ void __init omap_reserve(void) | |||
66 | omapfb_reserve_sdram_memblock(); | 68 | omapfb_reserve_sdram_memblock(); |
67 | omap_vram_reserve_sdram_memblock(); | 69 | omap_vram_reserve_sdram_memblock(); |
68 | omap_dsp_reserve_sdram_memblock(); | 70 | omap_dsp_reserve_sdram_memblock(); |
71 | omap_secure_ram_reserve_memblock(); | ||
69 | } | 72 | } |
70 | 73 | ||
71 | void __init omap_init_consistent_dma_size(void) | 74 | void __init omap_init_consistent_dma_size(void) |
diff --git a/arch/arm/plat-omap/include/plat/omap-secure.h b/arch/arm/plat-omap/include/plat/omap-secure.h new file mode 100644 index 000000000000..64f9d1c7f1bb --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap-secure.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef __OMAP_SECURE_H__ | ||
2 | #define __OMAP_SECURE_H__ | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #ifdef CONFIG_ARCH_OMAP2PLUS | ||
7 | extern int omap_secure_ram_reserve_memblock(void); | ||
8 | #else | ||
9 | static inline void omap_secure_ram_reserve_memblock(void) | ||
10 | { } | ||
11 | #endif | ||
12 | |||
13 | #endif /* __OMAP_SECURE_H__ */ | ||