psci-common.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Common PSCI functions
  3. *
  4. * Copyright (C) 2016 Chen-Yu Tsai
  5. * Author: Chen-Yu Tsai <wens@csie.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include <config.h>
  20. #include <asm/armv7.h>
  21. #include <asm/macro.h>
  22. #include <asm/psci.h>
  23. #include <asm/secure.h>
  24. #include <linux/linkage.h>
  25. static u32 psci_target_pc[CONFIG_ARMV7_PSCI_NR_CPUS] __secure_data = { 0 };
  26. static u32 psci_context_id[CONFIG_ARMV7_PSCI_NR_CPUS] __secure_data = { 0 };
  27. void __secure psci_save_target_pc(int cpu, u32 pc)
  28. {
  29. psci_target_pc[cpu] = pc;
  30. psci_context_id[cpu] = 0;
  31. dsb();
  32. }
  33. void __secure psci_save(int cpu, u32 pc, u32 context_id)
  34. {
  35. psci_target_pc[cpu] = pc;
  36. psci_context_id[cpu] = context_id;
  37. dsb();
  38. }
  39. u32 __secure psci_get_target_pc(int cpu)
  40. {
  41. return psci_target_pc[cpu];
  42. }
  43. u32 __secure psci_get_context_id(int cpu)
  44. {
  45. return psci_context_id[cpu];
  46. }