2018-02-13 11:28:02 +00:00
|
|
|
/*
|
2019-02-19 13:49:06 +00:00
|
|
|
* Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
|
2018-02-13 11:28:02 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*/
|
|
|
|
|
2019-02-19 13:49:06 +00:00
|
|
|
#include <neoverse_n1.h>
|
2018-02-13 11:28:02 +00:00
|
|
|
#include <cpuamu.h>
|
2018-12-14 00:18:21 +00:00
|
|
|
#include <lib/el3_runtime/pubsub_events.h>
|
2018-02-13 11:28:02 +00:00
|
|
|
|
2019-02-19 13:49:06 +00:00
|
|
|
static void *neoverse_n1_context_save(const void *arg)
|
2018-02-13 11:28:02 +00:00
|
|
|
{
|
2019-02-19 13:49:06 +00:00
|
|
|
if (midr_match(NEOVERSE_N1_MIDR) != 0)
|
|
|
|
cpuamu_context_save(NEOVERSE_N1_AMU_NR_COUNTERS);
|
2018-10-25 17:11:02 +01:00
|
|
|
|
|
|
|
return (void *)0;
|
2018-02-13 11:28:02 +00:00
|
|
|
}
|
|
|
|
|
2019-02-19 13:49:06 +00:00
|
|
|
static void *neoverse_n1_context_restore(const void *arg)
|
2018-02-13 11:28:02 +00:00
|
|
|
{
|
2019-02-19 13:49:06 +00:00
|
|
|
if (midr_match(NEOVERSE_N1_MIDR) != 0)
|
|
|
|
cpuamu_context_restore(NEOVERSE_N1_AMU_NR_COUNTERS);
|
2018-10-25 17:11:02 +01:00
|
|
|
|
|
|
|
return (void *)0;
|
2018-02-13 11:28:02 +00:00
|
|
|
}
|
|
|
|
|
2019-02-19 13:49:06 +00:00
|
|
|
SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_start, neoverse_n1_context_save);
|
|
|
|
SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_finish, neoverse_n1_context_restore);
|