blob: dd263c4060081635f62d6e5d81a2f4a1cefea4e1 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Peng Faneae4de22018-01-10 13:20:37 +08002/*
3 * Copyright 2017 NXP
Peng Faneae4de22018-01-10 13:20:37 +08004 */
5
6#include <config.h>
7
Peng Fan70db8892020-12-27 21:07:08 +08008.align 4
Peng Faneae4de22018-01-10 13:20:37 +08009.global rom_pointer
10rom_pointer:
11 .space 256
12
13/*
14 * Routine: save_boot_params (called after reset from start.S)
15 */
16
17.global save_boot_params
18save_boot_params:
19 /* The firmware provided ATAG/FDT address can be found in r2/x0 */
20 adr x0, rom_pointer
21 stp x1, x2, [x0], #16
22 stp x3, x4, [x0], #16
23 stp x5, x6, [x0], #16
24 stp x7, x8, [x0], #16
25 stp x9, x10, [x0], #16
26 stp x11, x12, [x0], #16
27 stp x13, x14, [x0], #16
28 stp x15, x16, [x0], #16
29 stp x17, x18, [x0], #16
30 stp x19, x20, [x0], #16
31 stp x21, x22, [x0], #16
32 stp x23, x24, [x0], #16
33 stp x25, x26, [x0], #16
34 stp x27, x28, [x0], #16
35 stp x29, x30, [x0], #16
36 mov x30, sp
37 str x30, [x0], #8
38
39 /* Returns */
40 b save_boot_params_ret
41
42.global restore_boot_params
43restore_boot_params:
44 adr x0, rom_pointer
45 ldp x1, x2, [x0], #16
46 ldp x3, x4, [x0], #16
47 ldp x5, x6, [x0], #16
48 ldp x7, x8, [x0], #16
49 ldp x9, x10, [x0], #16
50 ldp x11, x12, [x0], #16
51 ldp x13, x14, [x0], #16
52 ldp x15, x16, [x0], #16
53 ldp x17, x18, [x0], #16
54 ldp x19, x20, [x0], #16
55 ldp x21, x22, [x0], #16
56 ldp x23, x24, [x0], #16
57 ldp x25, x26, [x0], #16
58 ldp x27, x28, [x0], #16
59 ldp x29, x30, [x0], #16
60 ldr x0, [x0]
61 mov sp, x0
62 ret
Peng Fan85447c12020-07-10 11:22:20 +080063
64.global armv8_el2_to_aarch32
65armv8_el2_to_aarch32:
66 cmp x0, #0
67 bne 0f
68 mov x3, x2
69 mov x2, x1
70 mov x1, x4
71 ldr x0, =0xc20000fd
720:
73 smc #0
74 ret