bl1_entrypoint.S 3.43 KB
Newer Older
1
/*
johpow01's avatar
johpow01 committed
2
 * Copyright (c) 2013-2021, Arm Limited and Contributors. All rights reserved.
3
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
 */

7
#include <arch.h>
johpow01's avatar
johpow01 committed
8
#include <common/bl_common.h>
9
#include <el3_common_macros.S>
10

11
	.globl	bl1_entrypoint
johpow01's avatar
johpow01 committed
12
	.globl	bl1_run_bl2_in_root
13
14
15


	/* -----------------------------------------------------
16
	 * bl1_entrypoint() is the entry point into the trusted
17
18
19
20
21
	 * firmware code when a cpu is released from warm or
	 * cold reset.
	 * -----------------------------------------------------
	 */

22
func bl1_entrypoint
23
24
25
26
27
28
	/* ---------------------------------------------------------------------
	 * If the reset address is programmable then bl1_entrypoint() is
	 * executed only on the cold boot path. Therefore, we can skip the warm
	 * boot mailbox mechanism.
	 * ---------------------------------------------------------------------
	 */
29
	el3_entrypoint_common					\
30
		_init_sctlr=1					\
31
		_warm_boot_mailbox=!PROGRAMMABLE_RESET_ADDRESS	\
32
		_secondary_cold_boot=!COLD_BOOT_SINGLE_CPU	\
33
34
		_init_memory=1					\
		_init_c_runtime=1				\
35
36
		_exception_vectors=bl1_exceptions		\
		_pie_fixup_size=0
37

38
39
40
	/* --------------------------------------------------------------------
	 * Perform BL1 setup
	 * --------------------------------------------------------------------
41
	 */
42
	bl	bl1_setup
43

44
#if ENABLE_PAUTH
45
	/* --------------------------------------------------------------------
46
	 * Program APIAKey_EL1 and enable pointer authentication.
47
48
	 * --------------------------------------------------------------------
	 */
49
	bl	pauth_init_enable_el3
50
51
52
#endif /* ENABLE_PAUTH */

	/* --------------------------------------------------------------------
53
	 * Initialize platform and jump to our c-entry point
54
	 * for this type of reset.
55
	 * --------------------------------------------------------------------
56
57
	 */
	bl	bl1_main
58

59
#if ENABLE_PAUTH
60
	/* --------------------------------------------------------------------
61
	 * Disable pointer authentication before jumping to next boot image.
62
63
	 * --------------------------------------------------------------------
	 */
64
	bl	pauth_disable_el3
65
66
#endif /* ENABLE_PAUTH */

67
68
69
70
71
	/* --------------------------------------------------
	 * Do the transition to next boot image.
	 * --------------------------------------------------
	 */
	b	el3_exit
72
endfunc bl1_entrypoint
johpow01's avatar
johpow01 committed
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

	/* -----------------------------------------------------
	 * void bl1_run_bl2_in_root(entry_point_info_t *ep_info);
	 * This function runs BL2 in root/EL3 when RME is enabled.
	 * -----------------------------------------------------
	 */

#if ENABLE_RME
func bl1_run_bl2_in_root
	mov	x20,x0

	/* ---------------------------------------------
	 * MMU needs to be disabled because BL2 executes
	 * in EL3. It will initialize the address space
	 * according to its own requirements.
	 * ---------------------------------------------
	 */
	bl	disable_mmu_icache_el3
	tlbi	alle3

#if ENABLE_PAUTH
	/* ---------------------------------------------
	 * Disable pointer authentication before jumping
	 * to next boot image.
	 * ---------------------------------------------
	 */
	bl	pauth_disable_el3
#endif /* ENABLE_PAUTH */

	ldp	x0, x1, [x20, #ENTRY_POINT_INFO_PC_OFFSET]
	msr	elr_el3, x0
	msr	spsr_el3, x1

	ldp	x6, x7, [x20, #(ENTRY_POINT_INFO_ARGS_OFFSET + 0x30)]
	ldp	x4, x5, [x20, #(ENTRY_POINT_INFO_ARGS_OFFSET + 0x20)]
	ldp	x2, x3, [x20, #(ENTRY_POINT_INFO_ARGS_OFFSET + 0x10)]
	ldp	x0, x1, [x20, #(ENTRY_POINT_INFO_ARGS_OFFSET + 0x0)]
	exception_return
endfunc bl1_run_bl2_in_root
#endif /* ENABLE_RME */