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 |
| 15 | .func \_name |
| 16 | .cfi_startproc |
| 17 | \_name: |
| 18 | .endm |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 19 | |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 20 | pmusram_entry_func pmu_cpuson_entrypoint |
| 21 | |
Lin Huang | 2a6df22 | 2017-05-12 10:26:32 +0800 | [diff] [blame] | 22 | #if PSRAM_CHECK_WAKEUP_CPU |
| 23 | check_wake_cpus: |
| 24 | mrs x0, MPIDR_EL1 |
| 25 | and x1, x0, #MPIDR_CPU_MASK |
| 26 | and x0, x0, #MPIDR_CLUSTER_MASK |
| 27 | orr x0, x0, x1 |
| 28 | |
| 29 | /* primary_cpu */ |
| 30 | ldr w1, boot_mpidr |
| 31 | cmp w0, w1 |
| 32 | b.eq sys_wakeup |
| 33 | |
| 34 | /* |
| 35 | * If the core is not the primary cpu, |
| 36 | * force the core into wfe. |
| 37 | */ |
| 38 | wfe_loop: |
| 39 | wfe |
| 40 | b wfe_loop |
| 41 | sys_wakeup: |
| 42 | #endif |
| 43 | |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 44 | #if PSRAM_DO_DDR_RESUME |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 45 | ddr_resume: |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 46 | ldr x2, =__bl31_sram_stack_end |
| 47 | mov sp, x2 |
| 48 | bl dmc_restore |
| 49 | #endif |
Lin Huang | 88dd123 | 2017-05-16 16:40:46 +0800 | [diff] [blame] | 50 | bl sram_restore |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 51 | sys_resume: |
| 52 | bl psci_entrypoint |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 53 | endfunc pmu_cpuson_entrypoint |