xref: /rk3399_ARM-atf/lib/cpus/aarch64/cortex_a75_pubsub.c (revision 61f72a34250d063da67f4fc2b0eb8c3fda3376be)
1 /*
2  * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <cortex_a75.h>
8 #include <cpuamu.h>
9 #include <pubsub_events.h>
10 
11 static void *cortex_a75_context_save(const void *arg)
12 {
13 	if (midr_match(CORTEX_A75_MIDR) != 0)
14 		cpuamu_context_save(CORTEX_A75_AMU_NR_COUNTERS);
15 	return 0;
16 }
17 
18 static void *cortex_a75_context_restore(const void *arg)
19 {
20 	if (midr_match(CORTEX_A75_MIDR) != 0)
21 		cpuamu_context_restore(CORTEX_A75_AMU_NR_COUNTERS);
22 	return 0;
23 }
24 
25 SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_start, cortex_a75_context_save);
26 SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_finish, cortex_a75_context_restore);
27