cpu-reset.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * CPU reset routines
  3. *
  4. * Copyright (C) 2001 Deep Blue Solutions Ltd.
  5. * Copyright (C) 2012 ARM Ltd.
  6. * Copyright (C) 2015 Huawei Futurewei Technologies.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/linkage.h>
  13. #include <asm/assembler.h>
  14. #include <asm/sysreg.h>
  15. #include <asm/virt.h>
  16. .text
  17. .pushsection .idmap.text, "awx"
  18. /*
  19. * __cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2) - Helper for
  20. * cpu_soft_restart.
  21. *
  22. * @el2_switch: Flag to indicate a swich to EL2 is needed.
  23. * @entry: Location to jump to for soft reset.
  24. * arg0: First argument passed to @entry.
  25. * arg1: Second argument passed to @entry.
  26. * arg2: Third argument passed to @entry.
  27. *
  28. * Put the CPU into the same state as it would be if it had been reset, and
  29. * branch to what would be the reset vector. It must be executed with the
  30. * flat identity mapping.
  31. */
  32. ENTRY(__cpu_soft_restart)
  33. /* Clear sctlr_el1 flags. */
  34. mrs x12, sctlr_el1
  35. ldr x13, =SCTLR_ELx_FLAGS
  36. bic x12, x12, x13
  37. msr sctlr_el1, x12
  38. isb
  39. cbz x0, 1f // el2_switch?
  40. mov x0, #HVC_SOFT_RESTART
  41. hvc #0 // no return
  42. 1: mov x18, x1 // entry
  43. mov x0, x2 // arg0
  44. mov x1, x3 // arg1
  45. mov x2, x4 // arg2
  46. br x18
  47. ENDPROC(__cpu_soft_restart)
  48. .popsection