Save and use the 3rd parameter of PSCI CPU_ON request: context_id. The context_id parameter is only meaningful to the caller. U-Boot PSCI preserves a copy of the value passed in this parameter. Following wakeup from a powerdown state, U-BOOT PSCI places this value in R0 when it first enters the OS. NB: this context id is not (yet?) used by Linux but it is mandatory to be PSCI compliant. update armv7 psci functions: - psci_save_target_pc(): keep for backward compatibility with current platform (only save PC and force context id to 0) => should be removed when all platform migrate to the new API - psci_save(): new API to use by ARMv7 platform with PSCI, save pc (= entry_point_address) and context_id Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
53 lines
1.4 KiB
C
53 lines
1.4 KiB
C
/*
|
|
* Common PSCI functions
|
|
*
|
|
* Copyright (C) 2016 Chen-Yu Tsai
|
|
* Author: Chen-Yu Tsai <wens@csie.org>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <config.h>
|
|
#include <asm/armv7.h>
|
|
#include <asm/macro.h>
|
|
#include <asm/psci.h>
|
|
#include <asm/secure.h>
|
|
#include <linux/linkage.h>
|
|
|
|
static u32 psci_target_pc[CONFIG_ARMV7_PSCI_NR_CPUS] __secure_data = { 0 };
|
|
static u32 psci_context_id[CONFIG_ARMV7_PSCI_NR_CPUS] __secure_data = { 0 };
|
|
|
|
void __secure psci_save_target_pc(int cpu, u32 pc)
|
|
{
|
|
psci_target_pc[cpu] = pc;
|
|
psci_context_id[cpu] = 0;
|
|
dsb();
|
|
}
|
|
|
|
void __secure psci_save(int cpu, u32 pc, u32 context_id)
|
|
{
|
|
psci_target_pc[cpu] = pc;
|
|
psci_context_id[cpu] = context_id;
|
|
dsb();
|
|
}
|
|
|
|
u32 __secure psci_get_target_pc(int cpu)
|
|
{
|
|
return psci_target_pc[cpu];
|
|
}
|
|
|
|
u32 __secure psci_get_context_id(int cpu)
|
|
{
|
|
return psci_context_id[cpu];
|
|
}
|
|
|