cpu_dormant.S 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. .global write_cntpctl
  2. write_cntpctl:
  3. .func
  4. msr CNTP_CTL_EL0, x0
  5. ret
  6. .endfunc
  7. .global read_cntpctl
  8. read_cntpctl:
  9. .func
  10. mrs x0, CNTP_CTL_EL0
  11. ret
  12. .endfunc
  13. .global read_cpu_id
  14. read_cpu_id:
  15. .func
  16. mrs x0, MPIDR_EL1
  17. ands x0, x0, #0xff
  18. ret
  19. .endfunc
  20. .global read_cluster_id
  21. read_cluster_id:
  22. .func
  23. mrs x0, MPIDR_EL1
  24. lsr x0, x0, #0x8
  25. ands x0, x0, #0xff
  26. ret
  27. .endfunc
  28. .global mt_save_generic_timer
  29. mt_save_generic_timer:
  30. .func
  31. mrs x3, CNTKCTL_EL1
  32. str x3, [x0, #0]
  33. mrs x2, CNTP_CTL_EL0
  34. mrs x3, CNTP_TVAL_EL0
  35. stp x2, x3, [x0, #8]
  36. mrs x2, CNTV_CTL_EL0
  37. mrs x3, CNTV_TVAL_EL0
  38. stp x2, x3, [x0, #24]!
  39. ret
  40. .endfunc
  41. .global mt_restore_generic_timer
  42. mt_restore_generic_timer:
  43. .func
  44. ldr x3, [x0, #0]
  45. msr CNTKCTL_EL1, x3
  46. ldp x2, x3, [x0, #8]
  47. msr CNTP_CTL_EL0, x2
  48. msr CNTP_TVAL_EL0, x3
  49. ldp x2, x3, [x0, #24]
  50. msr CNTV_CTL_EL0, x2
  51. msr CNTV_TVAL_EL0, x3
  52. ret
  53. .endfunc