diff options
author | Olivier Deprez <olivier.deprez@arm.com> | 2019-10-28 09:07:50 +0000 |
---|---|---|
committer | Max Shvetsov <maksims.svecovs@arm.com> | 2020-08-20 18:06:06 +0100 |
commit | b058f20a7e587e4362413cf8e4544dcc0bcaab96 (patch) | |
tree | ecb1be929396efadb083be334356733dbcf22566 /services/std_svc | |
parent | 9dcf63dd8bb02fca8f781c06e610f2012e5dc690 (diff) | |
download | platform_external_arm-trusted-firmware-b058f20a7e587e4362413cf8e4544dcc0bcaab96.tar.gz platform_external_arm-trusted-firmware-b058f20a7e587e4362413cf8e4544dcc0bcaab96.tar.bz2 platform_external_arm-trusted-firmware-b058f20a7e587e4362413cf8e4544dcc0bcaab96.zip |
SPMD: add generic SPD PM handlers
This patch defines and registers the SPMD PM handler hooks.
This is intended to relay boot and PM events to the SPMC.
Change-Id: If5a758d22b8d2152cbbb83a0cad563b5e1c6bd49
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com>
Diffstat (limited to 'services/std_svc')
-rw-r--r-- | services/std_svc/spmd/spmd_pm.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/services/std_svc/spmd/spmd_pm.c b/services/std_svc/spmd/spmd_pm.c new file mode 100644 index 000000000..eff59adb1 --- /dev/null +++ b/services/std_svc/spmd/spmd_pm.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2020, ARM Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <assert.h> +#include "spmd_private.h" + +/******************************************************************************* + * This CPU has been turned on. Enter SPMC to initialise S-EL1 or S-EL2. As part + * of the SPMC initialization path, they will initialize any SPs that they + * manage. Entry into SPMC is done after initialising minimal architectural + * state that guarantees safe execution. + ******************************************************************************/ +static void spmd_cpu_on_finish_handler(u_register_t unused) +{ + unsigned int linear_id = plat_my_core_pos(); + spmd_spm_core_context_t *ctx = spmd_get_context(); + int rc; + + assert(ctx->state != SPMC_STATE_ON); + + rc = spmd_spm_core_sync_entry(ctx); + if (rc != 0) { + ERROR("SPMC initialisation failed (%d) on CPU%u\n", rc, + linear_id); + ctx->state = SPMC_STATE_OFF; + return; + } + + ctx->state = SPMC_STATE_ON; +} + +/******************************************************************************* + * Structure populated by the SPM Dispatcher to perform any bookkeeping before + * PSCI executes a power mgmt. operation. + ******************************************************************************/ +const spd_pm_ops_t spmd_pm = { + .svc_on_finish = spmd_cpu_on_finish_handler, +}; |