blob: ecfb501517bdef12fa8e28d4bdd399a854c5cb4f [file] [log] [blame]
Dimitris Papastamos89736dd2018-02-13 11:28:02 +00001/*
Govindraj Rajaeee28e72023-08-01 15:52:40 -05002 * 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);