xref: /rk3399_ARM-atf/include/common/ep_info.h (revision 57bf6057721306d1ad1af1122a831789ded92885)
15dffb46cSSoby Mathew /*
2*57bf6057SJulius Werner  * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
35dffb46cSSoby Mathew  *
482cb2c1aSdp-arm  * SPDX-License-Identifier: BSD-3-Clause
55dffb46cSSoby Mathew  */
65dffb46cSSoby Mathew 
7c3cf06f1SAntonio Nino Diaz #ifndef EP_INFO_H
8c3cf06f1SAntonio Nino Diaz #define EP_INFO_H
95dffb46cSSoby Mathew 
1009d40e0eSAntonio Nino Diaz #include <common/param_header.h>
115dffb46cSSoby Mathew 
125dffb46cSSoby Mathew #ifndef __ASSEMBLY__
1393c78ed2SAntonio Nino Diaz #include <stdint.h>
1409d40e0eSAntonio Nino Diaz #include <lib/cassert.h>
15*57bf6057SJulius Werner #endif /* __ASSEMBLY__ */
1609d40e0eSAntonio Nino Diaz 
17*57bf6057SJulius Werner #include <export/common/ep_info_exp.h>
185dffb46cSSoby Mathew 
19*57bf6057SJulius Werner #define SECURE		EP_SECURE
20*57bf6057SJulius Werner #define NON_SECURE	EP_NON_SECURE
21*57bf6057SJulius Werner #define sec_state_is_valid(s) (((s) == SECURE) || ((s) == NON_SECURE))
225dffb46cSSoby Mathew 
23*57bf6057SJulius Werner #define PARAM_EP_SECURITY_MASK	EP_SECURITY_MASK
24*57bf6057SJulius Werner 
25*57bf6057SJulius Werner #define NON_EXECUTABLE	EP_NON_EXECUTABLE
26*57bf6057SJulius Werner #define EXECUTABLE	EP_EXECUTABLE
27*57bf6057SJulius Werner 
28*57bf6057SJulius Werner /* Secure or Non-secure image */
29*57bf6057SJulius Werner #define GET_SECURITY_STATE(x) ((x) & EP_SECURITY_MASK)
30*57bf6057SJulius Werner #define SET_SECURITY_STATE(x, security) \
31*57bf6057SJulius Werner 			((x) = ((x) & ~EP_SECURITY_MASK) | (security))
32*57bf6057SJulius Werner 
33*57bf6057SJulius Werner #ifndef __ASSEMBLY__
345dffb46cSSoby Mathew 
355dffb46cSSoby Mathew /*
365dffb46cSSoby Mathew  * Compile time assertions related to the 'entry_point_info' structure to
375dffb46cSSoby Mathew  * ensure that the assembler and the compiler view of the offsets of
385dffb46cSSoby Mathew  * the structure members is the same.
395dffb46cSSoby Mathew  */
405dffb46cSSoby Mathew CASSERT(ENTRY_POINT_INFO_PC_OFFSET ==
415dffb46cSSoby Mathew 		__builtin_offsetof(entry_point_info_t, pc), \
425dffb46cSSoby Mathew 		assert_BL31_pc_offset_mismatch);
435dffb46cSSoby Mathew 
443fe81dcfSEtienne Carriere #ifdef AARCH32
453fe81dcfSEtienne Carriere CASSERT(ENTRY_POINT_INFO_LR_SVC_OFFSET ==
463fe81dcfSEtienne Carriere 		__builtin_offsetof(entry_point_info_t, lr_svc),
473fe81dcfSEtienne Carriere 		assert_entrypoint_lr_offset_error);
483fe81dcfSEtienne Carriere #endif
493fe81dcfSEtienne Carriere 
505dffb46cSSoby Mathew CASSERT(ENTRY_POINT_INFO_ARGS_OFFSET == \
515dffb46cSSoby Mathew 		__builtin_offsetof(entry_point_info_t, args), \
525dffb46cSSoby Mathew 		assert_BL31_args_offset_mismatch);
535dffb46cSSoby Mathew 
545dffb46cSSoby Mathew CASSERT(sizeof(uintptr_t) ==
555dffb46cSSoby Mathew 		__builtin_offsetof(entry_point_info_t, spsr) - \
565dffb46cSSoby Mathew 		__builtin_offsetof(entry_point_info_t, pc), \
575dffb46cSSoby Mathew 		assert_entrypoint_and_spsr_should_be_adjacent);
585dffb46cSSoby Mathew 
595dffb46cSSoby Mathew #endif /*__ASSEMBLY__*/
605dffb46cSSoby Mathew 
61c3cf06f1SAntonio Nino Diaz #endif /* EP_INFO_H */
62