123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #include <assert.h>
- #include <arch_helpers.h>
- #include <bl32/payloads/tlk.h>
- #include <common/bl_common.h>
- #include <common/debug.h>
- #include <lib/el3_runtime/context_mgmt.h>
- #include <lib/psci/psci.h>
- #include "tlkd_private.h"
- extern tlk_context_t tlk_ctx;
- #define MPIDR_CPU0 0x80000000
- static int32_t cpu_migrate_info(u_register_t *resident_cpu)
- {
-
- *resident_cpu = MPIDR_CPU0;
-
- return PSCI_TOS_NOT_UP_MIG_CAP;
- }
- static void cpu_suspend_handler(u_register_t suspend_level)
- {
- gp_regs_t *gp_regs;
- int cpu = read_mpidr() & MPIDR_CPU_MASK;
- int32_t rc = 0;
-
- if ((cpu != 0) || (suspend_level != PLAT_MAX_PWR_LVL))
- return;
-
- gp_regs = get_gpregs_ctx(&tlk_ctx.cpu_ctx);
- write_ctx_reg(gp_regs, CTX_GPREG_X0, TLK_SYSTEM_SUSPEND);
-
- rc = tlkd_synchronous_sp_entry(&tlk_ctx);
-
- if (rc != 0)
- panic();
- }
- static void cpu_resume_handler(u_register_t suspend_level)
- {
- gp_regs_t *gp_regs;
- int cpu = read_mpidr() & MPIDR_CPU_MASK;
- int32_t rc = 0;
-
- if ((cpu != 0) || (suspend_level != PLAT_MAX_PWR_LVL))
- return;
-
- gp_regs = get_gpregs_ctx(&tlk_ctx.cpu_ctx);
- write_ctx_reg(gp_regs, CTX_GPREG_X0, TLK_SYSTEM_RESUME);
-
- rc = tlkd_synchronous_sp_entry(&tlk_ctx);
-
- if (rc != 0)
- panic();
- }
- const spd_pm_ops_t tlkd_pm_ops = {
- .svc_migrate_info = cpu_migrate_info,
- .svc_suspend = cpu_suspend_handler,
- .svc_suspend_finish = cpu_resume_handler,
- };
|