xref: /openbmc/u-boot/arch/arm/cpu/armv7/psci-common.c (revision a78cd861)
145c334e6SChen-Yu Tsai /*
245c334e6SChen-Yu Tsai  * Common PSCI functions
345c334e6SChen-Yu Tsai  *
445c334e6SChen-Yu Tsai  * Copyright (C) 2016 Chen-Yu Tsai
545c334e6SChen-Yu Tsai  * Author: Chen-Yu Tsai <wens@csie.org>
645c334e6SChen-Yu Tsai  *
745c334e6SChen-Yu Tsai  * This program is free software; you can redistribute it and/or modify
845c334e6SChen-Yu Tsai  * it under the terms of the GNU General Public License version 2 as
945c334e6SChen-Yu Tsai  * published by the Free Software Foundation.
1045c334e6SChen-Yu Tsai  *
1145c334e6SChen-Yu Tsai  * This program is distributed in the hope that it will be useful,
1245c334e6SChen-Yu Tsai  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1345c334e6SChen-Yu Tsai  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1445c334e6SChen-Yu Tsai  * GNU General Public License for more details.
1545c334e6SChen-Yu Tsai  *
1645c334e6SChen-Yu Tsai  * You should have received a copy of the GNU General Public License
1745c334e6SChen-Yu Tsai  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
1845c334e6SChen-Yu Tsai  */
1945c334e6SChen-Yu Tsai 
2045c334e6SChen-Yu Tsai #include <config.h>
2145c334e6SChen-Yu Tsai #include <asm/armv7.h>
2245c334e6SChen-Yu Tsai #include <asm/macro.h>
2345c334e6SChen-Yu Tsai #include <asm/psci.h>
2445c334e6SChen-Yu Tsai #include <asm/secure.h>
2545c334e6SChen-Yu Tsai #include <linux/linkage.h>
2645c334e6SChen-Yu Tsai 
2745c334e6SChen-Yu Tsai static u32 psci_target_pc[CONFIG_ARMV7_PSCI_NR_CPUS] __secure_data = { 0 };
2845c334e6SChen-Yu Tsai 
2945c334e6SChen-Yu Tsai void __secure psci_save_target_pc(int cpu, u32 pc)
3045c334e6SChen-Yu Tsai {
3145c334e6SChen-Yu Tsai 	psci_target_pc[cpu] = pc;
32*a78cd861STom Rini 	dsb();
3345c334e6SChen-Yu Tsai }
3445c334e6SChen-Yu Tsai 
3545c334e6SChen-Yu Tsai u32 __secure psci_get_target_pc(int cpu)
3645c334e6SChen-Yu Tsai {
3745c334e6SChen-Yu Tsai 	return psci_target_pc[cpu];
3845c334e6SChen-Yu Tsai }
3945c334e6SChen-Yu Tsai 
40