2019-11-11 00:17:19 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2019 Carlo Caione <ccaione@baylibre.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2020-09-18 15:04:43 +08:00
|
|
|
/*
|
|
|
|
* ARM64 Cortex-A power management
|
2019-11-11 00:17:19 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <toolchain.h>
|
|
|
|
#include <linker/sections.h>
|
|
|
|
#include <arch/cpu.h>
|
|
|
|
|
2020-03-11 01:26:58 +08:00
|
|
|
_ASM_FILE_PROLOGUE
|
|
|
|
|
2019-11-11 00:17:19 +08:00
|
|
|
GTEXT(arch_cpu_idle)
|
|
|
|
SECTION_FUNC(TEXT, arch_cpu_idle)
|
2019-11-18 17:49:25 +08:00
|
|
|
#ifdef CONFIG_TRACING
|
|
|
|
stp xzr, x30, [sp, #-16]!
|
|
|
|
bl sys_trace_idle
|
|
|
|
ldp xzr, x30, [sp], #16
|
|
|
|
#endif
|
2019-11-11 00:17:19 +08:00
|
|
|
dsb sy
|
|
|
|
wfi
|
2021-02-11 22:22:04 +08:00
|
|
|
msr daifclr, #(DAIFCLR_IRQ_BIT)
|
2019-11-11 00:17:19 +08:00
|
|
|
ret
|
|
|
|
|
|
|
|
GTEXT(arch_cpu_atomic_idle)
|
|
|
|
SECTION_FUNC(TEXT, arch_cpu_atomic_idle)
|
2019-11-18 17:49:25 +08:00
|
|
|
#ifdef CONFIG_TRACING
|
2021-02-10 16:04:20 +08:00
|
|
|
stp x0, x30, [sp, #-16]!
|
2019-11-18 17:49:25 +08:00
|
|
|
bl sys_trace_idle
|
2021-02-10 16:04:20 +08:00
|
|
|
ldp x0, x30, [sp], #16
|
2019-11-18 17:49:25 +08:00
|
|
|
#endif
|
2021-02-11 22:22:04 +08:00
|
|
|
msr daifset, #(DAIFSET_IRQ_BIT)
|
2019-11-11 00:17:19 +08:00
|
|
|
isb
|
|
|
|
wfe
|
2021-02-11 22:22:04 +08:00
|
|
|
tst x0, #(DAIF_IRQ_BIT)
|
2019-11-11 00:17:19 +08:00
|
|
|
beq _irq_disabled
|
2021-02-11 22:22:04 +08:00
|
|
|
msr daifclr, #(DAIFCLR_IRQ_BIT)
|
2019-11-11 00:17:19 +08:00
|
|
|
_irq_disabled:
|
|
|
|
ret
|