blob: 2fc46c8da83b6994f7184e6af60bf7453936f19b [file] [log] [blame]
Antonio Nino Diazc41f2062017-10-24 10:07:35 +01001/*
2 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef __SPM_PRIVATE_H__
8#define __SPM_PRIVATE_H__
9
10#include <context.h>
11
12/*******************************************************************************
13 * Constants that allow assembler code to preserve callee-saved registers of the
14 * C runtime context while performing a security state switch.
15 ******************************************************************************/
16#define SP_C_RT_CTX_X19 0x0
17#define SP_C_RT_CTX_X20 0x8
18#define SP_C_RT_CTX_X21 0x10
19#define SP_C_RT_CTX_X22 0x18
20#define SP_C_RT_CTX_X23 0x20
21#define SP_C_RT_CTX_X24 0x28
22#define SP_C_RT_CTX_X25 0x30
23#define SP_C_RT_CTX_X26 0x38
24#define SP_C_RT_CTX_X27 0x40
25#define SP_C_RT_CTX_X28 0x48
26#define SP_C_RT_CTX_X29 0x50
27#define SP_C_RT_CTX_X30 0x58
28
29#define SP_C_RT_CTX_SIZE 0x60
30#define SP_C_RT_CTX_ENTRIES (SP_C_RT_CTX_SIZE >> DWORD_SHIFT)
31
32
33#ifndef __ASSEMBLY__
34
35#include <stdint.h>
36#include <xlat_tables_v2.h>
37
38/* Handle on the Secure partition translation context */
39extern xlat_ctx_t *secure_partition_xlat_ctx_handle;
40
41struct entry_point_info;
42
43typedef struct secure_partition_context {
44 uint64_t c_rt_ctx;
45 cpu_context_t cpu_ctx;
Antonio Nino Diazc58cb872017-12-18 10:51:58 +000046 unsigned int sp_init_in_progress;
Antonio Nino Diazc41f2062017-10-24 10:07:35 +010047} secure_partition_context_t;
48
49uint64_t spm_secure_partition_enter(uint64_t *c_rt_ctx);
50void __dead2 spm_secure_partition_exit(uint64_t c_rt_ctx, uint64_t ret);
51void spm_init_sp_ep_state(struct entry_point_info *sp_ep_info,
52 uint64_t pc,
53 secure_partition_context_t *sp_ctx_ptr);
54#endif /* __ASSEMBLY__ */
55
56#endif /* __SPM_PRIVATE_H__ */