headsmp.S 2.0 KB

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