headsmp.S 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #include <linux/linkage.h>
  15. #include <asm/assembler.h>
  16. #include <asm/cp15.h>
  17. ENTRY(uniphier_smp_trampoline)
  18. ARM_BE8(setend be) @ ensure we are in BE8 mode
  19. mrc p15, 0, r0, c0, c0, 5 @ MPIDR (Multiprocessor Affinity Reg)
  20. and r2, r0, #0x3 @ CPU ID
  21. ldr r1, uniphier_smp_trampoline_jump
  22. ldr r3, uniphier_smp_trampoline_poll_addr
  23. mrc p15, 0, r0, c1, c0, 0 @ SCTLR (System Control Register)
  24. orr r0, r0, #CR_I @ Enable ICache
  25. bic r0, r0, #(CR_C | CR_M) @ Disable MMU and Dcache
  26. mcr p15, 0, r0, c1, c0, 0
  27. b 1f @ cache the following 5 instructions
  28. 0: wfe
  29. 1: ldr r0, [r3]
  30. cmp r0, r2
  31. bxeq r1 @ branch to secondary_startup
  32. b 0b
  33. .globl uniphier_smp_trampoline_jump
  34. uniphier_smp_trampoline_jump:
  35. .word 0 @ set virt_to_phys(secondary_startup)
  36. .globl uniphier_smp_trampoline_poll_addr
  37. uniphier_smp_trampoline_poll_addr:
  38. .word 0 @ set CPU ID to be kicked to this reg
  39. .globl uniphier_smp_trampoline_end
  40. uniphier_smp_trampoline_end:
  41. ENDPROC(uniphier_smp_trampoline)