blob: 45bac7da183bf564b0639f212c16f35a21e3ecda [file] [log] [blame]
Roberto Vargase0e99462017-10-30 14:43:43 +00001/*
Zelalem Aweke688fbf72021-07-09 11:37:10 -05002 * Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved.
Roberto Vargase0e99462017-10-30 14:43:43 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Masahiro Yamada65d699d2020-01-17 13:45:02 +09007#include <platform_def.h>
8
Roberto Vargase0e99462017-10-30 14:43:43 +00009#include <arch.h>
10#include <asm_macros.S>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000011#include <common/bl_common.h>
Roberto Vargase0e99462017-10-30 14:43:43 +000012#include <el3_common_macros.S>
13
14 .globl bl2_entrypoint
Roberto Vargase0e99462017-10-30 14:43:43 +000015
Masahiro Yamada65d699d2020-01-17 13:45:02 +090016#if BL2_IN_XIP_MEM
17#define FIXUP_SIZE 0
18#else
19#define FIXUP_SIZE ((BL2_LIMIT) - (BL2_BASE))
20#endif
21
Roberto Vargase0e99462017-10-30 14:43:43 +000022func 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=1 \
31 _warm_boot_mailbox=!PROGRAMMABLE_RESET_ADDRESS \
32 _secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \
33 _init_memory=1 \
34 _init_c_runtime=1 \
Manish Pandeyc8257682019-11-26 11:34:17 +000035 _exception_vectors=bl2_el3_exceptions \
Masahiro Yamada65d699d2020-01-17 13:45:02 +090036 _pie_fixup_size=FIXUP_SIZE
Roberto Vargase0e99462017-10-30 14:43:43 +000037
Antonio Nino Diaz4f29fb72019-01-31 17:40:44 +000038 /* ---------------------------------------------
Roberto Vargase0e99462017-10-30 14:43:43 +000039 * Restore parameters of boot rom
Antonio Nino Diaz4f29fb72019-01-31 17:40:44 +000040 * ---------------------------------------------
Roberto Vargase0e99462017-10-30 14:43:43 +000041 */
42 mov x0, x20
43 mov x1, x21
44 mov x2, x22
45 mov x3, x23
46
Antonio Nino Diaz4f29fb72019-01-31 17:40:44 +000047 /* ---------------------------------------------
48 * Perform BL2 setup
49 * ---------------------------------------------
50 */
51 bl bl2_el3_setup
52
Antonio Nino Diaz4f29fb72019-01-31 17:40:44 +000053#if ENABLE_PAUTH
Alexei Fedorov90f2e882019-05-24 12:17:09 +010054 /* ---------------------------------------------
Alexei Fedorovf41355c2019-09-13 14:11:59 +010055 * Program APIAKey_EL1 and enable pointer authentication.
Alexei Fedorov90f2e882019-05-24 12:17:09 +010056 * ---------------------------------------------
57 */
Alexei Fedorovf41355c2019-09-13 14:11:59 +010058 bl pauth_init_enable_el3
Antonio Nino Diaz4f29fb72019-01-31 17:40:44 +000059#endif /* ENABLE_PAUTH */
Roberto Vargase0e99462017-10-30 14:43:43 +000060
61 /* ---------------------------------------------
62 * Jump to main function.
63 * ---------------------------------------------
64 */
65 bl bl2_main
66
67 /* ---------------------------------------------
68 * Should never reach this point.
69 * ---------------------------------------------
70 */
71 no_ret plat_panic_handler
72endfunc bl2_entrypoint