Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Low-level idle sequences
0004  */
0005 
0006 #include <linux/cpu.h>
0007 #include <linux/irqflags.h>
0008 
0009 #include <asm/barrier.h>
0010 #include <asm/cpuidle.h>
0011 #include <asm/cpufeature.h>
0012 #include <asm/sysreg.h>
0013 
0014 /*
0015  *  cpu_do_idle()
0016  *
0017  *  Idle the processor (wait for interrupt).
0018  *
0019  *  If the CPU supports priority masking we must do additional work to
0020  *  ensure that interrupts are not masked at the PMR (because the core will
0021  *  not wake up if we block the wake up signal in the interrupt controller).
0022  */
0023 void noinstr cpu_do_idle(void)
0024 {
0025     struct arm_cpuidle_irq_context context;
0026 
0027     arm_cpuidle_save_irq_context(&context);
0028 
0029     dsb(sy);
0030     wfi();
0031 
0032     arm_cpuidle_restore_irq_context(&context);
0033 }
0034 
0035 /*
0036  * This is our default idle handler.
0037  */
0038 void noinstr arch_cpu_idle(void)
0039 {
0040     /*
0041      * This should do all the clock switching and wait for interrupt
0042      * tricks
0043      */
0044     cpu_do_idle();
0045     raw_local_irq_enable();
0046 }