headsmp.S 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. .globl shmobile_boot_size
  40. shmobile_boot_size:
  41. .long . - shmobile_boot_vector
  42. /*
  43. * Per-CPU SMP boot function/argument selection code based on MPIDR
  44. */
  45. ENTRY(shmobile_smp_boot)
  46. @ r0 = MPIDR_HWID_BITMASK
  47. mrc p15, 0, r1, c0, c0, 5 @ r1 = MPIDR
  48. and r0, r1, r0 @ r0 = cpu_logical_map() value
  49. mov r1, #0 @ r1 = CPU index
  50. adr r5, 1f @ array of per-cpu mpidr values
  51. adr r6, 2f @ array of per-cpu functions
  52. adr r7, 3f @ array of per-cpu arguments
  53. shmobile_smp_boot_find_mpidr:
  54. ldr r8, [r5, r1, lsl #2]
  55. cmp r8, r0
  56. bne shmobile_smp_boot_next
  57. ldr r9, [r6, r1, lsl #2]
  58. cmp r9, #0
  59. bne shmobile_smp_boot_found
  60. shmobile_smp_boot_next:
  61. add r1, r1, #1
  62. cmp r1, #CONFIG_NR_CPUS
  63. blo shmobile_smp_boot_find_mpidr
  64. b shmobile_smp_sleep
  65. shmobile_smp_boot_found:
  66. ldr r0, [r7, r1, lsl #2]
  67. mov pc, r9
  68. ENDPROC(shmobile_smp_boot)
  69. ENTRY(shmobile_smp_sleep)
  70. wfi
  71. b shmobile_smp_boot
  72. ENDPROC(shmobile_smp_sleep)
  73. .globl shmobile_smp_mpidr
  74. shmobile_smp_mpidr:
  75. 1: .space CONFIG_NR_CPUS * 4
  76. .globl shmobile_smp_fn
  77. shmobile_smp_fn:
  78. 2: .space CONFIG_NR_CPUS * 4
  79. .globl shmobile_smp_arg
  80. shmobile_smp_arg:
  81. 3: .space CONFIG_NR_CPUS * 4