forked from beagleboard/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minimal functionality... Signed-off-by: Jonas Bonn <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]>
- Loading branch information
Jonas Bonn
committed
Jul 22, 2011
1 parent
09abb90
commit 2a7be11
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* Copyright (C) 2010-2011 Jonas Bonn <[email protected]> | ||
* | ||
* 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(); | ||
} | ||
} |