| 1 |
/* |
| 2 |
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: BSD-3-Clause |
| 5 |
*/ |
| 6 |
|
| 7 |
#include <arch.h> |
| 8 |
#include <asm_macros.S> |
| 9 |
#include <platform_def.h> |
| 10 |
|
| 11 |
.globl pmu_cpuson_entrypoint |
| 12 |
.macro pmusram_entry_func _name |
| 13 |
.section .pmusram.entry, "ax" |
| 14 |
.type \_name, %function |
| 15 |
.cfi_startproc |
| 16 |
\_name: |
| 17 |
.endm |
| 18 |
|
| 19 |
pmusram_entry_func pmu_cpuson_entrypoint |
| 20 |
|
| 21 |
#if PSRAM_CHECK_WAKEUP_CPU |
| 22 |
check_wake_cpus: |
| 23 |
mrs x0, MPIDR_EL1 |
| 24 |
and x1, x0, #MPIDR_CPU_MASK |
| 25 |
and x0, x0, #MPIDR_CLUSTER_MASK |
| 26 |
orr x0, x0, x1 |
| 27 |
|
| 28 |
/* primary_cpu */ |
| 29 |
ldr w1, boot_mpidr |
| 30 |
cmp w0, w1 |
| 31 |
b.eq sys_wakeup |
| 32 |
|
| 33 |
/* |
| 34 |
* If the core is not the primary cpu, |
| 35 |
* force the core into wfe. |
| 36 |
*/ |
| 37 |
wfe_loop: |
| 38 |
wfe |
| 39 |
b wfe_loop |
| 40 |
sys_wakeup: |
| 41 |
#endif |
| 42 |
|
| 43 |
#if PSRAM_DO_DDR_RESUME |
| 44 |
ddr_resume: |
| 45 |
ldr x2, =__bl31_sram_stack_end |
| 46 |
mov sp, x2 |
| 47 |
bl dmc_resume |
| 48 |
#endif |
| 49 |
bl sram_restore |
| 50 |
sys_resume: |
| 51 |
bl bl31_warm_entrypoint |
| 52 |
endfunc pmu_cpuson_entrypoint |