Elyes HAOUAS | f50b662 | 2020-07-19 14:00:43 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | |
Asami Doi | f795242 | 2019-06-11 16:01:31 +0900 | [diff] [blame] | 3 | /* |
| 4 | * Early initialization code for aarch64 (a.k.a. armv8) |
Asami Doi | f795242 | 2019-06-11 16:01:31 +0900 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <arch/asm.h> |
| 8 | |
| 9 | ENTRY(_start) |
| 10 | /* Setup CPU. */ |
| 11 | bl arm64_init_cpu |
| 12 | |
| 13 | /* Get code positions. */ |
| 14 | ldr x1, =_flash |
| 15 | ldr x0, =_bootblock |
| 16 | |
| 17 | /* Calculate bootblock size. */ |
| 18 | ldr x2, =_ebootblock |
| 19 | sub x2, x2, x0 |
| 20 | |
| 21 | /* Call memcpy in arch/arm64/memcpy.S */ |
| 22 | bl memcpy |
| 23 | dmb sy |
| 24 | |
| 25 | /* Calculate relocation offset between bootblock in flash and in DRAM. */ |
Elyes HAOUAS | fd8de18 | 2020-03-31 21:42:02 +0200 | [diff] [blame] | 26 | ldr x0, =_flash |
Asami Doi | f795242 | 2019-06-11 16:01:31 +0900 | [diff] [blame] | 27 | ldr x1, =_bootblock |
| 28 | sub x1, x1, x0 |
| 29 | |
| 30 | /* Jump to main() in DRAM. */ |
| 31 | adr x0, main |
| 32 | add x0, x0, x1 |
| 33 | blr x0 |
| 34 | ENDPROC(_start) |