Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
| 8 | #include <asm_macros.S> |
| 9 | #include <platform_def.h> |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 10 | |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 11 | .globl pmu_cpuson_entrypoint |
| 12 | .macro pmusram_entry_func _name |
| 13 | .section .pmusram.entry, "ax" |
| 14 | .type \_name, %function |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 15 | .cfi_startproc |
| 16 | \_name: |
| 17 | .endm |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 18 | |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 19 | pmusram_entry_func pmu_cpuson_entrypoint |
| 20 | |
Lin Huang | 2a6df22 | 2017-05-12 10:26:32 +0800 | [diff] [blame] | 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 | |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 43 | #if PSRAM_DO_DDR_RESUME |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 44 | ddr_resume: |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 45 | ldr x2, =__bl31_sram_stack_end |
| 46 | mov sp, x2 |
Lin Huang | 1f8fdeb | 2017-05-17 16:14:37 +0800 | [diff] [blame] | 47 | bl dmc_resume |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 48 | #endif |
Lin Huang | 88dd123 | 2017-05-16 16:40:46 +0800 | [diff] [blame] | 49 | bl sram_restore |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 50 | sys_resume: |
Antonio Nino Diaz | 5823090 | 2018-09-24 17:16:20 +0100 | [diff] [blame] | 51 | bl bl31_warm_entrypoint |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 52 | endfunc pmu_cpuson_entrypoint |