diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/kernel/Makefile_32 | 2 | ||||
-rw-r--r-- | arch/sh/kernel/Makefile_64 | 2 | ||||
-rw-r--r-- | arch/sh/kernel/idle.c | 81 | ||||
-rw-r--r-- | arch/sh/kernel/process_32.c | 61 | ||||
-rw-r--r-- | arch/sh/kernel/process_64.c | 60 |
5 files changed, 83 insertions, 123 deletions
diff --git a/arch/sh/kernel/Makefile_32 b/arch/sh/kernel/Makefile_32 index d3f2726b07dc..d9df9e567946 100644 --- a/arch/sh/kernel/Makefile_32 +++ b/arch/sh/kernel/Makefile_32 | |||
@@ -9,7 +9,7 @@ ifdef CONFIG_FUNCTION_TRACER | |||
9 | CFLAGS_REMOVE_ftrace.o = -pg | 9 | CFLAGS_REMOVE_ftrace.o = -pg |
10 | endif | 10 | endif |
11 | 11 | ||
12 | obj-y := debugtraps.o disassemble.o io.o io_generic.o irq.o \ | 12 | obj-y := debugtraps.o disassemble.o idle.o io.o io_generic.o irq.o \ |
13 | machvec.o process_32.o ptrace_32.o setup.o signal_32.o \ | 13 | machvec.o process_32.o ptrace_32.o setup.o signal_32.o \ |
14 | sys_sh.o sys_sh32.o syscalls_32.o time_32.o topology.o \ | 14 | sys_sh.o sys_sh32.o syscalls_32.o time_32.o topology.o \ |
15 | traps.o traps_32.o | 15 | traps.o traps_32.o |
diff --git a/arch/sh/kernel/Makefile_64 b/arch/sh/kernel/Makefile_64 index c97660b2b48d..4304b2593c2c 100644 --- a/arch/sh/kernel/Makefile_64 +++ b/arch/sh/kernel/Makefile_64 | |||
@@ -1,6 +1,6 @@ | |||
1 | extra-y := head_64.o init_task.o vmlinux.lds | 1 | extra-y := head_64.o init_task.o vmlinux.lds |
2 | 2 | ||
3 | obj-y := debugtraps.o io.o io_generic.o irq.o machvec.o process_64.o \ | 3 | obj-y := debugtraps.o idle.o io.o io_generic.o irq.o machvec.o process_64.o \ |
4 | ptrace_64.o setup.o signal_64.o sys_sh.o sys_sh64.o \ | 4 | ptrace_64.o setup.o signal_64.o sys_sh.o sys_sh64.o \ |
5 | syscalls_64.o time_64.o topology.o traps.o traps_64.o | 5 | syscalls_64.o time_64.o topology.o traps.o traps_64.o |
6 | 6 | ||
diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c new file mode 100644 index 000000000000..fe59ccfc1152 --- /dev/null +++ b/arch/sh/kernel/idle.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | * The idle loop for all SuperH platforms. | ||
3 | * | ||
4 | * Copyright (C) 2002 - 2008 Paul Mundt | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/mm.h> | ||
13 | #include <linux/pm.h> | ||
14 | #include <linux/tick.h> | ||
15 | #include <linux/preempt.h> | ||
16 | #include <linux/thread_info.h> | ||
17 | #include <linux/irqflags.h> | ||
18 | #include <asm/pgalloc.h> | ||
19 | #include <asm/system.h> | ||
20 | #include <asm/atomic.h> | ||
21 | |||
22 | static int hlt_counter; | ||
23 | void (*pm_idle)(void); | ||
24 | void (*pm_power_off)(void); | ||
25 | EXPORT_SYMBOL(pm_power_off); | ||
26 | |||
27 | static int __init nohlt_setup(char *__unused) | ||
28 | { | ||
29 | hlt_counter = 1; | ||
30 | return 1; | ||
31 | } | ||
32 | __setup("nohlt", nohlt_setup); | ||
33 | |||
34 | static int __init hlt_setup(char *__unused) | ||
35 | { | ||
36 | hlt_counter = 0; | ||
37 | return 1; | ||
38 | } | ||
39 | __setup("hlt", hlt_setup); | ||
40 | |||
41 | static void default_idle(void) | ||
42 | { | ||
43 | if (!hlt_counter) { | ||
44 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
45 | smp_mb__after_clear_bit(); | ||
46 | set_bl_bit(); | ||
47 | stop_critical_timings(); | ||
48 | |||
49 | while (!need_resched()) | ||
50 | cpu_sleep(); | ||
51 | |||
52 | start_critical_timings(); | ||
53 | clear_bl_bit(); | ||
54 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
55 | } else | ||
56 | while (!need_resched()) | ||
57 | cpu_relax(); | ||
58 | } | ||
59 | |||
60 | void cpu_idle(void) | ||
61 | { | ||
62 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
63 | |||
64 | /* endless idle loop with no priority at all */ | ||
65 | while (1) { | ||
66 | void (*idle)(void) = pm_idle; | ||
67 | |||
68 | if (!idle) | ||
69 | idle = default_idle; | ||
70 | |||
71 | tick_nohz_stop_sched_tick(1); | ||
72 | while (!need_resched()) | ||
73 | idle(); | ||
74 | tick_nohz_restart_sched_tick(); | ||
75 | |||
76 | preempt_enable_no_resched(); | ||
77 | schedule(); | ||
78 | preempt_disable(); | ||
79 | check_pgt_cache(); | ||
80 | } | ||
81 | } | ||
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c index e781540bd991..130817affa64 100644 --- a/arch/sh/kernel/process_32.c +++ b/arch/sh/kernel/process_32.c | |||
@@ -32,69 +32,8 @@ | |||
32 | #include <asm/fpu.h> | 32 | #include <asm/fpu.h> |
33 | #include <asm/syscalls.h> | 33 | #include <asm/syscalls.h> |
34 | 34 | ||
35 | static int hlt_counter; | ||
36 | int ubc_usercnt = 0; | 35 | int ubc_usercnt = 0; |
37 | 36 | ||
38 | void (*pm_idle)(void); | ||
39 | void (*pm_power_off)(void); | ||
40 | EXPORT_SYMBOL(pm_power_off); | ||
41 | |||
42 | static int __init nohlt_setup(char *__unused) | ||
43 | { | ||
44 | hlt_counter = 1; | ||
45 | return 1; | ||
46 | } | ||
47 | __setup("nohlt", nohlt_setup); | ||
48 | |||
49 | static int __init hlt_setup(char *__unused) | ||
50 | { | ||
51 | hlt_counter = 0; | ||
52 | return 1; | ||
53 | } | ||
54 | __setup("hlt", hlt_setup); | ||
55 | |||
56 | static void default_idle(void) | ||
57 | { | ||
58 | if (!hlt_counter) { | ||
59 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
60 | smp_mb__after_clear_bit(); | ||
61 | set_bl_bit(); | ||
62 | stop_critical_timings(); | ||
63 | |||
64 | while (!need_resched()) | ||
65 | cpu_sleep(); | ||
66 | |||
67 | start_critical_timings(); | ||
68 | clear_bl_bit(); | ||
69 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
70 | } else | ||
71 | while (!need_resched()) | ||
72 | cpu_relax(); | ||
73 | } | ||
74 | |||
75 | void cpu_idle(void) | ||
76 | { | ||
77 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
78 | |||
79 | /* endless idle loop with no priority at all */ | ||
80 | while (1) { | ||
81 | void (*idle)(void) = pm_idle; | ||
82 | |||
83 | if (!idle) | ||
84 | idle = default_idle; | ||
85 | |||
86 | tick_nohz_stop_sched_tick(1); | ||
87 | while (!need_resched()) | ||
88 | idle(); | ||
89 | tick_nohz_restart_sched_tick(); | ||
90 | |||
91 | preempt_enable_no_resched(); | ||
92 | schedule(); | ||
93 | preempt_disable(); | ||
94 | check_pgt_cache(); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | void machine_restart(char * __unused) | 37 | void machine_restart(char * __unused) |
99 | { | 38 | { |
100 | /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */ | 39 | /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */ |
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c index b7aa09235b51..597cf02db3fc 100644 --- a/arch/sh/kernel/process_64.c +++ b/arch/sh/kernel/process_64.c | |||
@@ -33,56 +33,6 @@ | |||
33 | 33 | ||
34 | struct task_struct *last_task_used_math = NULL; | 34 | struct task_struct *last_task_used_math = NULL; |
35 | 35 | ||
36 | static int hlt_counter = 1; | ||
37 | |||
38 | #define HARD_IDLE_TIMEOUT (HZ / 3) | ||
39 | |||
40 | static int __init nohlt_setup(char *__unused) | ||
41 | { | ||
42 | hlt_counter = 1; | ||
43 | return 1; | ||
44 | } | ||
45 | |||
46 | static int __init hlt_setup(char *__unused) | ||
47 | { | ||
48 | hlt_counter = 0; | ||
49 | return 1; | ||
50 | } | ||
51 | |||
52 | __setup("nohlt", nohlt_setup); | ||
53 | __setup("hlt", hlt_setup); | ||
54 | |||
55 | static inline void hlt(void) | ||
56 | { | ||
57 | __asm__ __volatile__ ("sleep" : : : "memory"); | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * The idle loop on a uniprocessor SH.. | ||
62 | */ | ||
63 | void cpu_idle(void) | ||
64 | { | ||
65 | /* endless idle loop with no priority at all */ | ||
66 | while (1) { | ||
67 | if (hlt_counter) { | ||
68 | while (!need_resched()) | ||
69 | cpu_relax(); | ||
70 | } else { | ||
71 | local_irq_disable(); | ||
72 | while (!need_resched()) { | ||
73 | local_irq_enable(); | ||
74 | hlt(); | ||
75 | local_irq_disable(); | ||
76 | } | ||
77 | local_irq_enable(); | ||
78 | } | ||
79 | preempt_enable_no_resched(); | ||
80 | schedule(); | ||
81 | preempt_disable(); | ||
82 | } | ||
83 | |||
84 | } | ||
85 | |||
86 | void machine_restart(char * __unused) | 36 | void machine_restart(char * __unused) |
87 | { | 37 | { |
88 | extern void phys_stext(void); | 38 | extern void phys_stext(void); |
@@ -97,13 +47,6 @@ void machine_halt(void) | |||
97 | 47 | ||
98 | void machine_power_off(void) | 48 | void machine_power_off(void) |
99 | { | 49 | { |
100 | #if 0 | ||
101 | /* Disable watchdog timer */ | ||
102 | ctrl_outl(0xa5000000, WTCSR); | ||
103 | /* Configure deep standby on sleep */ | ||
104 | ctrl_outl(0x03, STBCR); | ||
105 | #endif | ||
106 | |||
107 | __asm__ __volatile__ ( | 50 | __asm__ __volatile__ ( |
108 | "sleep\n\t" | 51 | "sleep\n\t" |
109 | "synci\n\t" | 52 | "synci\n\t" |
@@ -113,9 +56,6 @@ void machine_power_off(void) | |||
113 | panic("Unexpected wakeup!\n"); | 56 | panic("Unexpected wakeup!\n"); |
114 | } | 57 | } |
115 | 58 | ||
116 | void (*pm_power_off)(void) = machine_power_off; | ||
117 | EXPORT_SYMBOL(pm_power_off); | ||
118 | |||
119 | void show_regs(struct pt_regs * regs) | 59 | void show_regs(struct pt_regs * regs) |
120 | { | 60 | { |
121 | unsigned long long ah, al, bh, bl, ch, cl; | 61 | unsigned long long ah, al, bh, bl, ch, cl; |