blob: 4bfa1fa6ad27bb76b57c61543e05dbedc4c98535 [file] [log] [blame]
Soby Mathewb911cc72017-02-13 12:46:28 +00001/*
Julius Werner2a231e32019-05-28 21:03:58 -07002 * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
Soby Mathewb911cc72017-02-13 12:46:28 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soby Mathewb911cc72017-02-13 12:46:28 +00005 */
6
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#ifndef EP_INFO_H
8#define EP_INFO_H
Soby Mathewb911cc72017-02-13 12:46:28 +00009
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010#include <common/param_header.h>
Soby Mathewb911cc72017-02-13 12:46:28 +000011
Julius Werner53456fc2019-07-09 13:49:11 -070012#ifndef __ASSEMBLER__
Julius Werner2a231e32019-05-28 21:03:58 -070013#include <stdint.h>
14#include <lib/cassert.h>
Julius Werner53456fc2019-07-09 13:49:11 -070015#endif /* __ASSEMBLER__ */
Julius Werner2a231e32019-05-28 21:03:58 -070016
17#include <export/common/ep_info_exp.h>
18
19#define SECURE EP_SECURE
20#define NON_SECURE EP_NON_SECURE
Soby Mathewb911cc72017-02-13 12:46:28 +000021#define sec_state_is_valid(s) (((s) == SECURE) || ((s) == NON_SECURE))
22
Julius Werner2a231e32019-05-28 21:03:58 -070023#define PARAM_EP_SECURITY_MASK EP_SECURITY_MASK
Soby Mathewb911cc72017-02-13 12:46:28 +000024
Julius Werner2a231e32019-05-28 21:03:58 -070025#define NON_EXECUTABLE EP_NON_EXECUTABLE
26#define EXECUTABLE EP_EXECUTABLE
Soby Mathewb911cc72017-02-13 12:46:28 +000027
Antonio Nino Diaz5f658c32018-06-26 21:42:51 +010028/* Secure or Non-secure image */
Julius Werner2a231e32019-05-28 21:03:58 -070029#define GET_SECURITY_STATE(x) ((x) & EP_SECURITY_MASK)
Soby Mathewb911cc72017-02-13 12:46:28 +000030#define SET_SECURITY_STATE(x, security) \
Julius Werner2a231e32019-05-28 21:03:58 -070031 ((x) = ((x) & ~EP_SECURITY_MASK) | (security))
Soby Mathewb911cc72017-02-13 12:46:28 +000032
Julius Werner53456fc2019-07-09 13:49:11 -070033#ifndef __ASSEMBLER__
Soby Mathewb911cc72017-02-13 12:46:28 +000034
Soby Mathewb911cc72017-02-13 12:46:28 +000035/*
36 * Compile time assertions related to the 'entry_point_info' structure to
37 * ensure that the assembler and the compiler view of the offsets of
38 * the structure members is the same.
39 */
40CASSERT(ENTRY_POINT_INFO_PC_OFFSET ==
41 __builtin_offsetof(entry_point_info_t, pc), \
42 assert_BL31_pc_offset_mismatch);
43
Julius Werner8e0ef0f2019-07-09 14:02:43 -070044#ifndef __aarch64__
Etienne Carriere094041d2018-02-02 13:16:18 +010045CASSERT(ENTRY_POINT_INFO_LR_SVC_OFFSET ==
46 __builtin_offsetof(entry_point_info_t, lr_svc),
47 assert_entrypoint_lr_offset_error);
48#endif
49
Soby Mathewb911cc72017-02-13 12:46:28 +000050CASSERT(ENTRY_POINT_INFO_ARGS_OFFSET == \
51 __builtin_offsetof(entry_point_info_t, args), \
52 assert_BL31_args_offset_mismatch);
53
54CASSERT(sizeof(uintptr_t) ==
55 __builtin_offsetof(entry_point_info_t, spsr) - \
56 __builtin_offsetof(entry_point_info_t, pc), \
57 assert_entrypoint_and_spsr_should_be_adjacent);
58
Julius Werner53456fc2019-07-09 13:49:11 -070059#endif /*__ASSEMBLER__*/
Soby Mathewb911cc72017-02-13 12:46:28 +000060
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000061#endif /* EP_INFO_H */