Roberto Vargas | e0e9946 | 2017-10-30 14:43:43 +0000 | [diff] [blame] | 1 | /* |
Zelalem Aweke | 688fbf7 | 2021-07-09 11:37:10 -0500 | [diff] [blame] | 2 | * Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved. |
Roberto Vargas | e0e9946 | 2017-10-30 14:43:43 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Masahiro Yamada | 65d699d | 2020-01-17 13:45:02 +0900 | [diff] [blame] | 7 | #include <platform_def.h> |
| 8 | |
Roberto Vargas | e0e9946 | 2017-10-30 14:43:43 +0000 | [diff] [blame] | 9 | #include <arch.h> |
| 10 | #include <asm_macros.S> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 11 | #include <common/bl_common.h> |
Roberto Vargas | e0e9946 | 2017-10-30 14:43:43 +0000 | [diff] [blame] | 12 | #include <el3_common_macros.S> |
| 13 | |
| 14 | .globl bl2_entrypoint |
Roberto Vargas | e0e9946 | 2017-10-30 14:43:43 +0000 | [diff] [blame] | 15 | |
Masahiro Yamada | 65d699d | 2020-01-17 13:45:02 +0900 | [diff] [blame] | 16 | #if BL2_IN_XIP_MEM |
| 17 | #define FIXUP_SIZE 0 |
| 18 | #else |
| 19 | #define FIXUP_SIZE ((BL2_LIMIT) - (BL2_BASE)) |
| 20 | #endif |
| 21 | |
Roberto Vargas | e0e9946 | 2017-10-30 14:43:43 +0000 | [diff] [blame] | 22 | func 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 Pandey | c825768 | 2019-11-26 11:34:17 +0000 | [diff] [blame] | 35 | _exception_vectors=bl2_el3_exceptions \ |
Masahiro Yamada | 65d699d | 2020-01-17 13:45:02 +0900 | [diff] [blame] | 36 | _pie_fixup_size=FIXUP_SIZE |
Roberto Vargas | e0e9946 | 2017-10-30 14:43:43 +0000 | [diff] [blame] | 37 | |
Antonio Nino Diaz | 4f29fb7 | 2019-01-31 17:40:44 +0000 | [diff] [blame] | 38 | /* --------------------------------------------- |
Roberto Vargas | e0e9946 | 2017-10-30 14:43:43 +0000 | [diff] [blame] | 39 | * Restore parameters of boot rom |
Antonio Nino Diaz | 4f29fb7 | 2019-01-31 17:40:44 +0000 | [diff] [blame] | 40 | * --------------------------------------------- |
Roberto Vargas | e0e9946 | 2017-10-30 14:43:43 +0000 | [diff] [blame] | 41 | */ |
| 42 | mov x0, x20 |
| 43 | mov x1, x21 |
| 44 | mov x2, x22 |
| 45 | mov x3, x23 |
| 46 | |
Antonio Nino Diaz | 4f29fb7 | 2019-01-31 17:40:44 +0000 | [diff] [blame] | 47 | /* --------------------------------------------- |
| 48 | * Perform BL2 setup |
| 49 | * --------------------------------------------- |
| 50 | */ |
| 51 | bl bl2_el3_setup |
| 52 | |
Antonio Nino Diaz | 4f29fb7 | 2019-01-31 17:40:44 +0000 | [diff] [blame] | 53 | #if ENABLE_PAUTH |
Alexei Fedorov | 90f2e88 | 2019-05-24 12:17:09 +0100 | [diff] [blame] | 54 | /* --------------------------------------------- |
Alexei Fedorov | f41355c | 2019-09-13 14:11:59 +0100 | [diff] [blame] | 55 | * Program APIAKey_EL1 and enable pointer authentication. |
Alexei Fedorov | 90f2e88 | 2019-05-24 12:17:09 +0100 | [diff] [blame] | 56 | * --------------------------------------------- |
| 57 | */ |
Alexei Fedorov | f41355c | 2019-09-13 14:11:59 +0100 | [diff] [blame] | 58 | bl pauth_init_enable_el3 |
Antonio Nino Diaz | 4f29fb7 | 2019-01-31 17:40:44 +0000 | [diff] [blame] | 59 | #endif /* ENABLE_PAUTH */ |
Roberto Vargas | e0e9946 | 2017-10-30 14:43:43 +0000 | [diff] [blame] | 60 | |
| 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 |
| 72 | endfunc bl2_entrypoint |