summaryrefslogtreecommitdiff
path: root/include/runtime_services/secure_el0_payloads/secure_partition.h
blob: 906fa2b9b836dd2ed88ef1e436d23129f0bd8c26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef __SECURE_PARTITION_H__
#define __SECURE_PARTITION_H__

#include <utils_def.h>

/*
 * Definitions used to access the members of secure_partition_boot_info from
 * assembly code.
 */
#define SP_BOOT_INFO_STACK_BASE_OFFSET		U(32)
#define SP_BOOT_INFO_IMAGE_SIZE_OFFSET		U(64)
#define SP_BOOT_INFO_PCPU_STACK_SIZE_OFFSET	U(72)

#ifndef __ASSEMBLY__

#include <cassert.h>
#include <param_header.h>
#include <types.h>

/*
 * Flags used by the secure_partition_mp_info structure to describe the
 * characteristics of a cpu. Only a single flag is defined at the moment to
 * indicate the primary cpu.
 */
#define MP_INFO_FLAG_PRIMARY_CPU	U(0x00000001)

/*
 * This structure is used to provide information required to initialise a S-EL0
 * partition.
 */
typedef struct secure_partition_mp_info {
	u_register_t		mpidr;
	unsigned int		linear_id;
	unsigned int		flags;
} secure_partition_mp_info_t;

typedef struct secure_partition_boot_info {
	param_header_t		h;
	uintptr_t		sp_mem_base;
	uintptr_t		sp_mem_limit;
	uintptr_t		sp_image_base;
	uintptr_t		sp_stack_base;
	uintptr_t		sp_heap_base;
	uintptr_t		sp_ns_comm_buf_base;
	uintptr_t		sp_shared_buf_base;
	size_t			sp_image_size;
	size_t			sp_pcpu_stack_size;
	size_t			sp_heap_size;
	size_t			sp_ns_comm_buf_size;
	size_t			sp_shared_buf_size;
	unsigned int		num_sp_mem_regions;
	unsigned int		num_cpus;
	secure_partition_mp_info_t	*mp_info;
} secure_partition_boot_info_t;

/*
 * Compile time assertions related to the 'secure_partition_boot_info' structure
 * to ensure that the assembler and the compiler view of the offsets of the
 * structure members is the same.
 */
CASSERT(SP_BOOT_INFO_STACK_BASE_OFFSET ==
	__builtin_offsetof(secure_partition_boot_info_t, sp_stack_base), \
	assert_secure_partition_boot_info_sp_stack_base_offset_mismatch);

CASSERT(SP_BOOT_INFO_IMAGE_SIZE_OFFSET ==
	__builtin_offsetof(secure_partition_boot_info_t, sp_image_size), \
	assert_secure_partition_boot_info_sp_image_size_offset_mismatch);

CASSERT(SP_BOOT_INFO_PCPU_STACK_SIZE_OFFSET ==
	__builtin_offsetof(secure_partition_boot_info_t, sp_pcpu_stack_size), \
	assert_secure_partition_boot_info_sp_pcpu_stack_size_offset_mismatch);

#endif /* __ASSEMBLY__ */

#endif /* __SECURE_PARTITION_H__ */