1/*
2 * Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <asm_macros.S>
9#include <common/bl_common.h>
10#include <el3_common_macros.S>
11
12	.globl	bl2_entrypoint
13
14
15func bl2_entrypoint
16	/* Save arguments x0-x3 from previous Boot loader */
17	mov	r9, r0
18	mov	r10, r1
19	mov	r11, r2
20	mov	r12, r3
21
22	el3_entrypoint_common                                   \
23                _init_sctlr=1                                   \
24                _warm_boot_mailbox=!PROGRAMMABLE_RESET_ADDRESS  \
25                _secondary_cold_boot=!COLD_BOOT_SINGLE_CPU      \
26                _init_memory=1                                  \
27                _init_c_runtime=1                               \
28                _exception_vectors=bl2_vector_table		\
29		_pie_fixup_size=0
30
31	/*
32	 * Restore parameters of boot rom
33	 */
34	mov	r0, r9
35	mov	r1, r10
36	mov	r2, r11
37	mov	r3, r12
38
39	/* ---------------------------------------------
40	 * Perform BL2 setup
41	 * ---------------------------------------------
42	 */
43	bl	bl2_el3_setup
44
45	/* ---------------------------------------------
46	 * Jump to main function.
47	 * ---------------------------------------------
48	 */
49	bl	bl2_main
50
51	/* ---------------------------------------------
52	 * Should never reach this point.
53	 * ---------------------------------------------
54	 */
55	no_ret	plat_panic_handler
56
57endfunc bl2_entrypoint
58