Commit | Line | Data |
---|---|---|
18280eda DD |
1 | /* |
2 | * This file is subject to the terms and conditions of the GNU General Public | |
3 | * License. See the file "COPYING" in the main directory of this archive | |
4 | * for more details. | |
5 | * | |
6 | * Copyright (C) 2013 Cavium, Inc | |
7 | */ | |
8 | #ifndef __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H | |
9 | #define __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H | |
10 | ||
11 | #define CP0_EBASE $15, 1 | |
12 | ||
13 | .macro kernel_entry_setup | |
951c39cd | 14 | #ifdef CONFIG_SMP |
18280eda DD |
15 | mfc0 t0, CP0_EBASE |
16 | andi t0, t0, 0x3ff # CPUNum | |
17 | beqz t0, 1f | |
18 | # CPUs other than zero goto smp_bootstrap | |
19 | j smp_bootstrap | |
951c39cd | 20 | #endif /* CONFIG_SMP */ |
18280eda DD |
21 | |
22 | 1: | |
23 | .endm | |
24 | ||
25 | /* | |
26 | * Do SMP slave processor setup necessary before we can safely execute | |
27 | * C code. | |
28 | */ | |
29 | .macro smp_slave_setup | |
30 | mfc0 t0, CP0_EBASE | |
31 | andi t0, t0, 0x3ff # CPUNum | |
32 | slti t1, t0, NR_CPUS | |
33 | bnez t1, 1f | |
34 | 2: | |
35 | di | |
36 | wait | |
37 | b 2b # Unknown CPU, loop forever. | |
38 | 1: | |
39 | PTR_LA t1, paravirt_smp_sp | |
40 | PTR_SLL t0, PTR_SCALESHIFT | |
41 | PTR_ADDU t1, t1, t0 | |
42 | 3: | |
43 | PTR_L sp, 0(t1) | |
44 | beqz sp, 3b # Spin until told to proceed. | |
45 | ||
46 | PTR_LA t1, paravirt_smp_gp | |
47 | PTR_ADDU t1, t1, t0 | |
48 | sync | |
49 | PTR_L gp, 0(t1) | |
50 | .endm | |
51 | ||
52 | #endif /* __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H */ |