headsmp.S 2.0 KB

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