neoverse_n1_pubsub.c 722 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) 2018-2019, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <neoverse_n1.h>
  7. #include <cpuamu.h>
  8. #include <lib/el3_runtime/pubsub_events.h>
  9. static void *neoverse_n1_context_save(const void *arg)
  10. {
  11. if (midr_match(NEOVERSE_N1_MIDR) != 0)
  12. cpuamu_context_save(NEOVERSE_N1_AMU_NR_COUNTERS);
  13. return (void *)0;
  14. }
  15. static void *neoverse_n1_context_restore(const void *arg)
  16. {
  17. if (midr_match(NEOVERSE_N1_MIDR) != 0)
  18. cpuamu_context_restore(NEOVERSE_N1_AMU_NR_COUNTERS);
  19. return (void *)0;
  20. }
  21. SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_start, neoverse_n1_context_save);
  22. SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_finish, neoverse_n1_context_restore);