cpu_psci.c 892 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2006-2019, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-02-21 GuEe-GUI replace with drivers/psci
  9. */
  10. #include <rthw.h>
  11. #include <rtthread.h>
  12. #define DBG_TAG "cpu.aa64"
  13. #define DBG_LVL DBG_INFO
  14. #include <rtdbg.h>
  15. #include <cpu.h>
  16. #include <cpuport.h>
  17. #include <psci.h>
  18. static int psci_cpu_boot(rt_uint32_t cpuid, rt_uint64_t entry)
  19. {
  20. return rt_psci_cpu_on(cpuid, entry);
  21. }
  22. static void psci_cpu_shutdown(void)
  23. {
  24. rt_uint32_t state, state_id = PSCI_POWER_STATE_ID(0, 0, 0, PSCI_POWER_STATE_ID_POWERDOWN);
  25. state = PSCI_POWER_STATE(PSCI_POWER_STATE_LEVEL_CORES, PSCI_POWER_STATE_TYPE_STANDBY, state_id);
  26. rt_psci_cpu_off(state);
  27. }
  28. struct cpu_ops_t cpu_psci_ops =
  29. {
  30. .method = "psci",
  31. .cpu_boot = psci_cpu_boot,
  32. .cpu_shutdown = psci_cpu_shutdown,
  33. };