xref: /rk3399_ARM-atf/bl2/aarch64/bl2_el3_entrypoint.S (revision dfdb73f77317b1349e383c5836454db67f8643d3)
1/*
2 * Copyright (c) 2017-2025, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <platform_def.h>
8
9#include <arch.h>
10#include <asm_macros.S>
11#include <common/bl_common.h>
12#include <el3_common_macros.S>
13
14	.globl	bl2_entrypoint
15
16#if BL2_IN_XIP_MEM || ENABLE_RME
17#define FIXUP_SIZE	0
18#else
19#define FIXUP_SIZE	((BL2_LIMIT) - (BL2_BASE))
20#endif
21
22func bl2_entrypoint
23	/* Save arguments x0-x3 from previous Boot loader */
24	mov	x20, x0
25	mov	x21, x1
26	mov	x22, x2
27	mov	x23, x3
28
29	el3_entrypoint_common							\
30		_init_sctlr=RESET_TO_BL2					\
31		_warm_boot_mailbox=!PROGRAMMABLE_RESET_ADDRESS && RESET_TO_BL2	\
32		_secondary_cold_boot=!COLD_BOOT_SINGLE_CPU && RESET_TO_BL2	\
33		_init_memory=RESET_TO_BL2					\
34		_init_c_runtime=1						\
35		_exception_vectors=bl2_el3_exceptions				\
36		_pie_fixup_size=FIXUP_SIZE
37
38	/* ---------------------------------------------
39	 * Restore parameters of boot rom
40	 * ---------------------------------------------
41	 */
42	mov	x0, x20
43	mov	x1, x21
44	mov	x2, x22
45	mov	x3, x23
46
47	/* ---------------------------------------------
48	 * Jump to main function.
49	 * ---------------------------------------------
50	 */
51	bl	bl2_main
52
53	/* ---------------------------------------------
54	 * Should never reach this point.
55	 * ---------------------------------------------
56	 */
57	no_ret	plat_panic_handler
58endfunc bl2_entrypoint
59