ARM: shmobile: Introduce per-CPU SMP boot / sleep code
[deliverable/linux.git] / arch / arm / mach-shmobile / headsmp.S
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>
15 #include <asm/memory.h>
16
17 __CPUINIT
18
19 ENTRY(shmobile_invalidate_start)
20 bl v7_invalidate_l1
21 b secondary_startup
22 ENDPROC(shmobile_invalidate_start)
23
24 /*
25 * Reset vector for secondary CPUs.
26 * This will be mapped at address 0 by SBAR register.
27 * We need _long_ jump to the physical address.
28 */
29 .align 12
30 ENTRY(shmobile_boot_vector)
31 ldr r0, 2f
32 ldr pc, 1f
33 ENDPROC(shmobile_boot_vector)
34
35 .globl shmobile_boot_fn
36 shmobile_boot_fn:
37 1: .space 4
38 .globl shmobile_boot_arg
39 shmobile_boot_arg:
40 2: .space 4
41
42 /*
43 * Per-CPU SMP boot function/argument selection code based on MPIDR
44 */
45
46 ENTRY(shmobile_smp_boot)
47 @ r0 = MPIDR_HWID_BITMASK
48 mrc p15, 0, r1, c0, c0, 5 @ r1 = MPIDR
49 and r0, r1, r0 @ r0 = cpu_logical_map() value
50 mov r1, #0 @ r1 = CPU index
51 adr r5, 1f @ array of per-cpu mpidr values
52 adr r6, 2f @ array of per-cpu functions
53 adr r7, 3f @ array of per-cpu arguments
54
55 shmobile_smp_boot_find_mpidr:
56 ldr r8, [r5, r1, lsl #2]
57 cmp r8, r0
58 bne shmobile_smp_boot_next
59
60 ldr r9, [r6, r1, lsl #2]
61 cmp r9, #0
62 bne shmobile_smp_boot_found
63
64 shmobile_smp_boot_next:
65 add r1, r1, #1
66 cmp r1, #CONFIG_NR_CPUS
67 blo shmobile_smp_boot_find_mpidr
68
69 b shmobile_smp_sleep
70
71 shmobile_smp_boot_found:
72 ldr r0, [r7, r1, lsl #2]
73 mov pc, r9
74 ENDPROC(shmobile_smp_boot)
75
76 ENTRY(shmobile_smp_sleep)
77 wfi
78 b shmobile_smp_boot
79 ENDPROC(shmobile_smp_sleep)
80
81 .globl shmobile_smp_mpidr
82 shmobile_smp_mpidr:
83 1: .space CONFIG_NR_CPUS * 4
84 .globl shmobile_smp_fn
85 shmobile_smp_fn:
86 2: .space CONFIG_NR_CPUS * 4
87 .globl shmobile_smp_arg
88 shmobile_smp_arg:
89 3: .space CONFIG_NR_CPUS * 4
This page took 0.035352 seconds and 5 git commands to generate.