blob: 73f986bf729840df7a4c58a38ae90b47d937d35f [file] [log] [blame]
Chen-Yu Tsaiae7947c2016-07-05 21:45:07 +08001/*
2 * Common PSCI functions
3 *
4 * Copyright (C) 2016 Chen-Yu Tsai
5 * Author: Chen-Yu Tsai <wens@csie.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <config.h>
21#include <asm/armv7.h>
22#include <asm/macro.h>
23#include <asm/psci.h>
24#include <asm/secure.h>
25#include <linux/linkage.h>
26
27static u32 psci_target_pc[CONFIG_ARMV7_PSCI_NR_CPUS] __secure_data = { 0 };
Patrick Delaunayfeb73eb2018-04-16 10:13:22 +020028static u32 psci_context_id[CONFIG_ARMV7_PSCI_NR_CPUS] __secure_data = { 0 };
Chen-Yu Tsaiae7947c2016-07-05 21:45:07 +080029
30void __secure psci_save_target_pc(int cpu, u32 pc)
31{
32 psci_target_pc[cpu] = pc;
Patrick Delaunayfeb73eb2018-04-16 10:13:22 +020033 psci_context_id[cpu] = 0;
Tom Rini3b787ef2016-08-01 18:54:53 -040034 dsb();
Chen-Yu Tsaiae7947c2016-07-05 21:45:07 +080035}
36
Patrick Delaunayfeb73eb2018-04-16 10:13:22 +020037void __secure psci_save(int cpu, u32 pc, u32 context_id)
38{
39 psci_target_pc[cpu] = pc;
40 psci_context_id[cpu] = context_id;
41 dsb();
42}
43
Chen-Yu Tsaiae7947c2016-07-05 21:45:07 +080044u32 __secure psci_get_target_pc(int cpu)
45{
46 return psci_target_pc[cpu];
47}
48
Patrick Delaunayfeb73eb2018-04-16 10:13:22 +020049u32 __secure psci_get_context_id(int cpu)
50{
51 return psci_context_id[cpu];
52}
53