2 * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
8 #include <asm_macros.S>
12 .globl bl2_vector_table
16 vector_base bl2_vector_table
18 b report_exception /* Undef */
19 b report_exception /* SVC call */
20 b report_exception /* Prefetch abort */
21 b report_exception /* Data abort */
22 b report_exception /* Reserved */
23 b report_exception /* IRQ */
24 b report_exception /* FIQ */
28 /*---------------------------------------------
29 * Save arguments x0 - x3 from BL1 for future
31 * ---------------------------------------------
38 /* ---------------------------------------------
39 * Set the exception vector to something sane.
40 * ---------------------------------------------
42 ldr r0, =bl2_vector_table
46 /* -----------------------------------------------------
47 * Enable the instruction cache
48 * -----------------------------------------------------
51 orr r0, r0, #SCTLR_I_BIT
55 /* ---------------------------------------------
56 * Since BL2 executes after BL1, it is assumed
57 * here that BL1 has already has done the
58 * necessary register initializations.
59 * ---------------------------------------------
62 /* ---------------------------------------------
63 * Invalidate the RW memory used by the BL2
64 * image. This includes the data and NOBITS
65 * sections. This is done to safeguard against
66 * possible corruption of this memory by dirty
67 * cache lines in a system cache as a result of
68 * use by an earlier boot loader stage.
69 * ---------------------------------------------
76 /* ---------------------------------------------
77 * Zero out NOBITS sections. There are 2 of them:
79 * - the coherent memory section.
80 * ---------------------------------------------
82 ldr r0, =__BSS_START__
87 ldr r0, =__COHERENT_RAM_START__
88 ldr r1, =__COHERENT_RAM_UNALIGNED_SIZE__
92 /* --------------------------------------------
93 * Allocate a stack whose memory will be marked
94 * as Normal-IS-WBWA when the MMU is enabled.
95 * There is no risk of reading stale stack
96 * memory after enabling the MMU as only the
97 * primary cpu is running at the moment.
98 * --------------------------------------------
102 /* ---------------------------------------------
103 * Initialize the stack protector canary before
104 * any C code is called.
105 * ---------------------------------------------
107 #if STACK_PROTECTOR_ENABLED
108 bl update_stack_protector_canary
111 /* ---------------------------------------------
112 * Perform early platform setup & platform
113 * specific early arch. setup e.g. mmu setup
114 * ---------------------------------------------
120 bl bl2_early_platform_setup2
121 bl bl2_plat_arch_setup
123 /* ---------------------------------------------
124 * Jump to main function.
125 * ---------------------------------------------
129 /* ---------------------------------------------
130 * Should never reach this point.
131 * ---------------------------------------------
133 no_ret plat_panic_handler
135 endfunc bl2_entrypoint