Commit | Line | Data |
---|---|---|
1c51ed4f MD |
1 | /* |
2 | * SMP support for R-Mobile / SH-Mobile | |
3 | * | |
4 | * Copyright (C) 2010 Magnus Damm | |
5 | * Copyright (C) 2010 Takashi Yoshii | |
6 | * | |
7 | * Based on vexpress, Copyright (c) 2003 ARM Limited, All Rights Reserved | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License version 2 as | |
11 | * published by the Free Software Foundation. | |
12 | */ | |
13 | #include <linux/linkage.h> | |
14 | #include <linux/init.h> | |
6ebbf2ce | 15 | #include <asm/assembler.h> |
6155f77d | 16 | #include <asm/memory.h> |
1c51ed4f | 17 | |
e994d5eb MD |
18 | ENTRY(shmobile_invalidate_start) |
19 | bl v7_invalidate_l1 | |
20 | b secondary_startup | |
21 | ENDPROC(shmobile_invalidate_start) | |
22 | ||
1c51ed4f MD |
23 | /* |
24 | * Reset vector for secondary CPUs. | |
25 | * This will be mapped at address 0 by SBAR register. | |
26 | * We need _long_ jump to the physical address. | |
27 | */ | |
c1d7e2e8 | 28 | .arm |
1c51ed4f | 29 | .align 12 |
ebe72ab9 MD |
30 | ENTRY(shmobile_boot_vector) |
31 | ldr r0, 2f | |
c1d7e2e8 TK |
32 | ldr r1, 1f |
33 | bx r1 | |
34 | ||
ebe72ab9 MD |
35 | ENDPROC(shmobile_boot_vector) |
36 | ||
0b933cb3 | 37 | .align 2 |
ebe72ab9 MD |
38 | .globl shmobile_boot_fn |
39 | shmobile_boot_fn: | |
40 | 1: .space 4 | |
41 | .globl shmobile_boot_arg | |
42 | shmobile_boot_arg: | |
43 | 2: .space 4 | |
a84a5ab7 MD |
44 | .globl shmobile_boot_size |
45 | shmobile_boot_size: | |
46 | .long . - shmobile_boot_vector | |
cc61591e MD |
47 | |
48 | /* | |
49 | * Per-CPU SMP boot function/argument selection code based on MPIDR | |
50 | */ | |
51 | ||
52 | ENTRY(shmobile_smp_boot) | |
53 | @ r0 = MPIDR_HWID_BITMASK | |
54 | mrc p15, 0, r1, c0, c0, 5 @ r1 = MPIDR | |
55 | and r0, r1, r0 @ r0 = cpu_logical_map() value | |
56 | mov r1, #0 @ r1 = CPU index | |
57 | adr r5, 1f @ array of per-cpu mpidr values | |
58 | adr r6, 2f @ array of per-cpu functions | |
59 | adr r7, 3f @ array of per-cpu arguments | |
60 | ||
61 | shmobile_smp_boot_find_mpidr: | |
62 | ldr r8, [r5, r1, lsl #2] | |
63 | cmp r8, r0 | |
64 | bne shmobile_smp_boot_next | |
65 | ||
66 | ldr r9, [r6, r1, lsl #2] | |
67 | cmp r9, #0 | |
68 | bne shmobile_smp_boot_found | |
69 | ||
70 | shmobile_smp_boot_next: | |
71 | add r1, r1, #1 | |
72 | cmp r1, #CONFIG_NR_CPUS | |
73 | blo shmobile_smp_boot_find_mpidr | |
74 | ||
75 | b shmobile_smp_sleep | |
76 | ||
77 | shmobile_smp_boot_found: | |
78 | ldr r0, [r7, r1, lsl #2] | |
6ebbf2ce | 79 | ret r9 |
cc61591e MD |
80 | ENDPROC(shmobile_smp_boot) |
81 | ||
82 | ENTRY(shmobile_smp_sleep) | |
83 | wfi | |
84 | b shmobile_smp_boot | |
85 | ENDPROC(shmobile_smp_sleep) | |
86 | ||
87 | .globl shmobile_smp_mpidr | |
88 | shmobile_smp_mpidr: | |
89 | 1: .space CONFIG_NR_CPUS * 4 | |
90 | .globl shmobile_smp_fn | |
91 | shmobile_smp_fn: | |
92 | 2: .space CONFIG_NR_CPUS * 4 | |
93 | .globl shmobile_smp_arg | |
94 | shmobile_smp_arg: | |
95 | 3: .space CONFIG_NR_CPUS * 4 |