headsmp.S 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #ifdef CONFIG_SMP
  19. ENTRY(shmobile_invalidate_start)
  20. bl v7_invalidate_l1
  21. b secondary_startup
  22. ENDPROC(shmobile_invalidate_start)
  23. #endif
  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. .arm
  30. .align 12
  31. ENTRY(shmobile_boot_vector)
  32. ldr r0, 2f
  33. ldr r1, 1f
  34. bx r1
  35. ENDPROC(shmobile_boot_vector)
  36. .align 2
  37. .globl shmobile_boot_fn
  38. shmobile_boot_fn:
  39. 1: .space 4
  40. .globl shmobile_boot_arg
  41. shmobile_boot_arg:
  42. 2: .space 4
  43. .globl shmobile_boot_size
  44. shmobile_boot_size:
  45. .long . - shmobile_boot_vector
  46. /*
  47. * Per-CPU SMP boot function/argument selection code based on MPIDR
  48. */
  49. ENTRY(shmobile_smp_boot)
  50. @ r0 = MPIDR_HWID_BITMASK
  51. mrc p15, 0, r1, c0, c0, 5 @ r1 = MPIDR
  52. and r0, r1, r0 @ r0 = cpu_logical_map() value
  53. mov r1, #0 @ r1 = CPU index
  54. adr r5, 1f @ array of per-cpu mpidr values
  55. adr r6, 2f @ array of per-cpu functions
  56. adr r7, 3f @ array of per-cpu arguments
  57. shmobile_smp_boot_find_mpidr:
  58. ldr r8, [r5, r1, lsl #2]
  59. cmp r8, r0
  60. bne shmobile_smp_boot_next
  61. ldr r9, [r6, r1, lsl #2]
  62. cmp r9, #0
  63. bne shmobile_smp_boot_found
  64. shmobile_smp_boot_next:
  65. add r1, r1, #1
  66. cmp r1, #NR_CPUS
  67. blo shmobile_smp_boot_find_mpidr
  68. b shmobile_smp_sleep
  69. shmobile_smp_boot_found:
  70. ldr r0, [r7, r1, lsl #2]
  71. ret r9
  72. ENDPROC(shmobile_smp_boot)
  73. ENTRY(shmobile_smp_sleep)
  74. wfi
  75. b shmobile_smp_boot
  76. ENDPROC(shmobile_smp_sleep)
  77. .globl shmobile_smp_mpidr
  78. shmobile_smp_mpidr:
  79. 1: .space NR_CPUS * 4
  80. .globl shmobile_smp_fn
  81. shmobile_smp_fn:
  82. 2: .space NR_CPUS * 4
  83. .globl shmobile_smp_arg
  84. shmobile_smp_arg:
  85. 3: .space NR_CPUS * 4