blob: b1b7bb8a6e6651c766265653d9575c0dd75e97c6 [file] [log] [blame]
Dimitris Papastamos89736dd2018-02-13 11:28:02 +00001/*
John Tsichritzis56369c12019-02-19 13:49:06 +00002 * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
Dimitris Papastamos89736dd2018-02-13 11:28:02 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
John Tsichritzis56369c12019-02-19 13:49:06 +00007#include <neoverse_n1.h>
Dimitris Papastamos89736dd2018-02-13 11:28:02 +00008#include <cpuamu.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00009#include <lib/el3_runtime/pubsub_events.h>
Dimitris Papastamos89736dd2018-02-13 11:28:02 +000010
John Tsichritzis56369c12019-02-19 13:49:06 +000011static void *neoverse_n1_context_save(const void *arg)
Dimitris Papastamos89736dd2018-02-13 11:28:02 +000012{
John Tsichritzis56369c12019-02-19 13:49:06 +000013 if (midr_match(NEOVERSE_N1_MIDR) != 0)
14 cpuamu_context_save(NEOVERSE_N1_AMU_NR_COUNTERS);
Antonio Nino Diaz9fe40fd2018-10-25 17:11:02 +010015
16 return (void *)0;
Dimitris Papastamos89736dd2018-02-13 11:28:02 +000017}
18
John Tsichritzis56369c12019-02-19 13:49:06 +000019static void *neoverse_n1_context_restore(const void *arg)
Dimitris Papastamos89736dd2018-02-13 11:28:02 +000020{
John Tsichritzis56369c12019-02-19 13:49:06 +000021 if (midr_match(NEOVERSE_N1_MIDR) != 0)
22 cpuamu_context_restore(NEOVERSE_N1_AMU_NR_COUNTERS);
Antonio Nino Diaz9fe40fd2018-10-25 17:11:02 +010023
24 return (void *)0;
Dimitris Papastamos89736dd2018-02-13 11:28:02 +000025}
26
John Tsichritzis56369c12019-02-19 13:49:06 +000027SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_start, neoverse_n1_context_save);
28SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_finish, neoverse_n1_context_restore);