1
2
3
4
5
6
7#include <config.h>
8#include <linux/linkage.h>
9#include <asm/macro.h>
10#include <asm/system.h>
11#include <asm/arch/mp.h>
12
13.align 3
14.global secondary_boot_addr
15secondary_boot_addr:
16 .quad __secondary_boot_func
17
18.global secondary_boot_code_start
19secondary_boot_code_start:
20 .quad __secondary_boot_code_start
21
22.global secondary_boot_code_size
23secondary_boot_code_size:
24 .quad __secondary_boot_code_end - __secondary_boot_code_start
25
26
27 .align 3
28
29__secondary_boot_code_start:
30__spin_table:
31 .space CONFIG_MAX_CPUS*SPIN_TABLE_ELEM_SIZE
32
33 .align 2
34__secondary_boot_func:
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 mrs x0, mpidr_el1
54 ubfm x1, x0,
55 ubfm x2, x0,
56 orr x10, x2, x1, lsl
57 ubfm x9, x0,
58
59
60
61
62 lsl x1, x10,
63 adr x0, __spin_table
64
65 add x11, x1, x0
66
67 adr x0, __real_cntfrq
68 ldr x0, [x0]
69 msr cntfrq_el0, x0
70 str x9, [x11,
71 mov x4,
72 str x4, [x11,
73 dsb sy
74
751:
76 wfe
77 ldr x4, [x11]
78 cbz x4, 1b
79 mrs x1, sctlr_el2
80 tbz x1,
81 rev x4, x4
822:
83 ldr x6, =ES_TO_AARCH64
84#ifdef CONFIG_ARMV8_SWITCH_TO_EL1
85 adr x5, 3f
86 switch_el x7, 0f, _dead_loop, _dead_loop
870: armv8_switch_to_el2_m x5, x6, x7
88#endif
893:
90 ldr x7, [x11,
91 cbz x7, 4f
92 ldr x6, =ES_TO_AARCH32
934:
94#ifdef CONFIG_ARMV8_SWITCH_TO_EL1
95 switch_el x7, _dead_loop, 0f, _dead_loop
960: armv8_switch_to_el1_m x4, x6, x7
97#else
98 switch_el x7, 0f, _dead_loop, _dead_loop
990: armv8_switch_to_el2_m x4, x6, x7
100#endif
101
102_dead_loop:
103 wfe
104 b _dead_loop
105
106
107
108
109
110 .ltorg
111
112
113 .align 3
114 .global __real_cntfrq
115__real_cntfrq:
116 .quad COUNTER_FREQUENCY
117
118__secondary_boot_code_end:
119