neoverse_n1_pubsub.c 722 Bytes
Newer Older
1
/*
2
 * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
3
4
5
6
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

7
#include <neoverse_n1.h>
8
#include <cpuamu.h>
9
#include <lib/el3_runtime/pubsub_events.h>
10

11
static void *neoverse_n1_context_save(const void *arg)
12
{
13
14
	if (midr_match(NEOVERSE_N1_MIDR) != 0)
		cpuamu_context_save(NEOVERSE_N1_AMU_NR_COUNTERS);
15
16

	return (void *)0;
17
18
}

19
static void *neoverse_n1_context_restore(const void *arg)
20
{
21
22
	if (midr_match(NEOVERSE_N1_MIDR) != 0)
		cpuamu_context_restore(NEOVERSE_N1_AMU_NR_COUNTERS);
23
24

	return (void *)0;
25
26
}

27
28
SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_start, neoverse_n1_context_save);
SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_finish, neoverse_n1_context_restore);