xref: /arm-trusted-firmware/services/std_svc/spm/common/include/spm_common.h (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu /*
2*91f16700Schasinglulu  * Copyright (c) 2017-2023, ARM Limited and Contributors. All rights reserved.
3*91f16700Schasinglulu  *
4*91f16700Schasinglulu  * SPDX-License-Identifier: BSD-3-Clause
5*91f16700Schasinglulu  */
6*91f16700Schasinglulu 
7*91f16700Schasinglulu #ifndef SPM_COMMON_H
8*91f16700Schasinglulu #define SPM_COMMON_H
9*91f16700Schasinglulu 
10*91f16700Schasinglulu #include <context.h>
11*91f16700Schasinglulu 
12*91f16700Schasinglulu /*******************************************************************************
13*91f16700Schasinglulu  * Constants that allow assembler code to preserve callee-saved registers of the
14*91f16700Schasinglulu  * C runtime context while performing a security state switch.
15*91f16700Schasinglulu  ******************************************************************************/
16*91f16700Schasinglulu #define SP_C_RT_CTX_X19		0x0
17*91f16700Schasinglulu #define SP_C_RT_CTX_X20		0x8
18*91f16700Schasinglulu #define SP_C_RT_CTX_X21		0x10
19*91f16700Schasinglulu #define SP_C_RT_CTX_X22		0x18
20*91f16700Schasinglulu #define SP_C_RT_CTX_X23		0x20
21*91f16700Schasinglulu #define SP_C_RT_CTX_X24		0x28
22*91f16700Schasinglulu #define SP_C_RT_CTX_X25		0x30
23*91f16700Schasinglulu #define SP_C_RT_CTX_X26		0x38
24*91f16700Schasinglulu #define SP_C_RT_CTX_X27		0x40
25*91f16700Schasinglulu #define SP_C_RT_CTX_X28		0x48
26*91f16700Schasinglulu #define SP_C_RT_CTX_X29		0x50
27*91f16700Schasinglulu #define SP_C_RT_CTX_X30		0x58
28*91f16700Schasinglulu 
29*91f16700Schasinglulu #define SP_C_RT_CTX_SIZE	0x60
30*91f16700Schasinglulu #define SP_C_RT_CTX_ENTRIES	(SP_C_RT_CTX_SIZE >> DWORD_SHIFT)
31*91f16700Schasinglulu 
32*91f16700Schasinglulu #ifndef __ASSEMBLER__
33*91f16700Schasinglulu 
34*91f16700Schasinglulu #include <stdint.h>
35*91f16700Schasinglulu #include <lib/xlat_tables/xlat_tables_v2.h>
36*91f16700Schasinglulu 
37*91f16700Schasinglulu /* Assembly helpers */
38*91f16700Schasinglulu uint64_t spm_secure_partition_enter(uint64_t *c_rt_ctx);
39*91f16700Schasinglulu void __dead2 spm_secure_partition_exit(uint64_t c_rt_ctx, uint64_t ret);
40*91f16700Schasinglulu 
41*91f16700Schasinglulu /* Helper to obtain a reference to the SP's translation table context */
42*91f16700Schasinglulu xlat_ctx_t *spm_get_sp_xlat_context(void);
43*91f16700Schasinglulu 
44*91f16700Schasinglulu #endif /* __ASSEMBLER__ */
45*91f16700Schasinglulu 
46*91f16700Schasinglulu #endif /* SPM_COMMON_H */
47