mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 01:54:22 +00:00
PSCI: Do psci_setup() as part of std_svc_setup()
This patch moves the invocation of `psci_setup()` from BL31 and SP_MIN into `std_svc_setup()` as part of ARM Standard Service initialization. This allows us to consolidate ARM Standard Service initializations which will be added to in the future. A new function `get_arm_std_svc_args()` is introduced to get arguments corresponding to each standard service. This function must be implemented by the EL3 Runtime Firmware and both SP_MIN and BL31 implement it. Change-Id: I38e1b644f797fa4089b20574bd4a10f0419de184
This commit is contained in:
parent
f426fc0519
commit
58e946aec5
4 changed files with 58 additions and 24 deletions
|
@ -53,21 +53,27 @@ static int32_t (*bl32_init)(void);
|
|||
******************************************************************************/
|
||||
static uint32_t next_image_type = NON_SECURE;
|
||||
|
||||
/*
|
||||
* Implement the ARM Standard Service function to get arguments for a
|
||||
* particular service.
|
||||
*/
|
||||
uintptr_t get_arm_std_svc_args(unsigned int svc_mask)
|
||||
{
|
||||
/* Setup the arguments for PSCI Library */
|
||||
DEFINE_STATIC_PSCI_LIB_ARGS_V1(psci_args, bl31_warm_entrypoint);
|
||||
|
||||
/* PSCI is the only ARM Standard Service implemented */
|
||||
assert(svc_mask == PSCI_FID_MASK);
|
||||
|
||||
return (uintptr_t)&psci_args;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Simple function to initialise all BL31 helper libraries.
|
||||
******************************************************************************/
|
||||
void bl31_lib_init(void)
|
||||
{
|
||||
/* Setup the arguments for PSCI Library */
|
||||
DEFINE_STATIC_PSCI_LIB_ARGS_V1(psci_args, bl31_warm_entrypoint);
|
||||
|
||||
cm_init();
|
||||
|
||||
/*
|
||||
* Initialize the PSCI library here. This also does EL3 architectural
|
||||
* setup.
|
||||
*/
|
||||
psci_setup(&psci_args);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -89,7 +95,7 @@ void bl31_main(void)
|
|||
/* Initialise helper libraries */
|
||||
bl31_lib_init();
|
||||
|
||||
/* Initialize the runtime services e.g. psci */
|
||||
/* Initialize the runtime services e.g. psci. */
|
||||
INFO("BL31: Initializing runtime services\n");
|
||||
runtime_svc_init();
|
||||
|
||||
|
|
|
@ -150,31 +150,34 @@ static void sp_min_prepare_next_image_entry(void)
|
|||
smc_get_next_ctx());
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Implement the ARM Standard Service function to get arguments for a
|
||||
* particular service.
|
||||
*****************************************************************************/
|
||||
uintptr_t get_arm_std_svc_args(unsigned int svc_mask)
|
||||
{
|
||||
/* Setup the arguments for PSCI Library */
|
||||
DEFINE_STATIC_PSCI_LIB_ARGS_V1(psci_args, sp_min_warm_entrypoint);
|
||||
|
||||
/* PSCI is the only ARM Standard Service implemented */
|
||||
assert(svc_mask == PSCI_FID_MASK);
|
||||
|
||||
return (uintptr_t)&psci_args;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* The SP_MIN main function. Do the platform and PSCI Library setup. Also
|
||||
* initialize the runtime service framework.
|
||||
*****************************************************************************/
|
||||
void sp_min_main(void)
|
||||
{
|
||||
/* Setup the arguments for PSCI Library */
|
||||
DEFINE_STATIC_PSCI_LIB_ARGS_V1(psci_args, sp_min_warm_entrypoint);
|
||||
|
||||
NOTICE("SP_MIN: %s\n", version_string);
|
||||
NOTICE("SP_MIN: %s\n", build_message);
|
||||
|
||||
/* Perform the SP_MIN platform setup */
|
||||
sp_min_platform_setup();
|
||||
|
||||
/*
|
||||
* Initialize the PSCI library and perform the remaining generic
|
||||
* architectural setup from PSCI.
|
||||
*/
|
||||
psci_setup(&psci_args);
|
||||
|
||||
/*
|
||||
* Initialize the runtime services e.g. psci
|
||||
* This is where the monitor mode will be initialized
|
||||
*/
|
||||
/* Initialize the runtime services e.g. psci */
|
||||
INFO("SP_MIN: Initializing runtime services\n");
|
||||
runtime_svc_init();
|
||||
|
||||
|
|
|
@ -42,4 +42,13 @@
|
|||
#define STD_SVC_VERSION_MAJOR 0x0
|
||||
#define STD_SVC_VERSION_MINOR 0x1
|
||||
|
||||
/*
|
||||
* Get the ARM Standard Service argument from EL3 Runtime.
|
||||
* This function must be implemented by EL3 Runtime and the
|
||||
* `svc_mask` identifies the service. `svc_mask` is a bit
|
||||
* mask identifying the range of SMC function IDs available
|
||||
* to the service.
|
||||
*/
|
||||
uintptr_t get_arm_std_svc_args(unsigned int svc_mask);
|
||||
|
||||
#endif /* __STD_SVC_H__ */
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
#include <psci.h>
|
||||
#include <runtime_svc.h>
|
||||
|
@ -41,6 +42,21 @@ DEFINE_SVC_UUID(arm_svc_uid,
|
|||
0x108d905b, 0xf863, 0x47e8, 0xae, 0x2d,
|
||||
0xc0, 0xfb, 0x56, 0x41, 0xf6, 0xe2);
|
||||
|
||||
/* Setup Standard Services */
|
||||
static int32_t std_svc_setup(void)
|
||||
{
|
||||
uintptr_t svc_arg;
|
||||
|
||||
svc_arg = get_arm_std_svc_args(PSCI_FID_MASK);
|
||||
assert(svc_arg);
|
||||
|
||||
/*
|
||||
* PSCI is the only specification implemented as a Standard Service.
|
||||
* The `psci_setup()` also does EL3 architectural setup.
|
||||
*/
|
||||
return psci_setup((const psci_lib_args_t *)svc_arg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Top-level Standard Service SMC handler. This handler will in turn dispatch
|
||||
* calls to PSCI SMC handler
|
||||
|
@ -93,6 +109,6 @@ DECLARE_RT_SVC(
|
|||
OEN_STD_START,
|
||||
OEN_STD_END,
|
||||
SMC_TYPE_FAST,
|
||||
NULL,
|
||||
std_svc_setup,
|
||||
std_svc_smc_handler
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue