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