diff options
author | Soby Mathew <soby.mathew@arm.com> | 2016-04-29 19:01:30 +0100 |
---|---|---|
committer | Soby Mathew <soby.mathew@arm.com> | 2016-07-19 10:19:01 +0100 |
commit | cf0b1492ede6cbbf788144a56d276d8d7924500a (patch) | |
tree | e9c92fdc4021598fed52484d1a11100dbebc2b19 /lib/psci/psci_main.c | |
parent | 532ed6183868036e4a4f83cd7a71b93266a3bdb7 (diff) |
Introduce PSCI Library Interface
This patch introduces the PSCI Library interface. The major changes
introduced are as follows:
* Earlier BL31 was responsible for Architectural initialization during cold
boot via bl31_arch_setup() whereas PSCI was responsible for the same during
warm boot. This functionality is now consolidated by the PSCI library
and it does Architectural initialization via psci_arch_setup() during both
cold and warm boots.
* Earlier the warm boot entry point was always `psci_entrypoint()`. This was
not flexible enough as a library interface. Now PSCI expects the runtime
firmware to provide the entry point via `psci_setup()`. A new function
`bl31_warm_entrypoint` is introduced in BL31 and the previous
`psci_entrypoint()` is deprecated.
* The `smc_helpers.h` is reorganized to separate the SMC Calling Convention
defines from the Trusted Firmware SMC helpers. The former is now in a new
header file `smcc.h` and the SMC helpers are moved to Architecture specific
header.
* The CPU context is used by PSCI for context initialization and
restoration after power down (PSCI Context). It is also used by BL31 for SMC
handling and context management during Normal-Secure world switch (SMC
Context). The `psci_smc_handler()` interface is redefined to not use SMC
helper macros thus enabling to decouple the PSCI context from EL3 runtime
firmware SMC context. This enables PSCI to be integrated with other runtime
firmware using a different SMC context.
NOTE: With this patch the architectural setup done in `bl31_arch_setup()`
is done as part of `psci_setup()` and hence `bl31_platform_setup()` will be
invoked prior to architectural setup. It is highly unlikely that the platform
setup will depend on architectural setup and cause any failure. Please be
be aware of this change in sequence.
Change-Id: I7f497a08d33be234bbb822c28146250cb20dab73
Diffstat (limited to 'lib/psci/psci_main.c')
-rw-r--r-- | lib/psci/psci_main.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/lib/psci/psci_main.c b/lib/psci/psci_main.c index 04ef10e77..d412be3c8 100644 --- a/lib/psci/psci_main.c +++ b/lib/psci/psci_main.c @@ -33,8 +33,7 @@ #include <assert.h> #include <debug.h> #include <platform.h> -#include <runtime_svc.h> -#include <std_svc.h> +#include <smcc.h> #include <string.h> #include "psci_private.h" @@ -327,7 +326,7 @@ int psci_features(unsigned int psci_fid) /******************************************************************************* * PSCI top level handler for servicing SMCs. ******************************************************************************/ -uintptr_t psci_smc_handler(uint32_t smc_fid, +u_register_t psci_smc_handler(uint32_t smc_fid, u_register_t x1, u_register_t x2, u_register_t x3, @@ -337,11 +336,11 @@ uintptr_t psci_smc_handler(uint32_t smc_fid, u_register_t flags) { if (is_caller_secure(flags)) - SMC_RET1(handle, SMC_UNK); + return SMC_UNK; /* Check the fid against the capabilities */ if (!(psci_caps & define_psci_cap(smc_fid))) - SMC_RET1(handle, SMC_UNK); + return SMC_UNK; if (((smc_fid >> FUNCID_CC_SHIFT) & FUNCID_CC_MASK) == SMC_32) { /* 32-bit PSCI function, clear top parameter bits */ @@ -352,31 +351,31 @@ uintptr_t psci_smc_handler(uint32_t smc_fid, switch (smc_fid) { case PSCI_VERSION: - SMC_RET1(handle, psci_version()); + return psci_version(); case PSCI_CPU_OFF: - SMC_RET1(handle, psci_cpu_off()); + return psci_cpu_off(); case PSCI_CPU_SUSPEND_AARCH32: - SMC_RET1(handle, psci_cpu_suspend(x1, x2, x3)); + return psci_cpu_suspend(x1, x2, x3); case PSCI_CPU_ON_AARCH32: - SMC_RET1(handle, psci_cpu_on(x1, x2, x3)); + return psci_cpu_on(x1, x2, x3); case PSCI_AFFINITY_INFO_AARCH32: - SMC_RET1(handle, psci_affinity_info(x1, x2)); + return psci_affinity_info(x1, x2); case PSCI_MIG_AARCH32: - SMC_RET1(handle, psci_migrate(x1)); + return psci_migrate(x1); case PSCI_MIG_INFO_TYPE: - SMC_RET1(handle, psci_migrate_info_type()); + return psci_migrate_info_type(); case PSCI_MIG_INFO_UP_CPU_AARCH32: - SMC_RET1(handle, psci_migrate_info_up_cpu()); + return psci_migrate_info_up_cpu(); case PSCI_SYSTEM_SUSPEND_AARCH32: - SMC_RET1(handle, psci_system_suspend(x1, x2)); + return psci_system_suspend(x1, x2); case PSCI_SYSTEM_OFF: psci_system_off(); @@ -387,14 +386,14 @@ uintptr_t psci_smc_handler(uint32_t smc_fid, /* We should never return from psci_system_reset() */ case PSCI_FEATURES: - SMC_RET1(handle, psci_features(x1)); + return psci_features(x1); #if ENABLE_PSCI_STAT case PSCI_STAT_RESIDENCY_AARCH32: - SMC_RET1(handle, psci_stat_residency(x1, x2)); + return psci_stat_residency(x1, x2); case PSCI_STAT_COUNT_AARCH32: - SMC_RET1(handle, psci_stat_count(x1, x2)); + return psci_stat_count(x1, x2); #endif default: @@ -405,29 +404,29 @@ uintptr_t psci_smc_handler(uint32_t smc_fid, switch (smc_fid) { case PSCI_CPU_SUSPEND_AARCH64: - SMC_RET1(handle, psci_cpu_suspend(x1, x2, x3)); + return psci_cpu_suspend(x1, x2, x3); case PSCI_CPU_ON_AARCH64: - SMC_RET1(handle, psci_cpu_on(x1, x2, x3)); + return psci_cpu_on(x1, x2, x3); case PSCI_AFFINITY_INFO_AARCH64: - SMC_RET1(handle, psci_affinity_info(x1, x2)); + return psci_affinity_info(x1, x2); case PSCI_MIG_AARCH64: - SMC_RET1(handle, psci_migrate(x1)); + return psci_migrate(x1); case PSCI_MIG_INFO_UP_CPU_AARCH64: - SMC_RET1(handle, psci_migrate_info_up_cpu()); + return psci_migrate_info_up_cpu(); case PSCI_SYSTEM_SUSPEND_AARCH64: - SMC_RET1(handle, psci_system_suspend(x1, x2)); + return psci_system_suspend(x1, x2); #if ENABLE_PSCI_STAT case PSCI_STAT_RESIDENCY_AARCH64: - SMC_RET1(handle, psci_stat_residency(x1, x2)); + return psci_stat_residency(x1, x2); case PSCI_STAT_COUNT_AARCH64: - SMC_RET1(handle, psci_stat_count(x1, x2)); + return psci_stat_count(x1, x2); #endif default: @@ -436,5 +435,5 @@ uintptr_t psci_smc_handler(uint32_t smc_fid, } WARN("Unimplemented PSCI Call: 0x%x \n", smc_fid); - SMC_RET1(handle, SMC_UNK); + return SMC_UNK; } |