diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-24 09:55:18 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-24 09:55:18 -0700 |
commit | ff0c4ad2c3a75ccfe6adca916e50804eb45bb2d9 (patch) | |
tree | 574f2d38793f7a08af73c40a96d6dc76af9c6f46 /arch/openrisc/kernel/idle.c | |
parent | fcda12e7f6d58d61997681a9d41779e3fd2ffc94 (diff) | |
parent | 19f9d392365113f74286b1721c7c032c12cf5abd (diff) | |
download | op-kernel-dev-ff0c4ad2c3a75ccfe6adca916e50804eb45bb2d9.zip op-kernel-dev-ff0c4ad2c3a75ccfe6adca916e50804eb45bb2d9.tar.gz |
Merge branch 'for-upstream' of git://openrisc.net/jonas/linux
* 'for-upstream' of git://openrisc.net/jonas/linux: (24 commits)
OpenRISC: Add MAINTAINERS entry
OpenRISC: Miscellaneous
OpenRISC: Library routines
OpenRISC: Headers
OpenRISC: Traps
OpenRISC: Module support
OpenRISC: GPIO
OpenRISC: Scheduling/Process management
OpenRISC: Idle/Power management
OpenRISC: System calls
OpenRISC: IRQ
OpenRISC: Timekeeping
OpenRISC: DMA
OpenRISC: PTrace
OpenRISC: Build infrastructure
OpenRISC: Signal handling
OpenRISC: Memory management
OpenRISC: Device tree
OpenRISC: Boot code
iomap: make IOPORT/PCI mapping functions conditional
...
Diffstat (limited to 'arch/openrisc/kernel/idle.c')
-rw-r--r-- | arch/openrisc/kernel/idle.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/arch/openrisc/kernel/idle.c b/arch/openrisc/kernel/idle.c new file mode 100644 index 0000000..d5bc5f8 --- /dev/null +++ b/arch/openrisc/kernel/idle.c @@ -0,0 +1,77 @@ +/* + * OpenRISC idle.c + * + * Linux architectural port borrowing liberally from similar works of + * others. All original copyrights apply as per the original source + * declaration. + * + * Modifications for the OpenRISC architecture: + * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com> + * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Idle daemon for or32. Idle daemon will handle any action + * that needs to be taken when the system becomes idle. + */ + +#include <linux/errno.h> +#include <linux/sched.h> +#include <linux/kernel.h> +#include <linux/mm.h> +#include <linux/smp.h> +#include <linux/stddef.h> +#include <linux/unistd.h> +#include <linux/ptrace.h> +#include <linux/slab.h> +#include <linux/tick.h> + +#include <asm/pgtable.h> +#include <asm/uaccess.h> +#include <asm/system.h> +#include <asm/io.h> +#include <asm/processor.h> +#include <asm/mmu.h> +#include <asm/cache.h> +#include <asm/pgalloc.h> + +void (*powersave) (void) = NULL; + +static inline void pm_idle(void) +{ + barrier(); +} + +void cpu_idle(void) +{ + set_thread_flag(TIF_POLLING_NRFLAG); + + /* endless idle loop with no priority at all */ + while (1) { + tick_nohz_stop_sched_tick(1); + + while (!need_resched()) { + check_pgt_cache(); + rmb(); + + clear_thread_flag(TIF_POLLING_NRFLAG); + + local_irq_disable(); + /* Don't trace irqs off for idle */ + stop_critical_timings(); + if (!need_resched() && powersave != NULL) + powersave(); + start_critical_timings(); + local_irq_enable(); + set_thread_flag(TIF_POLLING_NRFLAG); + } + + tick_nohz_restart_sched_tick(); + preempt_enable_no_resched(); + schedule(); + preempt_disable(); + } +} |