xref: /openbmc/u-boot/arch/arm/include/asm/secure.h (revision 6e87ae1c)
1 #ifndef __ASM_SECURE_H
2 #define __ASM_SECURE_H
3 
4 #include <config.h>
5 
6 #define __secure __attribute__ ((section ("._secure.text")))
7 #define __secure_data __attribute__ ((section ("._secure.data")))
8 
9 #if defined(CONFIG_ARMV7_SECURE_BASE) || defined(CONFIG_ARMV8_SECURE_BASE)
10 /*
11  * Warning, horror ahead.
12  *
13  * The target code lives in our "secure ram", but u-boot doesn't know
14  * that, and has blindly added reloc_off to every relocation
15  * entry. Gahh. Do the opposite conversion. This hack also prevents
16  * GCC from generating code veeners, which u-boot doesn't relocate at
17  * all...
18  */
19 #define secure_ram_addr(_fn) ({						\
20 			DECLARE_GLOBAL_DATA_PTR;			\
21 			void *__fn = _fn;				\
22 			typeof(_fn) *__tmp = (__fn - gd->reloc_off);	\
23 			__tmp;						\
24 		})
25 #else
26 #define secure_ram_addr(_fn)	(_fn)
27 #endif
28 
29 #endif
30