1/*
2 * Copyright (c) 2021, Arm Limited. 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
17func bl2_entrypoint
18	/* Save arguments x0-x3 from previous Boot loader */
19	mov	x20, x0
20	mov	x21, x1
21	mov	x22, x2
22	mov	x23, x3
23
24	el3_entrypoint_common                                   \
25		_init_sctlr=0                                   \
26		_warm_boot_mailbox=0                            \
27		_secondary_cold_boot=0                          \
28		_init_memory=0                                  \
29		_init_c_runtime=1                               \
30		_exception_vectors=bl2_el3_exceptions           \
31		_pie_fixup_size=0
32
33	/* ---------------------------------------------
34	 * Restore parameters of boot rom
35	 * ---------------------------------------------
36	 */
37	mov	x0, x20
38	mov	x1, x21
39	mov	x2, x22
40	mov	x3, x23
41
42	/* ---------------------------------------------
43	 * Perform BL2 setup
44	 * ---------------------------------------------
45	 */
46	bl	bl2_setup
47
48#if ENABLE_PAUTH
49	/* ---------------------------------------------
50	 * Program APIAKey_EL1 and enable pointer authentication.
51	 * ---------------------------------------------
52	 */
53	bl	pauth_init_enable_el3
54#endif /* ENABLE_PAUTH */
55
56	/* ---------------------------------------------
57	 * Jump to main function.
58	 * ---------------------------------------------
59	 */
60	bl	bl2_main
61
62	/* ---------------------------------------------
63	 * Should never reach this point.
64	 * ---------------------------------------------
65	 */
66	no_ret	plat_panic_handler
67endfunc bl2_entrypoint
68