xref: /openbmc/u-boot/arch/arm/cpu/armv7/psci-common.c (revision 45c334e6)
1*45c334e6SChen-Yu Tsai /*
2*45c334e6SChen-Yu Tsai  * Common PSCI functions
3*45c334e6SChen-Yu Tsai  *
4*45c334e6SChen-Yu Tsai  * Copyright (C) 2016 Chen-Yu Tsai
5*45c334e6SChen-Yu Tsai  * Author: Chen-Yu Tsai <wens@csie.org>
6*45c334e6SChen-Yu Tsai  *
7*45c334e6SChen-Yu Tsai  * This program is free software; you can redistribute it and/or modify
8*45c334e6SChen-Yu Tsai  * it under the terms of the GNU General Public License version 2 as
9*45c334e6SChen-Yu Tsai  * published by the Free Software Foundation.
10*45c334e6SChen-Yu Tsai  *
11*45c334e6SChen-Yu Tsai  * This program is distributed in the hope that it will be useful,
12*45c334e6SChen-Yu Tsai  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*45c334e6SChen-Yu Tsai  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*45c334e6SChen-Yu Tsai  * GNU General Public License for more details.
15*45c334e6SChen-Yu Tsai  *
16*45c334e6SChen-Yu Tsai  * You should have received a copy of the GNU General Public License
17*45c334e6SChen-Yu Tsai  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18*45c334e6SChen-Yu Tsai  */
19*45c334e6SChen-Yu Tsai 
20*45c334e6SChen-Yu Tsai #include <config.h>
21*45c334e6SChen-Yu Tsai #include <asm/armv7.h>
22*45c334e6SChen-Yu Tsai #include <asm/macro.h>
23*45c334e6SChen-Yu Tsai #include <asm/psci.h>
24*45c334e6SChen-Yu Tsai #include <asm/secure.h>
25*45c334e6SChen-Yu Tsai #include <linux/linkage.h>
26*45c334e6SChen-Yu Tsai 
27*45c334e6SChen-Yu Tsai static u32 psci_target_pc[CONFIG_ARMV7_PSCI_NR_CPUS] __secure_data = { 0 };
28*45c334e6SChen-Yu Tsai 
29*45c334e6SChen-Yu Tsai void __secure psci_save_target_pc(int cpu, u32 pc)
30*45c334e6SChen-Yu Tsai {
31*45c334e6SChen-Yu Tsai 	psci_target_pc[cpu] = pc;
32*45c334e6SChen-Yu Tsai 	DSB;
33*45c334e6SChen-Yu Tsai }
34*45c334e6SChen-Yu Tsai 
35*45c334e6SChen-Yu Tsai u32 __secure psci_get_target_pc(int cpu)
36*45c334e6SChen-Yu Tsai {
37*45c334e6SChen-Yu Tsai 	return psci_target_pc[cpu];
38*45c334e6SChen-Yu Tsai }
39*45c334e6SChen-Yu Tsai 
40