2 * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
8 #include <asm_macros.S>
9 #include <common/bl_common.h>
17 /*---------------------------------------------
18 * Save arguments x0 - x3 from BL1 for future
20 * ---------------------------------------------
27 /* ---------------------------------------------
28 * Set the exception vector to something sane.
29 * ---------------------------------------------
31 adr x0, early_exceptions
35 /* ---------------------------------------------
36 * Enable the SError interrupt now that the
37 * exception vectors have been setup.
38 * ---------------------------------------------
40 msr daifclr, #DAIF_ABT_BIT
42 /* ---------------------------------------------
43 * Enable the instruction cache, stack pointer
44 * and data access alignment checks
45 * ---------------------------------------------
47 mov x1, #(SCTLR_I_BIT | SCTLR_A_BIT | SCTLR_SA_BIT)
53 /* ---------------------------------------------
54 * Invalidate the RW memory used by the BL2
55 * image. This includes the data and NOBITS
56 * sections. This is done to safeguard against
57 * possible corruption of this memory by dirty
58 * cache lines in a system cache as a result of
59 * use by an earlier boot loader stage.
60 * ---------------------------------------------
67 /* ---------------------------------------------
68 * Zero out NOBITS sections. There are 2 of them:
70 * - the coherent memory section.
71 * ---------------------------------------------
73 adrp x0, __BSS_START__
74 add x0, x0, :lo12:__BSS_START__
76 add x1, x1, :lo12:__BSS_END__
81 adrp x0, __COHERENT_RAM_START__
82 add x0, x0, :lo12:__COHERENT_RAM_START__
83 adrp x1, __COHERENT_RAM_END_UNALIGNED__
84 add x1, x1, :lo12:__COHERENT_RAM_END_UNALIGNED__
89 /* --------------------------------------------
90 * Allocate a stack whose memory will be marked
91 * as Normal-IS-WBWA when the MMU is enabled.
92 * There is no risk of reading stale stack
93 * memory after enabling the MMU as only the
94 * primary cpu is running at the moment.
95 * --------------------------------------------
99 /* ---------------------------------------------
100 * Initialize the stack protector canary before
101 * any C code is called.
102 * ---------------------------------------------
104 #if STACK_PROTECTOR_ENABLED
105 bl update_stack_protector_canary
108 /* ---------------------------------------------
109 * Perform early platform setup & platform
110 * specific early arch. setup e.g. mmu setup
111 * ---------------------------------------------
117 bl bl2_early_platform_setup2
119 bl bl2_plat_arch_setup
121 /* ---------------------------------------------
122 * Jump to main function.
123 * ---------------------------------------------
127 /* ---------------------------------------------
128 * Should never reach this point.
129 * ---------------------------------------------
131 no_ret plat_panic_handler
133 endfunc bl2_entrypoint