diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2013-05-21 11:30:36 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-05-21 19:34:28 -0400 |
commit | f94d9a8ef9aebab5317d11fb1633ba14ad240983 (patch) | |
tree | 5966f1fb50720e3422fe0331f7a2d9a8c7aab488 /arch/mips | |
parent | bdc92d74e0ec95a8101447467c25f015105f2e5a (diff) |
MIPS: Idle: Do address fiddlery in helper functions.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/include/asm/idle.h | 11 | ||||
-rw-r--r-- | arch/mips/kernel/smtc.c | 3 | ||||
-rw-r--r-- | arch/mips/kernel/traps.c | 7 |
3 files changed, 15 insertions, 6 deletions
diff --git a/arch/mips/include/asm/idle.h b/arch/mips/include/asm/idle.h index 8b26ac5c854e..be6f807c1e3f 100644 --- a/arch/mips/include/asm/idle.h +++ b/arch/mips/include/asm/idle.h | |||
@@ -8,4 +8,15 @@ extern asmlinkage void r4k_wait(void); | |||
8 | extern void r4k_wait_irqoff(void); | 8 | extern void r4k_wait_irqoff(void); |
9 | extern void __pastwait(void); | 9 | extern void __pastwait(void); |
10 | 10 | ||
11 | static inline int using_rollback_handler(void) | ||
12 | { | ||
13 | return cpu_wait == r4k_wait; | ||
14 | } | ||
15 | |||
16 | static inline int address_is_in_r4k_wait_irqoff(unsigned long addr) | ||
17 | { | ||
18 | return addr >= (unsigned long)r4k_wait_irqoff && | ||
19 | addr < (unsigned long)__pastwait; | ||
20 | } | ||
21 | |||
11 | #endif /* __ASM_IDLE_H */ | 22 | #endif /* __ASM_IDLE_H */ |
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c index 46303bc61364..75a4fd709841 100644 --- a/arch/mips/kernel/smtc.c +++ b/arch/mips/kernel/smtc.c | |||
@@ -914,8 +914,7 @@ void smtc_send_ipi(int cpu, int type, unsigned int action) | |||
914 | */ | 914 | */ |
915 | if (cpu_wait == r4k_wait_irqoff) { | 915 | if (cpu_wait == r4k_wait_irqoff) { |
916 | tcrestart = read_tc_c0_tcrestart(); | 916 | tcrestart = read_tc_c0_tcrestart(); |
917 | if (tcrestart >= (unsigned long)r4k_wait_irqoff | 917 | if (address_is_in_r4k_wait_irqoff(tcrestart)) { |
918 | && tcrestart < (unsigned long)__pastwait) { | ||
919 | write_tc_c0_tcrestart(__pastwait); | 918 | write_tc_c0_tcrestart(__pastwait); |
920 | tcstatus &= ~TCSTATUS_IXMT; | 919 | tcstatus &= ~TCSTATUS_IXMT; |
921 | write_tc_c0_tcstatus(tcstatus); | 920 | write_tc_c0_tcstatus(tcstatus); |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index c6da4a905b98..e3be67012d78 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -1542,7 +1542,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs) | |||
1542 | extern char except_vec_vi, except_vec_vi_lui; | 1542 | extern char except_vec_vi, except_vec_vi_lui; |
1543 | extern char except_vec_vi_ori, except_vec_vi_end; | 1543 | extern char except_vec_vi_ori, except_vec_vi_end; |
1544 | extern char rollback_except_vec_vi; | 1544 | extern char rollback_except_vec_vi; |
1545 | char *vec_start = (cpu_wait == r4k_wait) ? | 1545 | char *vec_start = using_rollback_handler() ? |
1546 | &rollback_except_vec_vi : &except_vec_vi; | 1546 | &rollback_except_vec_vi : &except_vec_vi; |
1547 | #ifdef CONFIG_MIPS_MT_SMTC | 1547 | #ifdef CONFIG_MIPS_MT_SMTC |
1548 | /* | 1548 | /* |
@@ -1812,10 +1812,8 @@ void __init trap_init(void) | |||
1812 | extern char except_vec4; | 1812 | extern char except_vec4; |
1813 | extern char except_vec3_r4000; | 1813 | extern char except_vec3_r4000; |
1814 | unsigned long i; | 1814 | unsigned long i; |
1815 | int rollback; | ||
1816 | 1815 | ||
1817 | check_wait(); | 1816 | check_wait(); |
1818 | rollback = (cpu_wait == r4k_wait); | ||
1819 | 1817 | ||
1820 | #if defined(CONFIG_KGDB) | 1818 | #if defined(CONFIG_KGDB) |
1821 | if (kgdb_early_setup) | 1819 | if (kgdb_early_setup) |
@@ -1892,7 +1890,8 @@ void __init trap_init(void) | |||
1892 | if (board_be_init) | 1890 | if (board_be_init) |
1893 | board_be_init(); | 1891 | board_be_init(); |
1894 | 1892 | ||
1895 | set_except_vector(0, rollback ? rollback_handle_int : handle_int); | 1893 | set_except_vector(0, using_rollback_handler() ? rollback_handle_int |
1894 | : handle_int); | ||
1896 | set_except_vector(1, handle_tlbm); | 1895 | set_except_vector(1, handle_tlbm); |
1897 | set_except_vector(2, handle_tlbl); | 1896 | set_except_vector(2, handle_tlbl); |
1898 | set_except_vector(3, handle_tlbs); | 1897 | set_except_vector(3, handle_tlbs); |